ATLAS Offline Software
Loading...
Searching...
No Matches
THolderCache.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_THOLDERCACHE_H
6#define XAODROOTACCESS_THOLDERCACHE_H
7
8// System include(s):
9#include <map>
10#include <shared_mutex>
11#include <utility>
12
13// Forward declaration(s):
14namespace std {
15 class type_info;
16}
17class TClass;
18
19namespace xAOD {
20
21 namespace Internal {
22
32
33 public:
35 static THolderCache& instance();
36
38 std::pair< bool, ::TClass* >
39 getClass( const std::type_info& ti ) const;
41 void addClass( const std::type_info& ti, ::TClass* cl );
42
44 int getRef( void* ptr ) const;
46 int incRef( void* ptr );
48 int decRef( void* ptr );
49
50 private:
54 THolderCache( const THolderCache& ) = delete;
55
57 std::map< const std::type_info*, TClass* > m_typeMap;
59 std::map< void*, int > m_refMap;
60
62 mutable std::shared_timed_mutex m_typeMapMutex;
64 mutable std::shared_timed_mutex m_refMapMutex;
65
66 }; // class THolderCache
67
68 } // namespace Internal
69
70} // namespace xAOD
71
72#endif // XAODROOTACCESS_THOLDERCACHE_H
std::shared_timed_mutex m_typeMapMutex
Mutex for the type map.
static THolderCache & instance()
Singleton accessor.
int getRef(void *ptr) const
Get the reference count of an object in memory.
void addClass(const std::type_info &ti, ::TClass *cl)
Add the dictionary for a given type.
std::pair< bool, ::TClass * > getClass(const std::type_info &ti) const
Get the dictionary for a given type info.
std::shared_timed_mutex m_refMapMutex
Mutex for the reference count map.
THolderCache()
Hide the constructor of the class from the outside.
std::map< const std::type_info *, TClass * > m_typeMap
The type map.
THolderCache(const THolderCache &)=delete
Delete the copy constructor.
int decRef(void *ptr)
Decrease the reference count of an object in memory.
std::map< void *, int > m_refMap
The reference count map.
int incRef(void *ptr)
Increment the reference count of an object in memory.
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.