#include <TPyStore.h>
Public Member Functions | |
TPyStore () | |
Default constructor. | |
::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. | |
::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. | |
TReturnCode | record (void *obj, const std::string &key, const std::string &type) |
Record an object into the store in a typeless way. | |
void | dump () const |
Print the contents of the store using a Python friendly function. |
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.
Bool_t xAOD::TPyStore::contains | ( | const std::string & | key, | |
const std::string & | type | |||
) | const |
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 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.
Bool_t xAOD::TPyStore::isConst | ( | const std::string & | key, | |
const std::string & | type | |||
) | const |
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 TReturnCode xAOD::TPyStore::record | ( | void * | obj, | |
const std::string & | key, | |||
const std::string & | type | |||
) |
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 |