22 using namespace DD4hep;
25 static int s_extensionID = 0;
27 static std::map<const std::type_info*, PluginTester::ExtensionMap> s_map;
47 void* ptr = (*i).second;
49 ExtensionMap::iterator j =
extensionMap->find((*i).first.first);
69 entry.
id = ++s_extensionID;
74 throw std::runtime_error(
"DD4hep: addExtension: Object already has an extension "+name+
83 void *ptr = (*j).second;
95 throw std::runtime_error(
"DD4hep: removeExtension: The object "+name+
96 " of type " +
typeName(info) +
" is not present.");
102 Extensions::const_iterator j =
extensions.find(key);
108 throw std::runtime_error(
"DD4hep: extension: Object has no extension "+name+
109 " of type:" +
typeName(info) +
".");
Defintiion of the extension entry.
virtual ~PluginTester()
Default destructor.
std::pair< const std::type_info *, std::string > key_type
Definition of the extension type.
static void decrement(T *)
Decrement count according to type information.
void * removeExtension(const std::string &name, const std::type_info &info, bool destroy)
Remove an existing extension object from the instance.
std::string typeName(const std::type_info &type)
ABI information about type names.
Extensions extensions
The extensions object.
std::map< const std::type_info *, Entry > ExtensionMap
void * extension(const std::string &name, const std::type_info &info, bool alert) const
Access an existing extension object from the detector element.
ExtensionMap * extensionMap
Pointer to the extension map.
void * addExtension(void *ptr, const std::string &name, const std::type_info &info, destruct_t dtor)
Add an extension object to the detector element.
PluginTester()
Default constructor.
static void increment(T *)
Increment count according to type information.
void clear(bool destroy=true)
Clear all extensions.