21 #ifndef DD4HEP_OPAQUEDATA_INL_H
22 #define DD4HEP_OPAQUEDATA_INL_H
33 template <
typename T>
static void opaqueCopyObject(
void* t,
const void*
s) {
34 new(t)
T(*(
const T*)
s);
36 template <
typename T>
static void opaqueDestructObject(
void* p) {
56 this->
bind(&BasicGrammar::instance<T>(),opaqueCopyObject<T>,opaqueDestructObject<T>);
62 T& ret = this->bind<T>();
63 if ( !value.empty() && !this->
fromString(value) ) {
64 throw std::runtime_error(
"OpaqueDataBlock::set> Failed to bind type "+
65 typeName(
typeid(
T))+
" to condition data block.");
72 T& ret = this->bind<T>();
73 if ( !value.empty() && !this->
fromString(value) ) {
74 throw std::runtime_error(
"OpaqueDataBlock::set> Failed to bind type "+
75 typeName(
typeid(
T))+
" to condition data block.");
virtual const std::type_info & type() const =0
Access to the type information.
T & set(const std::string &value)
Bind grammar and assign value.
std::string typeName(const std::type_info &type)
ABI information about type names.
T & get()
Generic getter. Specify the exact type, not a polymorph type.
bool fromString(const std::string &rep)
Create data block from string representation.
void * pointer
Pointer to object data.
const BasicGrammar * grammar
Data type.
T & bind()
Bind data value.