DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
dd4hep::PluginTester Class Reference

Helper class to ease testing of plugins: Effectively a container of object extensions. More...

#include <PluginTester.h>

Classes

struct  Entry
 Defintiion of the extension entry. More...
 

Public Types

typedef std::pair< const std::type_info *, std::string > key_type
 Definition of the extension type. More...
 
typedef std::map< key_type, void * > Extensions
 Mapped extension type. More...
 
typedef void(* destruct_t) (void *)
 Extensions destructor type. More...
 
typedef std::map< const std::type_info *, EntryExtensionMap
 

Public Member Functions

void * addExtension (void *ptr, const std::string &name, const std::type_info &info, destruct_t dtor)
 Add an extension object to the detector element. More...
 
void * extension (const std::string &name, const std::type_info &info, bool alert) const
 Access an existing extension object from the detector element. More...
 
void * removeExtension (const std::string &name, const std::type_info &info, bool destroy)
 Remove an existing extension object from the instance. More...
 
 PluginTester ()
 Default constructor. More...
 
 PluginTester (const PluginTester &copy)=delete
 Copy constructor. More...
 
virtual ~PluginTester ()
 Default destructor. More...
 
PluginTesteroperator= (const PluginTester &copy)=delete
 Assignment operator. More...
 
void clear (bool destroy=true)
 Clear all extensions. More...
 
template<typename Q >
Q * addExtension (Q *ptr, const std::string &name)
 
template<typename Q >
Q * extension (const std::string &name, bool alert=true)
 
template<typename Q >
Q * removeExtension (const std::string &name, bool destroy=true)
 

Static Public Member Functions

static void _noDelete (void *)
 Function to be passed as dtor if object should NOT be deleted! More...
 
template<typename T >
static void _delete (void *ptr)
 Templated destructor function. More...
 

Public Attributes

Extensions extensions
 The extensions object. More...
 
ExtensionMapextensionMap = 0
 Pointer to the extension map. More...
 

Detailed Description

Helper class to ease testing of plugins: Effectively a container of object extensions.

Definition at line 30 of file PluginTester.h.

Member Typedef Documentation

◆ destruct_t

typedef void(* dd4hep::PluginTester::destruct_t) (void *)

Extensions destructor type.

Definition at line 37 of file PluginTester.h.

◆ ExtensionMap

typedef std::map<const std::type_info*, Entry> dd4hep::PluginTester::ExtensionMap

Definition at line 44 of file PluginTester.h.

◆ Extensions

typedef std::map<key_type, void*> dd4hep::PluginTester::Extensions

Mapped extension type.

Definition at line 35 of file PluginTester.h.

◆ key_type

typedef std::pair<const std::type_info*,std::string> dd4hep::PluginTester::key_type

Definition of the extension type.

Definition at line 33 of file PluginTester.h.

Constructor & Destructor Documentation

◆ PluginTester() [1/2]

PluginTester::PluginTester ( )

Default constructor.

Definition at line 36 of file PluginTester.cpp.

◆ PluginTester() [2/2]

dd4hep::PluginTester::PluginTester ( const PluginTester copy)
delete

Copy constructor.

◆ ~PluginTester()

PluginTester::~PluginTester ( )
virtual

Default destructor.

Definition at line 42 of file PluginTester.cpp.

Member Function Documentation

◆ _delete()

template<typename T >
static void dd4hep::PluginTester::_delete ( void *  ptr)
inlinestatic

Templated destructor function.

Definition at line 55 of file PluginTester.h.

◆ _noDelete()

static void dd4hep::PluginTester::_noDelete ( void *  )
inlinestatic

Function to be passed as dtor if object should NOT be deleted!

Definition at line 52 of file PluginTester.h.

◆ addExtension() [1/2]

template<typename Q >
Q* dd4hep::PluginTester::addExtension ( Q *  ptr,
const std::string &  name 
)
inline

Definition at line 77 of file PluginTester.h.

◆ addExtension() [2/2]

void * PluginTester::addExtension ( void *  ptr,
const std::string &  name,
const std::type_info &  info,
destruct_t  dtor 
)

Add an extension object to the detector element.

Definition at line 64 of file PluginTester.cpp.

◆ clear()

void PluginTester::clear ( bool  destroy = true)

Clear all extensions.

Internal object destructor: release extension object(s)

Definition at line 48 of file PluginTester.cpp.

◆ extension() [1/2]

template<typename Q >
Q* dd4hep::PluginTester::extension ( const std::string &  name,
bool  alert = true 
)
inline

Definition at line 80 of file PluginTester.h.

◆ extension() [2/2]

void * PluginTester::extension ( const std::string &  name,
const std::type_info &  info,
bool  alert 
) const

Access an existing extension object from the detector element.

Definition at line 103 of file PluginTester.cpp.

◆ operator=()

PluginTester& dd4hep::PluginTester::operator= ( const PluginTester copy)
delete

Assignment operator.

◆ removeExtension() [1/2]

template<typename Q >
Q* dd4hep::PluginTester::removeExtension ( const std::string &  name,
bool  destroy = true 
)
inline

Definition at line 83 of file PluginTester.h.

◆ removeExtension() [2/2]

void * PluginTester::removeExtension ( const std::string &  name,
const std::type_info &  info,
bool  destroy 
)

Remove an existing extension object from the instance.

Definition at line 82 of file PluginTester.cpp.

Member Data Documentation

◆ extensionMap

ExtensionMap* dd4hep::PluginTester::extensionMap = 0

Pointer to the extension map.

Definition at line 49 of file PluginTester.h.

◆ extensions

Extensions dd4hep::PluginTester::extensions

The extensions object.

Definition at line 47 of file PluginTester.h.


The documentation for this class was generated from the following files: