ATLAS Offline Software
Loading...
Searching...
No Matches
TDestructorRegistry.cxx
Go to the documentation of this file.
1// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3// ROOT include(s):
4#include <TError.h>
5
6// Framework include(s):
9
10// Local include(s):
13
14namespace xAOD {
15
17
18 static TDestructorRegistry obj ATLAS_THREAD_SAFE; // this class is thread-safe
19 return obj;
20 }
21
23 TDestructorRegistry::get( const std::type_info& ti ) const {
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 }
40
45
46} // namespace xAOD
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
TDestructorRegistry()
Hide the constructor of the type.
Map_t m_types
Internal map of known destructor objects.
std::shared_timed_mutex m_mutex
Mutex for the destructor map.
const TVirtualDestructor * get(const std::type_info &ti) const
Get the destructor for a given type.
static TDestructorRegistry & instance()
Function accessing the singleton instance of this type.
Base class for the templated destructor types.
Definition TDestructor.h:25
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...
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Convert a type_info to a normalized string representation (matching the names used in the root dictio...