ATLAS Offline Software
|
Python interface to xAOD::TStore. More...
#include <TPyStore.h>
Public Member Functions | |
::Bool_t | contains (const std::string &key, const std::string &type) const |
Function checking if an object with a given key and type is available. More... | |
::Bool_t | isConst (const std::string &key, const std::string &type) const |
Function checking if an object with a given key and type is constant. More... | |
StatusCode | record (void *obj, const std::string &key, const std::string &type) |
Record an object into the store in a typeless way. More... | |
void | dump () const |
Print the contents of the store using a Python friendly function. More... | |
TStore () | |
Inherit the constructor(s) of xAOD::TStore . More... | |
TStore (const TStore &)=delete | |
Inherit the constructor(s) of xAOD::TStore . More... | |
void | setActive () |
Set this as the active transient store in the application. More... | |
void | print () const |
Print the current contents of the transient store. More... | |
Transient data accessor/modifier functions | |
template<typename T > | |
::Bool_t | contains (const std::string &key) const |
Function checking if an object is available from the store. More... | |
template<typename T > | |
::Bool_t | isConst (const std::string &key) const |
Function checking if an object with a given type is constant. More... | |
template<typename T > | |
StatusCode | retrieve (const T *&obj, const std::string &key) const |
Retrieve either a constant or non-constant object from the store. More... | |
template<typename T > | |
StatusCode | retrieve (T *&obj, const std::string &key) const |
Retrieve a non-constant object from the store. More... | |
template<typename T > | |
StatusCode | record (T *obj, const std::string &key) |
Add an object to the store. More... | |
template<typename T > | |
StatusCode | record (std::unique_ptr< T > obj, const std::string &key) |
Add an object to the store, explicitly taking ownership of it. More... | |
template<typename T > | |
StatusCode | record (const T *obj, const std::string &key) |
Add a const object to the store. More... | |
template<typename T > | |
void | keys (std::vector< std::string > &vkeys) const |
provide a list of keys associated with a type More... | |
const THolder * | holder (const std::string &key) const |
return holder for key More... | |
StatusCode | remove (const std::string &key) |
Remove an object from the store by name. More... | |
StatusCode | remove (void *ptr) |
Remove an object from the store by pointer. More... | |
void | clear () |
Clear the store of all of its contents. More... | |
Protected Types | |
typedef std::map< std::string, THolder * > | Objects_t |
Type of the internal container storing all the objects. More... | |
typedef SG::SGKeyMap< std::string > | HashedKeys_t |
Type of the internal storage for the hashed keys of the object names. More... | |
Protected Member Functions | |
::Bool_t | contains (const std::string &key, const std::type_info &ti) const |
Non-templated function implementing the containment check. More... | |
::Bool_t | isConst (const std::string &key, const std::type_info &ti) const |
Non-templated function implementing the const-ness check. More... | |
StatusCode | record (void *obj, const std::string &key, const std::string &classname, ::Bool_t isOwner, ::Bool_t isConst) |
Function recording an object that has a dictionary available. More... | |
StatusCode | record (void *obj, const std::string &key, const std::type_info &ti, ::Bool_t isOwner, ::Bool_t isConst) |
Function recording an object that has no dictionary. More... | |
template<class T > | |
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. More... | |
StatusCode | record (THolder *hldr, const std::string &key) |
Function doing the second step of recording a ConstDataVector object. More... | |
void * | getObject (const std::string &key, const std::type_info &ti) const |
Function retrieving a non-const object in a non-template way. More... | |
const void * | getConstObject (const std::string &key, const std::type_info &ti) const |
Function retrieving a const object in a non-template way. More... | |
Functions mostly used by TEvent in the TVirtualEvent functions | |
::Bool_t | contains (SG::sgkey_t hash) const |
Check if an object with a given hash is managed by the store. More... | |
::Bool_t | contains (const void *ptr) const |
Check if an object with a given pointer is managed by the store. More... | |
const std::string & | getName (SG::sgkey_t hash) const |
Get the name corresponding to a hashed key. More... | |
const std::string & | getName (const void *ptr) const |
Get the name of a managed object. More... | |
void | getNames (const std::string &targetClassName, std::vector< std::string > &vkeys) const |
Function determining the list keys associated with a type name. More... | |
Functions mostly used by TEvent in the TVirtualEvent functions | |
::Bool_t | contains (SG::sgkey_t hash) const |
Check if an object with a given hash is managed by the store. More... | |
::Bool_t | contains (const void *ptr) const |
Check if an object with a given pointer is managed by the store. More... | |
const std::string & | getName (SG::sgkey_t hash) const |
Get the name corresponding to a hashed key. More... | |
const std::string & | getName (const void *ptr) const |
Get the name of a managed object. More... | |
void | getNames (const std::string &targetClassName, std::vector< std::string > &vkeys) const |
Function determining the list keys associated with a type name. More... | |
Protected Attributes | |
Objects_t | m_objects |
The object storage. More... | |
HashedKeys_t | m_keys |
The key map. More... | |
Private Member Functions | |
template<typename T > | |
StatusCode | record_impl (T *obj, const std::string &key, ::Bool_t isOwner, ::Bool_t isConst) |
Internal implementation of the templated record method. More... | |
Python interface to xAOD::TStore.
In order to make it possible to record objects that are created in Python, into an xAOD::TStore object (to be able to pass it to some tools that expect the object to be in the event for instance), this class extends the xAOD::TStore object with some non-template functions. Functions that are inconvenient to use from C++, but which allow for much more flexibility in PyROOT.
Definition at line 30 of file TPyStore.h.
|
protectedinherited |
|
protectedinherited |
|
inherited |
|
inherited |
Function checking if an object is available from the store.
Function checking if an object with a given key and type is available.
This function can be used in the same manner as TStore::contains<...>(...), but instead of providing a type, one gives it a type name.
Note that only types that have a proper ROOT dictionary can be used. Unlike C++, which allows one to insert any type of object into TStore.
key | The key of the object that we're looking for |
type | The type name of the object we're trying to access |
kTRUE
if the object is acessible, kFALSE
otherwise Definition at line 27 of file TPyStore.cxx.
|
protectedinherited |
Non-templated function implementing the containment check.
Definition at line 152 of file TStore.cxx.
|
protectedinherited |
Check if an object with a given pointer is managed by the store.
This is a quite slow function.
It needs to check each managed object to possibly find which one of them has this pointer.
ptr | Pointer to the object that may or may not be in the store |
kTRUE
if the object is managed by the store, or kFALSE
if it isn't Definition at line 343 of file TStore.cxx.
|
protectedinherited |
Check if an object with a given hash is managed by the store.
This is a reasonably fast function.
It checks whether an object with the specified hashed key is managed by the store.
hash | The hashed key of the object that we are looking for |
kTRUE
if the object is managed by the store, or kFALSE
if it is not Definition at line 330 of file TStore.cxx.
void xAOD::TPyStore::dump | ( | ) | const |
Print the contents of the store using a Python friendly function.
This is just a convenience function, to make it easier to print the contents of such objects in Python.
Since the base class's print() function has a special meaning in Python.
Definition at line 121 of file TPyStore.cxx.
|
protectedinherited |
Function retrieving a const object in a non-template way.
Definition at line 211 of file TStore.cxx.
Get the name of a managed object.
This is just as slow as the previous contains function.
It needs to look at all the managed objects one by one to find under what name it is managed.
ptr | Pointer to the object that we want to know the name of |
Definition at line 390 of file TStore.cxx.
|
protectedinherited |
Get the name corresponding to a hashed key.
This is a fairly fast function.
Used by ElementLinks that point to objects in this store.
hash | The hashed key for which we want to find the string key |
Definition at line 366 of file TStore.cxx.
|
protectedinherited |
Function determining the list keys associated with a type name.
Definition at line 409 of file TStore.cxx.
|
protectedinherited |
Function retrieving a non-const object in a non-template way.
Definition at line 191 of file TStore.cxx.
return holder for key
Definition at line 50 of file TStore.cxx.
|
inherited |
Function checking if an object with a given type is constant.
Function checking if an object with a given key and type is constant.
This function can be used in the same manner as TStore::isConst<...>(...), but instead of providing a type, one gives it a type name.
Note that only types that have a proper ROOT dictionary can be used. Unlike C++, which allows one to insert any type of object into TStore.
key | The key of the object that we're looking for |
type | The type name of the object we're trying to access |
kTRUE
if the object is acessible, kFALSE
otherwise Definition at line 63 of file TPyStore.cxx.
|
protectedinherited |
Non-templated function implementing the const-ness check.
Definition at line 165 of file TStore.cxx.
|
inherited |
provide a list of keys associated with a type
|
inherited |
Print the current contents of the transient store.
This is really just meant for debugging an analysis code, to see what's going on in it.
Behaves a bit similar to StoreGateSvc::dump().
Definition at line 124 of file TStore.cxx.
|
inherited |
Add a const object to the store.
|
protectedinherited |
Function doing the first step of recording a ConstDataVector object.
|
inherited |
Add an object to the store, explicitly taking ownership of it.
|
inherited |
Add an object to the store.
Function doing the second step of recording a ConstDataVector object.
Definition at line 303 of file TStore.cxx.
|
protectedinherited |
Function recording an object that has a dictionary available.
This internal function does the heavy lifting of recording objects into the store that have a proper ROOT dictionary.
obj | Typeless pointer to the object being recorded |
key | Key to record the object with |
classname | The type name of the object being recorded |
isOwner | If kTRUE , the store takes ownership of the object, otherwise it doesn't |
Definition at line 234 of file TStore.cxx.
Record an object into the store in a typeless way.
This function can be used in the same manner as TStore::record<...>(...), but instead of providing a type, one gives it a type name and a typeless pointer.
Note that only types that have a proper ROOT dictionary can be used. Unlike C++, which allows one to insert any type of object into TStore.
Also note that this function doesn't take ownership of the recorded object. In Python all the objects created by the interpreter are managed by the interpreter. So this code is not supposed to delete them, otherwise all hell breaks loose.
obj | Pointer to the object to be put into the store |
key | Key of the object in the store |
type | The type name of the object we are inserting |
Definition at line 104 of file TPyStore.cxx.
|
protectedinherited |
|
privateinherited |
Internal implementation of the templated record method.
|
inherited |
|
inherited |
|
inherited |
Retrieve either a constant or non-constant object from the store.
|
inherited |
Retrieve a non-constant object from the store.
|
inherited |
Set this as the active transient store in the application.
Definition at line 43 of file TStore.cxx.
xAOD::TStore::TStore |
Inherit the constructor(s) of xAOD::TStore
.
Definition at line 51 of file TStore.cxx.
|
delete |
Inherit the constructor(s) of xAOD::TStore
.
|
protectedinherited |
|
protectedinherited |