5#ifndef XAODROOTACCESS_TSTORE_H
6#define XAODROOTACCESS_TSTORE_H
12#include <unordered_map>
70 template<
typename T >
71 ::Bool_t
contains(
const std::string& key )
const;
74 template<
typename T >
75 ::Bool_t
isConst(
const std::string& key )
const;
78 template<
typename T >
79 StatusCode
retrieve(
const T*& obj,
const std::string& key )
const;
81 template<
typename T >
82 StatusCode
retrieve( T*& obj,
const std::string& key )
const;
85 template<
typename T >
86 StatusCode
record( T* obj,
const std::string& key );
88 template<
typename T >
89 StatusCode
record( std::unique_ptr< T > obj,
const std::string& key );
92 template<
typename T >
93 StatusCode
record(
const T* obj,
const std::string& key );
95 template<
typename T >
96 StatusCode
record( std::unique_ptr< const T > obj,
const std::string& key );
99 template<
typename T >
100 void keys( std::vector< std::string >& vkeys )
const;
106 StatusCode
remove(
const std::string& key );
108 StatusCode
remove(
void* ptr );
120 ::Bool_t
contains(
const std::string& key,
121 const std::type_info& ti )
const;
123 ::Bool_t
isConst(
const std::string& key,
124 const std::type_info& ti )
const;
126 void*
getObject(
const std::string& key,
const std::type_info& ti )
const;
129 const std::type_info& ti )
const;
131 StatusCode
record(
void* obj,
const std::string& key,
132 const std::string& classname,
133 ::Bool_t isOwner, ::Bool_t
isConst );
135 StatusCode
record(
void* obj,
const std::string& key,
136 const std::type_info& ti,
137 ::Bool_t isOwner, ::Bool_t
isConst );
142 const std::type_info& ti,
143 ::Bool_t isOwner, ::Bool_t
isConst );
153 ::Bool_t
contains(
const void* ptr )
const;
157 const std::string&
getName(
const void* ptr )
const;
159 void getNames(
const std::string& targetClassName,
160 std::vector<std::string>& vkeys )
const;
165 typedef std::unordered_map< std::string, THolder* >
Objects_t;
174 std::unordered_map< const void*, const std::string* >
m_names;
178 template<
typename T >
180 ::Bool_t isOwner, ::Bool_t
isConst );
DataVector adapter that acts like it holds const pointers.
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Tool for accessing xAOD files outside of Athena.
This class takes care of holding EDM objects in memory.
void keys(std::vector< std::string > &vkeys) const
provide a list of keys associated with a type
StatusCode record(std::unique_ptr< const T > obj, const std::string &key)
Add a const object to the store, explicitly taking ownership of it.
StatusCode remove(const std::string &key)
Remove an object from the store by name.
StatusCode record_impl(T *obj, const std::string &key, ::Bool_t isOwner, ::Bool_t isConst)
Internal implementation of the templated record method.
SG::SGKeyMap< std::string > HashedKeys_t
Type of the internal storage for the hashed keys of the object names.
void setActive()
Set this as the active transient store in the application.
void print() const
Print the current contents of the transient store.
std::unordered_map< std::string, THolder * > Objects_t
Type of the internal container storing all the objects.
StatusCode retrieve(const T *&obj, const std::string &key) const
Retrieve either a constant or non-constant object from the store.
const void * getConstObject(const std::string &key, const std::type_info &ti) const
Function retrieving a const object in a non-template way.
void clear()
Clear the store of all of its contents.
virtual ~TStore()
Destructor.
StatusCode record(T *obj, const std::string &key)
Add an object to the store.
void getNames(const std::string &targetClassName, std::vector< std::string > &vkeys) const
Function determining the list keys associated with a type name.
const std::string & getName(SG::sgkey_t hash) const
Get the name corresponding to a hashed key.
friend class TEvent
Make TEvent a friend of this class.
StatusCode record(std::unique_ptr< T > obj, const std::string &key)
Add an object to the store, explicitly taking ownership of it.
HashedKeys_t m_keys
The key map.
void * getObject(const std::string &key, const std::type_info &ti) const
Function retrieving a non-const object in a non-template way.
TStore & operator=(const TStore &)=delete
Disallow copying the object.
std::unordered_map< const void *, const std::string * > m_names
Key of each managed object, by object pointer (points into m_objects).
const THolder * holder(const std::string &key) const
return holder for key
TStore(const TStore &)=delete
Disallow copying the object.
StatusCode retrieve(T *&obj, const std::string &key) const
Retrieve a non-constant object from the store.
::Bool_t contains(const std::string &key) const
Function checking if an object is available from the store.
Objects_t m_objects
The object storage.
StatusCode record(const T *obj, const std::string &key)
Add a const object to the store.
TStore()
Default constructor.
StatusCode record(ConstDataVector< T > *obj, const std::string &key, const std::type_info &ti, ::Bool_t isOwner, ::Bool_t isConst)
Function doing the first step of recording a ConstDataVector object.
::Bool_t isConst(const std::string &key) const
Function checking if an object with a given type is constant.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
std::unordered_map< sgkey_t, T > SGKeyMap
A map using sgkey_t as a key.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.