ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
xAOD::TDestructorRegistry Class Reference

Application-wide registry of destructor objects. More...

#include <TDestructorRegistry.h>

Collaboration diagram for xAOD::TDestructorRegistry:

Public Member Functions

const TVirtualDestructorget (const std::type_info &ti) const
 Get the destructor for a given type. More...
 
template<class T >
void add ()
 Add a new destructor object. More...
 

Static Public Member Functions

static TDestructorRegistryinstance ()
 Function accessing the singleton instance of this type. More...
 

Private Types

typedef std::map< const std::type_info *, std::unique_ptr< TVirtualDestructor > > Map_t
 Type of the internal map. More...
 

Private Member Functions

 TDestructorRegistry ()
 Hide the constructor of the type. More...
 
 TDestructorRegistry (const TDestructorRegistry &)=delete
 Hide the copy-constructor. More...
 

Private Attributes

Map_t m_types
 Internal map of known destructor objects. More...
 
std::shared_timed_mutex m_mutex
 Mutex for the destructor map. More...
 

Detailed Description

Application-wide registry of destructor objects.

This registry is used to keep track of how to destruct objects that are kept in the transient store, and don't have a ROOT dictionary available for them.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 31 of file TDestructorRegistry.h.

Member Typedef Documentation

◆ Map_t

typedef std::map< const std::type_info*, std::unique_ptr< TVirtualDestructor > > xAOD::TDestructorRegistry::Map_t
private

Type of the internal map.

Definition at line 51 of file TDestructorRegistry.h.

Constructor & Destructor Documentation

◆ TDestructorRegistry() [1/2]

xAOD::TDestructorRegistry::TDestructorRegistry ( )
private

Hide the constructor of the type.

Definition at line 41 of file TDestructorRegistry.cxx.

42  : m_types(), m_mutex() {
43 
44  }

◆ TDestructorRegistry() [2/2]

xAOD::TDestructorRegistry::TDestructorRegistry ( const TDestructorRegistry )
privatedelete

Hide the copy-constructor.

Member Function Documentation

◆ add()

template<class T >
void xAOD::TDestructorRegistry::add ( )

Add a new destructor object.

◆ get()

const TVirtualDestructor * xAOD::TDestructorRegistry::get ( const std::type_info &  ti) const

Get the destructor for a given type.

Definition at line 23 of file TDestructorRegistry.cxx.

23  {
24 
25  // Get a "read lock":
26  std::shared_lock< std::shared_timed_mutex > lock( m_mutex );
27 
28  // Look for this type:
29  Map_t::const_iterator itr = m_types.find( &ti );
30  if( itr != m_types.end() ) {
31  return itr->second.get();
32  }
33 
34  // We didn't find it:
35  ::Error( "xAOD::TDestructorRegistry::get",
36  XAOD_MESSAGE( "Destructor not known for type %s" ),
37  SG::normalizedTypeinfoName( ti ).c_str() );
38  return nullptr;
39  }

◆ instance()

TDestructorRegistry & xAOD::TDestructorRegistry::instance ( )
static

Function accessing the singleton instance of this type.

Definition at line 16 of file TDestructorRegistry.cxx.

16  {
17 
18  static TDestructorRegistry obj ATLAS_THREAD_SAFE; // this class is thread-safe
19  return obj;
20  }

Member Data Documentation

◆ m_mutex

std::shared_timed_mutex xAOD::TDestructorRegistry::m_mutex
mutableprivate

Mutex for the destructor map.

This type is used because the registry is filled mostly at the very beginning of a job, and is just read from there on. For the reading the clients don't need exclusive locks on the store.

Definition at line 60 of file TDestructorRegistry.h.

◆ m_types

Map_t xAOD::TDestructorRegistry::m_types
private

Internal map of known destructor objects.

Definition at line 53 of file TDestructorRegistry.h.


The documentation for this class was generated from the following files:
SG::normalizedTypeinfoName
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Definition: normalizedTypeinfoName.cxx:120
xAOD::TDestructorRegistry::TDestructorRegistry
TDestructorRegistry()
Hide the constructor of the type.
Definition: TDestructorRegistry.cxx:41
xAOD::TDestructorRegistry::m_types
Map_t m_types
Internal map of known destructor objects.
Definition: TDestructorRegistry.h:53
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
xAOD::TDestructorRegistry::m_mutex
std::shared_timed_mutex m_mutex
Mutex for the destructor map.
Definition: TDestructorRegistry.h:60
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
python.PyAthena.obj
obj
Definition: PyAthena.py:132