ATLAS Offline Software
TDestructorRegistry.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 //
3 // Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 //
5 #ifndef XAODROOTACCESS_TOOLS_TDESTRUCTORREGISTRY_H
6 #define XAODROOTACCESS_TOOLS_TDESTRUCTORREGISTRY_H
7 
8 // System include(s):
9 #include <map>
10 #include <shared_mutex>
11 #include <memory>
12 
13 // Forward declaration(s):
14 namespace std {
15  class type_info;
16 }
17 
18 namespace xAOD {
19 
20  // Forward declaration(s):
21  class TVirtualDestructor;
22 
32 
33  public:
35  static TDestructorRegistry& instance();
36 
38  const TVirtualDestructor* get( const std::type_info& ti ) const;
40  template< class T >
41  void add();
42 
43  private:
48 
50  typedef std::map< const std::type_info*,
51  std::unique_ptr< TVirtualDestructor > > Map_t;
60  mutable std::shared_timed_mutex m_mutex;
61 
62  }; // class TDestructorRegistry
63 
64 } // namespace xAOD
65 
66 // Include the template implementation:
67 #include "TDestructorRegistry.icc"
68 
69 #endif // XAODROOTACCESS_TOOLS_TDESTRUCTORREGISTRY_H
xAOD::TDestructorRegistry::add
void add()
Add a new destructor object.
xAOD::TDestructorRegistry::TDestructorRegistry
TDestructorRegistry()
Hide the constructor of the type.
Definition: TDestructorRegistry.cxx:41
xAOD::TDestructorRegistry::Map_t
std::map< const std::type_info *, std::unique_ptr< TVirtualDestructor > > Map_t
Type of the internal map.
Definition: TDestructorRegistry.h:51
xAOD::TDestructorRegistry::m_types
Map_t m_types
Internal map of known destructor objects.
Definition: TDestructorRegistry.h:53
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
TDestructorRegistry.icc
xAOD::TVirtualDestructor
Base class for the templated destructor types.
Definition: TDestructor.h:25
xAOD::TDestructorRegistry
Application-wide registry of destructor objects.
Definition: TDestructorRegistry.h:31
xAOD::TDestructorRegistry::instance
static TDestructorRegistry & instance()
Function accessing the singleton instance of this type.
Definition: TDestructorRegistry.cxx:16
xAOD::TDestructorRegistry::TDestructorRegistry
TDestructorRegistry(const TDestructorRegistry &)=delete
Hide the copy-constructor.
xAOD::TDestructorRegistry::m_mutex
std::shared_timed_mutex m_mutex
Mutex for the destructor map.
Definition: TDestructorRegistry.h:60
xAOD::TDestructorRegistry::get
const TVirtualDestructor * get(const std::type_info &ti) const
Get the destructor for a given type.
Definition: TDestructorRegistry.cxx:23