|
DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
Go to the documentation of this file.
15 #ifndef DD4HEP_PLUGINTESTER_H
16 #define DD4HEP_PLUGINTESTER_H 1
33 typedef std::pair<const std::type_info*,std::string>
key_type;
55 template <
typename T>
static void _delete(
void* ptr) {
62 void*
extension(
const std::string& name,
const std::type_info&
info,
bool alert)
const;
76 void clear(
bool destroy=
true);
77 template<
typename Q> Q*
addExtension(Q* ptr,
const std::string& name) {
78 return (Q*)
addExtension(ptr, name,
typeid(Q), _delete<Q>);
80 template<
typename Q> Q*
extension(
const std::string& name,
bool alert=
true) {
81 return (Q*)
extension(name,
typeid(Q), alert);
83 template<
typename Q> Q*
removeExtension(
const std::string& name,
bool destroy=
true) {
89 #endif // DD4HEP_PLUGINTESTER_H
void clear(bool destroy=true)
Clear all extensions.
std::pair< const std::type_info *, std::string > key_type
Definition of the extension type.
PluginTester()
Default constructor.
virtual ~PluginTester()
Default destructor.
std::size_t info(const std::string &src, const std::string &msg)
void * removeExtension(const std::string &name, const std::type_info &info, bool destroy)
Remove an existing extension object from the instance.
ExtensionMap * extensionMap
Pointer to the extension map.
Q * extension(const std::string &name, bool alert=true)
PluginTester(const PluginTester ©)=delete
Copy constructor.
std::map< const std::type_info *, Entry > ExtensionMap
std::map< key_type, void * > Extensions
Mapped extension type.
void * extension(const std::string &name, const std::type_info &info, bool alert) const
Access an existing extension object from the detector element.
void * addExtension(void *ptr, const std::string &name, const std::type_info &info, destruct_t dtor)
Add an extension object to the detector element.
void(* destruct_t)(void *)
Extensions destructor type.
Q * removeExtension(const std::string &name, bool destroy=true)
static void _delete(void *ptr)
Templated destructor function.
static void _noDelete(void *)
Function to be passed as dtor if object should NOT be deleted!
Helper class to ease testing of plugins: Effectively a container of object extensions.
Namespace for the AIDA detector description toolkit.
Defintiion of the extension entry.
Q * addExtension(Q *ptr, const std::string &name)
PluginTester & operator=(const PluginTester ©)=delete
Assignment operator.
Extensions extensions
The extensions object.