Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
51510e3f
Commit
51510e3f
authored
4 years ago
by
Markus FRANK
Committed by
MarkusFrankATcernch
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Support for conditions with non-default ctor
parent
f6a5228f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DDCore/include/DD4hep/OpaqueData.h
+9
-0
9 additions, 0 deletions
DDCore/include/DD4hep/OpaqueData.h
DDCore/src/OpaqueData.cpp
+12
-0
12 additions, 0 deletions
DDCore/src/OpaqueData.cpp
with
21 additions
and
0 deletions
DDCore/include/DD4hep/OpaqueData.h
+
9
−
0
View file @
51510e3f
...
@@ -122,6 +122,8 @@ namespace dd4hep {
...
@@ -122,6 +122,8 @@ namespace dd4hep {
void
*
bind
(
const
BasicGrammar
*
grammar
);
void
*
bind
(
const
BasicGrammar
*
grammar
);
/// Bind data value in place
/// Bind data value in place
void
*
bind
(
void
*
ptr
,
size_t
len
,
const
BasicGrammar
*
grammar
);
void
*
bind
(
void
*
ptr
,
size_t
len
,
const
BasicGrammar
*
grammar
);
/// Bind external data value to the pointer
void
bindExtern
(
void
*
ptr
,
const
BasicGrammar
*
grammar
);
/// Construct conditions object and bind the data
/// Construct conditions object and bind the data
template
<
typename
T
,
typename
...
Args
>
T
&
construct
(
Args
...
args
);
template
<
typename
T
,
typename
...
Args
>
T
&
construct
(
Args
...
args
);
/// Bind data value
/// Bind data value
...
@@ -132,6 +134,8 @@ namespace dd4hep {
...
@@ -132,6 +134,8 @@ namespace dd4hep {
template
<
typename
T
>
T
&
bind
(
const
std
::
string
&
value
);
template
<
typename
T
>
T
&
bind
(
const
std
::
string
&
value
);
/// Bind data value
/// Bind data value
template
<
typename
T
>
T
&
bind
(
void
*
ptr
,
size_t
len
,
const
std
::
string
&
value
);
template
<
typename
T
>
T
&
bind
(
void
*
ptr
,
size_t
len
,
const
std
::
string
&
value
);
/// Bind external data value to the pointer
template
<
typename
T
>
void
bindExtern
(
T
*
ptr
);
};
};
/// Generic getter. Specify the exact type, not a polymorph type
/// Generic getter. Specify the exact type, not a polymorph type
...
@@ -183,5 +187,10 @@ namespace dd4hep {
...
@@ -183,5 +187,10 @@ namespace dd4hep {
}
}
return
ret
;
return
ret
;
}
}
/// Bind external data value to the pointer
template
<
typename
T
>
void
OpaqueDataBlock
::
bindExtern
(
T
*
ptr
)
{
bindExtern
(
ptr
,
&
BasicGrammar
::
instance
<
T
>
());
}
}
/* End namespace dd4hep */
}
/* End namespace dd4hep */
#endif
/* DD4HEP_OPAQUEDATA_H */
#endif
/* DD4HEP_OPAQUEDATA_H */
This diff is collapsed.
Click to expand it.
DDCore/src/OpaqueData.cpp
+
12
−
0
View file @
51510e3f
...
@@ -143,6 +143,18 @@ void* OpaqueDataBlock::bind(const BasicGrammar* g) {
...
@@ -143,6 +143,18 @@ void* OpaqueDataBlock::bind(const BasicGrammar* g) {
return
0
;
return
0
;
}
}
/// Bind external data value to the pointer
void
OpaqueDataBlock
::
bindExtern
(
void
*
ptr
,
const
BasicGrammar
*
gr
)
{
if
(
grammar
!=
0
&&
type
!=
EXTERN_DATA
)
{
// We cannot ingore secondary requests for data bindings.
// This leads to memory leaks in the caller!
except
(
"OpaqueData"
,
"You may not bind opaque data multiple times!"
);
}
pointer
=
ptr
;
grammar
=
gr
;
type
=
EXTERN_DATA
;
}
/// Set data value
/// Set data value
void
*
OpaqueDataBlock
::
bind
(
void
*
ptr
,
size_t
size
,
const
BasicGrammar
*
g
)
{
void
*
OpaqueDataBlock
::
bind
(
void
*
ptr
,
size_t
size
,
const
BasicGrammar
*
g
)
{
if
(
(
type
&
EXTERN_DATA
)
==
EXTERN_DATA
)
{
if
(
(
type
&
EXTERN_DATA
)
==
EXTERN_DATA
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment