13 #ifndef DD4HEP_GEOMETRY_OBJECTEXTENSIONS_H
14 #define DD4HEP_GEOMETRY_OBJECTEXTENSIONS_H
34 typedef std::map<const std::type_info*, void*>
Extensions;
36 typedef void* (*copy_t)(
const void*,
void* arg);
56 template <
typename T>
static void _delete(
void* ptr) {
72 void clear(
bool destroy=
true);
82 void*
extension(
const std::type_info& info,
bool alert)
const;
84 void*
extension(
const std::type_info& info)
const;
Defintiion of the extension entry.
void move(ObjectExtensions ©)
Move extensions to target object.
std::map< const std::type_info *, void * > Extensions
Definition of the extension type.
std::map< const std::type_info *, Entry > ExtensionMap
Extensions extensions
The extensions object.
void copyFrom(const Extensions &ext, void *arg)
Copy object extensions from another object. Hosting type must be identical!
ObjectExtensions(const std::type_info &parent_type)
Default constructor.
static void _delete(void *ptr)
Templated destructor function.
ObjectExtensions & operator=(const ObjectExtensions ©)=delete
Assignment operator.
void clear(bool destroy=true)
Clear all extensions.
void *(* copy_t)(const void *, void *arg)
Extensions copy constructor type.
virtual ~ObjectExtensions()
Default destructor.
void * extension(const std::type_info &info, bool alert) const
Access an existing extension object from the detector element.
void * addExtension(void *ptr, const std::type_info &info, copy_t ctor, destruct_t dtor)
Add an extension object to the detector element.
void(* destruct_t)(void *)
Extensions destructor type.
static void _noDelete(void *)
Function to be passed as dtor if object should NOT be deleted!
void * removeExtension(const std::type_info &info, bool destroy)
Remove an existing extension object from the instance.
Implementation of an object supporting arbitrary user extensions.
ExtensionMap * extensionMap
Pointer to the extension map.