xAOD::TStore Class Reference

#include <TStore.h>

Inheritance diagram for xAOD::TStore:
xAOD::TPyStore

List of all members.

Public Member Functions

 TStore ()
 Default constructor.
virtual ~TStore ()
 Destructor.
void setActive ()
 Set this as the active transient store in the application.
void print () const
 Print the current contents of the transient store.
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.
template<typename T >
::Bool_t isConst (const std::string &key) const
 Function checking if an object with a given type is constant.
template<typename T >
TReturnCode retrieve (const T *&obj, const std::string &key) const
 Retrieve either a constant or non-constant object from the store.
template<typename T >
TReturnCode retrieve (T *&obj, const std::string &key) const
 Retrieve a non-constant object from the store.
template<typename T >
TReturnCode record (T *obj, const std::string &key)
 Add an object to the store.
template<typename T >
TReturnCode record (std::unique_ptr< T > obj, const std::string &key)
 Add an object othe store, explicitly taking ownership of it.
TReturnCode remove (const std::string &key)
 Remove an object from the store by name.
TReturnCode remove (void *ptr)
 Remove an object from the store by pointer.
void clear ()
 Clear the store of all of its contents.

Protected Types

typedef std::map< std::string,
THolder * > 
Objects_t
 Type of the internal container storing all the objects.
typedef std::map< uint32_t,
std::string > 
HashedKeys_t
 Type of the internal storage for the hashed keys of the object names.

Protected Member Functions

::Bool_t contains (const std::string &key, const std::type_info &ti) const
 Non-templated function implementing the containment check.
::Bool_t isConst (const std::string &key, const std::type_info &ti) const
 Non-templated function implementing the const-ness check.
void * getObject (const std::string &key, const std::type_info &ti) const
 Function retrieving a non-const object in a non-template way.
const void * getConstObject (const std::string &key, const std::type_info &ti) const
 Function retrieving a const object in a non-template way.
TReturnCode record (void *obj, const std::string &key, const std::string &classname,::Bool_t isOwner=kTRUE)
 Function recording an object that has a dictionary available.
TReturnCode record (void *obj, const std::string &key, const std::type_info &ti)
 Function recording an object that has no dictionary.
template<class T >
TReturnCode record (ConstDataVector< T > *obj, const std::string &key, const std::type_info &ti)
 Function doing the first step of recording a ConstDataVector object.
TReturnCode record (THolder *hldr, const std::string &key)
 Function doing the second step of recording a ConstDataVector object.
Functions mostly used by TEvent in the TVirtualEvent functions



::Bool_t contains (uint32_t hash) const
 Check if an object with a given hash is managed by the store.
::Bool_t contains (const void *ptr) const
 Check if an object with a given pointer is managed by the store.
const std::string & getName (uint32_t hash) const
 Get the name corresponding to a hashed key.
const std::string & getName (const void *ptr) const
 Get the name of a managed object.

Protected Attributes

Objects_t m_objects
 The object storage.
HashedKeys_t m_keys
 The key map.

Friends

class TEvent
 Make TEvent a friend of this class.

Detailed Description

A relatively simple transient store for objects created in analysis

This is a very simple transient store for objects that are created during analysis, but don't have to be written to the output file(s). To make it easier for the analysis tools to communicate with each other similar to how they would do it in Athena (with StoreGateSvc), they can use this class.

The usage of this class is highly optional in analysis, it should only be used if really necessary. (Passing around objects in analysis code directly is usually a better approach than using a store in my mind...)

Author:
Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
Revision
663791
Date
2015-04-29 15:08:06 +0200 (Wed, 29 Apr 2015)

Member Function Documentation

Bool_t xAOD::TStore::contains ( const void *  ptr  )  const [protected]

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.

Parameters:
ptr Pointer to the object that may or may not be in the store
Returns:
kTRUE if the object is managed by the store, or kFALSE if it isn't
Bool_t xAOD::TStore::contains ( uint32_t  hash  )  const [protected]

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.

Parameters:
hash The hashed key of the object that we are looking for
Returns:
kTRUE if the object is managed by the store, or kFALSE if it is not
const std::string & xAOD::TStore::getName ( const void *  ptr  )  const [protected]

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.

Parameters:
ptr Pointer to the object that we want to know the name of
Returns:
The name with which this object was recorded into the store. Or an empty string of the object is not known to the store.
const std::string & xAOD::TStore::getName ( uint32_t  hash  )  const [protected]

Get the name corresponding to a hashed key.

This is a fairly fast function. Used by ElementLinks that point to objects in this store.

Parameters:
hash The hashed key for which we want to find the string key
Returns:
The name corresponding to this hashed key if the hashed key is known, or an empty string if it isn't.
void xAOD::TStore::print (  )  const

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().

TReturnCode xAOD::TStore::record ( void *  obj,
const std::string &  key,
const std::string &  classname,
::Bool_t  isOwner = kTRUE 
) [protected]

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.

Parameters:
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
Returns:
The usual xAOD::TReturnCode types

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Apr 2017 for RootCore Packages by  doxygen 1.6.1