Belle II Software light-2406-ragdoll
|
In the store you can park objects that have to be accessed by various modules. More...
#include <DataStore.h>
Classes | |
class | SwitchableDataStoreContents |
Encapsulates DataStoreContents, but allows transparently switching between different versions ('DataStore IDs'). More... | |
Public Types | |
enum | EDurability { c_Event , c_Persistent } |
Durability types. More... | |
enum | EStoreFlags { c_WriteOut = 0 , c_DontWriteOut = 1 , c_ErrorIfAlreadyRegistered = 2 } |
Flags describing behaviours of objects etc. More... | |
enum | ESearchSide { c_FromSide , c_ToSide , c_BothSides } |
Which side of relations should be returned? More... | |
typedef Belle2::StoreEntry | StoreEntry |
Wraps a stored array/object, stored under unique (name, durability) key. | |
typedef std::map< std::string, StoreEntry > | StoreEntryMap |
Map for StoreEntries. | |
typedef StoreEntryMap::iterator | StoreEntryIter |
Iterator for a StoreEntry map. | |
typedef StoreEntryMap::const_iterator | StoreEntryConstIter |
const_iterator for a StoreEntry map. | |
typedef std::array< StoreEntryMap, c_NDurabilityTypes > | DataStoreContents |
StoreEntry maps for each durability. | |
Public Member Functions | |
bool | registerEntry (const std::string &name, EDurability durability, TClass *objClass, bool array, EStoreFlags storeFlags) |
Register an entry in the DataStore map. | |
bool | registerRelation (const StoreAccessorBase &fromArray, const StoreAccessorBase &toArray, EDurability durability, EStoreFlags storeFlags, const std::string &namedRelation) |
Register a relation in the DataStore map. | |
bool | hasRelation (const StoreAccessorBase &fromArray, const StoreAccessorBase &toArray, EDurability durability, const std::string &namedRelation) |
Check for the existence of a relation in the DataStore map. | |
bool | requireInput (const StoreAccessorBase &accessor) |
Produce ERROR message if no entry of the given type is registered in the DataStore. | |
bool | requireRelation (const StoreAccessorBase &fromArray, const StoreAccessorBase &toArray, EDurability durability, std::string const &namedRelation) |
Produce ERROR message if no relation of given durability exists between fromArray and toArray (in that direction). | |
bool | optionalInput (const StoreAccessorBase &accessor) |
Register the given object/array as an optional input. | |
bool | optionalRelation (const StoreAccessorBase &fromArray, const StoreAccessorBase &toArray, EDurability durability, std::string const &namedRelation) |
Register the given relation as an optional input. | |
StoreEntry * | getEntry (const StoreAccessorBase &accessor) |
Check whether an entry with the correct type is registered in the DataStore map and return it. | |
TObject ** | getObject (const StoreAccessorBase &accessor) |
Get a pointer to a pointer of an object in the DataStore. | |
bool | createObject (TObject *object, bool replace, const StoreAccessorBase &accessor) |
Create a new object/array in the DataStore or add an existing one. | |
void | replaceData (const StoreAccessorBase &from, const StoreAccessorBase &to) |
For two StoreAccessors of same type, move all data in 'from' into 'to', discarding previous contents of 'to' and leaving 'from' empty. | |
StoreEntryMap & | getStoreEntryMap (EDurability durability) |
Get a reference to the object/array map. | |
void | addRelation (const TObject *fromObject, StoreEntry *&fromEntry, int &fromIndex, const TObject *toObject, StoreEntry *&toEntry, int &toIndex, float weight, const std::string &namedRelation) |
Add a relation from an object in a store array to another object in a store array. | |
RelationVectorBase | getRelationsWith (ESearchSide searchSide, const TObject *object, StoreEntry *&entry, int &index, const TClass *withClass, const std::string &withName, const std::string &namedRelation) |
Get the relations between an object and other objects in a store array. | |
Belle2::RelationEntry | getRelationWith (ESearchSide searchSide, const TObject *object, StoreEntry *&entry, int &index, const TClass *withClass, const std::string &withName, const std::string &namedRelation) |
Get the first relation between an object and another object in a store array. | |
bool | findStoreEntry (const TObject *object, StoreEntry *&entry, int &index) |
Find an object in an array in the data store. | |
std::vector< std::string > | getListOfRelatedArrays (const StoreAccessorBase &array) const |
Returns a list of names of arrays which have registered relations that point to or from 'array'. | |
std::vector< std::string > | getListOfArrays (const TClass *arrayClass, EDurability durability) const |
Returns a list of names of arrays which are of type (or inherit from) arrayClass. | |
std::vector< std::string > | getListOfObjects (const TClass *objClass, EDurability durability) const |
Returns a list of names of StoreObjPtr-objects whose class is (or inherits from) objClass. | |
std::vector< std::string > | getListOfRelations (EDurability durability) const |
Returns a list of names of StoreObjPtr-objects whose class is (or inherits from) RelationContainer. | |
std::vector< std::string > | getSortedListOfDataStore (EDurability durability) const |
Returns a (sorted) list of all the content of the DataStore (Objs-Arrays-Relations). | |
void | setInitializeActive (bool active) |
Setter for m_initializeActive. | |
bool | getInitializeActive () const |
Are we currently initializing modules? | |
void | invalidateData (EDurability durability) |
Clears all registered StoreEntry objects of a specified durability, invalidating all objects. | |
void | reset (EDurability durability) |
Frees memory occupied by data store items and removes all objects from the map. | |
void | reset () |
Clears contents of the datastore (all durabilities) | |
DependencyMap & | getDependencyMap () |
Return map of depedencies between modules. | |
void | createNewDataStoreID (const std::string &id) |
creates new datastore with given id, copying the registered objects/arrays from the current one. | |
void | createEmptyDataStoreID (const std::string &id) |
creates empty datastore with given id. | |
std::string | currentID () const |
returns ID of current DataStore. | |
void | switchID (const std::string &id) |
switch to DataStore with given ID. | |
void | copyEntriesTo (const std::string &id, const std::vector< std::string > &entrylist_event={}, bool mergeEntries=false) |
copy entries (not contents) of current DataStore to the DataStore with given ID. | |
void | copyContentsTo (const std::string &id, const std::vector< std::string > &entrylist_event={}) |
copy contents (actual array / object contents) of current DataStore to the DataStore with given ID. | |
void | mergeContentsTo (const std::string &id, const std::vector< std::string > &entrylist_event={}) |
merge contents (actual array / object contents) of current DataStore to the DataStore with given ID. | |
Static Public Member Functions | |
static DataStore & | Instance () |
Instance of singleton Store. | |
static TClass * | getTClassFromDefaultObjectName (const std::string &objectName) |
Tries to deduce the TClass from a default object name, which is generally the name of the C++ class. | |
static TClass * | getTClassFromDefaultArrayName (const std::string &arrayName) |
Tries to deduce the TClass from a default array name, which is generally the name of the C++ class with an appended 's'. | |
static std::string | defaultObjectName (const std::string &classname) |
Return the default storage name for given class name. | |
static std::string | defaultObjectName (const TClass *t) |
Return the default storage name for an object of the given TClass. | |
template<class T > | |
static std::string | defaultObjectName () |
Return the default storage name for an object of the given type. | |
static std::string | objectName (const TClass *t, const std::string &name) |
Return the storage name for an object of the given TClass and name. | |
template<class T > | |
static std::string | objectName (const std::string &name) |
Return the storage name for an object of the given type and name. | |
static std::string | defaultArrayName (const std::string &classname) |
Return the default storage name for an given class name. | |
static std::string | defaultArrayName (const TClass *t) |
Return the default storage name for an array of the given TClass. | |
template<class T > | |
static std::string | defaultArrayName () |
Return the default storage name for an array of the given type. | |
static std::string | arrayName (const TClass *t, const std::string &name) |
Return the storage name for an object of the given TClass and name. | |
template<class T > | |
static std::string | arrayName (const std::string &name) |
Return the storage name for an object of the given type and name. | |
template<class FROM , class TO > | |
static std::string | defaultRelationName () |
Return the default storage name for a relation between the given types. | |
static std::string | relationName (const std::string &fromName, const std::string &toName, std::string const &namedRelation="") |
Return storage name for a relation between two arrays of the given names. | |
static void | addRelationFromTo (const TObject *fromObject, const TObject *toObject, float weight=1.0, const std::string &namedRelation="") |
Add a relation from an object in a store array to another object in a store array. | |
template<class T > | |
static RelationVector< T > | getRelationsWithObj (const TObject *object, const std::string &name="", const std::string &namedRelation="") |
Get the relations between an object and other objects in a store array. | |
template<class T > | |
static T * | getRelated (const TObject *object, const std::string &name="", const std::string &namedRelation="") |
Get the object to or from which another object has a relation. | |
Static Public Attributes | |
static const int | c_NDurabilityTypes = 2 |
Number of Durability Types. | |
static bool | s_DoCleanup = false |
Global flag to to decide if we can do normal cleanup. | |
Private Member Functions | |
DataStore () | |
Hidden constructor, as it is a singleton. | |
DataStore (const DataStore &)=delete | |
no copy constructor | |
DataStore & | operator= (const DataStore &)=delete |
no assignment operator | |
~DataStore () | |
Destructor. | |
bool | checkType (const StoreEntry &entry, const StoreAccessorBase &accessor) const |
Check whether the given entry and the requested class match. | |
const std::vector< std::string > & | getArrayNames (const std::string &arrayName, const TClass *arrayClass, EDurability durability=c_Event) const |
Returns a vector with the names of store arrays matching the given name and class. | |
Static Private Member Functions | |
static void | updateRelationsObjectCache (StoreEntry &entry) |
For an array containing RelationsObjects, update index and entry cache for entire contents. | |
Private Attributes | |
SwitchableDataStoreContents | m_storeEntryMap |
Maps (name, durability) key to StoreEntry objects. | |
bool | m_initializeActive |
True if modules are currently being initialized. | |
const std::regex | m_regexNamedRelationCheck = std::regex("^[a-zA-Z]*$") |
Regular expression to check that no special characters and no white spaces are in the string given for namedRelations. | |
DependencyMap * | m_dependencyMap |
Collect information about the dependencies between modules. | |
In the store you can park objects that have to be accessed by various modules.
Normal users should access the store via StoreAccessorBase-derived classes like StoreObjPtr or StoreArray.
Nomenclature:
Definition at line 51 of file DataStore.h.
typedef std::array<StoreEntryMap, c_NDurabilityTypes> DataStoreContents |
StoreEntry maps for each durability.
Definition at line 90 of file DataStore.h.
typedef Belle2::StoreEntry StoreEntry |
Wraps a stored array/object, stored under unique (name, durability) key.
Definition at line 84 of file DataStore.h.
typedef StoreEntryMap::const_iterator StoreEntryConstIter |
const_iterator for a StoreEntry map.
Definition at line 89 of file DataStore.h.
typedef StoreEntryMap::iterator StoreEntryIter |
Iterator for a StoreEntry map.
Definition at line 88 of file DataStore.h.
typedef std::map<std::string, StoreEntry> StoreEntryMap |
Map for StoreEntries.
Definition at line 87 of file DataStore.h.
enum EDurability |
Durability types.
Defines how long an object should be valid.
Definition at line 58 of file DataStore.h.
enum ESearchSide |
Which side of relations should be returned?
Enumerator | |
---|---|
c_FromSide | Return relations/objects pointed from (to a given object). |
c_ToSide | Return relations/objects pointed to (from a given object). |
c_BothSides | Combination of c_FromSide and c_ToSide. |
Definition at line 76 of file DataStore.h.
enum EStoreFlags |
Flags describing behaviours of objects etc.
Bitwise operators (|, &, etc.) are provided via ADD_BITMASK_OPERATORS.
Definition at line 69 of file DataStore.h.
|
explicitprivate |
Hidden constructor, as it is a singleton.
Definition at line 61 of file DataStore.cc.
|
private |
Destructor.
Definition at line 65 of file DataStore.cc.
void addRelation | ( | const TObject * | fromObject, |
StoreEntry *& | fromEntry, | ||
int & | fromIndex, | ||
const TObject * | toObject, | ||
StoreEntry *& | toEntry, | ||
int & | toIndex, | ||
float | weight, | ||
const std::string & | namedRelation | ||
) |
Add a relation from an object in a store array to another object in a store array.
fromObject | Pointer to the object from which the relation points. |
fromEntry | Data store entry that contains the fromObject. Used for caching. Will be set if NULL. |
fromIndex | Index in TClonesArray that contains the fromObject. Used for caching. Will be set if < 0. |
toObject | Pointer to the object to which the relation points. |
toEntry | Data store entry that contains the toObject. Used for caching. Will be set if NULL. |
toIndex | Index in TClonesArray that contains the toObject. Used for caching. Will be set if < 0. |
weight | Weight of the relation. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 492 of file DataStore.cc.
|
inlinestatic |
Add a relation from an object in a store array to another object in a store array.
fromObject | Pointer to the object from which the relation points. |
toObject | Pointer to the object to which the relation points. |
weight | Weight of the relation. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 387 of file DataStore.h.
|
inlinestatic |
Return the storage name for an object of the given type and name.
Definition at line 167 of file DataStore.h.
|
static |
Return the storage name for an object of the given TClass and name.
Definition at line 164 of file DataStore.cc.
|
private |
Check whether the given entry and the requested class match.
Name and durability are not checked.
entry | The existing DataStore entry. |
accessor | Encapsulates name, durability, and type |
Definition at line 170 of file DataStore.cc.
void copyContentsTo | ( | const std::string & | id, |
const std::vector< std::string > & | entrylist_event = {} |
||
) |
copy contents (actual array / object contents) of current DataStore to the DataStore with given ID.
Definition at line 810 of file DataStore.cc.
void copyEntriesTo | ( | const std::string & | id, |
const std::vector< std::string > & | entrylist_event = {} , |
||
bool | mergeEntries = false |
||
) |
copy entries (not contents) of current DataStore to the DataStore with given ID.
Definition at line 805 of file DataStore.cc.
void createEmptyDataStoreID | ( | const std::string & | id | ) |
creates empty datastore with given id.
Definition at line 784 of file DataStore.cc.
void createNewDataStoreID | ( | const std::string & | id | ) |
creates new datastore with given id, copying the registered objects/arrays from the current one.
Definition at line 779 of file DataStore.cc.
bool createObject | ( | TObject * | object, |
bool | replace, | ||
const StoreAccessorBase & | accessor | ||
) |
Create a new object/array in the DataStore or add an existing one.
A matching map entry must already exist. Otherwise an error will be generated.
object | Pointer to the object that should be stored. If 0, a new default object is created. |
replace | If an object already exists, it will be replaced if this is true. If false, an error will be printed. |
accessor | Encapsulates name, durability, and type |
Definition at line 316 of file DataStore.cc.
std::string currentID | ( | ) | const |
returns ID of current DataStore.
Definition at line 789 of file DataStore.cc.
|
inlinestatic |
Return the default storage name for an array of the given type.
Definition at line 157 of file DataStore.h.
|
inlinestatic |
Return the default storage name for an given class name.
Definition at line 143 of file DataStore.h.
|
static |
Return the default storage name for an array of the given TClass.
Definition at line 157 of file DataStore.cc.
|
inlinestatic |
Return the default storage name for an object of the given type.
Definition at line 127 of file DataStore.h.
|
static |
Return the default storage name for given class name.
Definition at line 128 of file DataStore.cc.
|
static |
Return the default storage name for an object of the given TClass.
Definition at line 143 of file DataStore.cc.
|
inlinestatic |
Return the default storage name for a relation between the given types.
Definition at line 173 of file DataStore.h.
bool findStoreEntry | ( | const TObject * | object, |
DataStore::StoreEntry *& | entry, | ||
int & | index | ||
) |
Find an object in an array in the data store.
entry/index are used to return the found array and index, should be set to NULL and -1, or some cached values (will be checked).
Given non-NULL entry and index>=0, this function returns immediately if the object is found at the given position.
object | Pointer to the object. |
entry | The DataStore entry that contains the object. |
index | The index of the object in the array. |
Definition at line 398 of file DataStore.cc.
|
private |
Returns a vector with the names of store arrays matching the given name and class.
Note that the returned reference is only valid until the next call.
arrayName | A given array name, the special string "ALL" for all arrays deriving from the given class, or an empty string for the default array name. |
arrayClass | The class of the array(s). |
durability | Decide with which durability map you want to perform the requested action. |
Definition at line 465 of file DataStore.cc.
|
inline |
DataStore::StoreEntry * getEntry | ( | const StoreAccessorBase & | accessor | ) |
Check whether an entry with the correct type is registered in the DataStore map and return it.
If the map of requested durability already contains an object under the key name with a DIFFERENT type than the given type one, an error will be reported.
accessor | Encapsulates name, durability, and type |
Definition at line 294 of file DataStore.cc.
|
inline |
std::vector< std::string > getListOfArrays | ( | const TClass * | arrayClass, |
EDurability | durability | ||
) | const |
Returns a list of names of arrays which are of type (or inherit from) arrayClass.
Definition at line 666 of file DataStore.cc.
std::vector< std::string > getListOfObjects | ( | const TClass * | objClass, |
EDurability | durability | ||
) | const |
Returns a list of names of StoreObjPtr-objects whose class is (or inherits from) objClass.
(this does NOT include the internal RelationContainer objects.)
Definition at line 671 of file DataStore.cc.
std::vector< std::string > getListOfRelatedArrays | ( | const StoreAccessorBase & | array | ) | const |
Returns a list of names of arrays which have registered relations that point to or from 'array'.
This may be useful for internal purposes when modifying array contents.
Definition at line 640 of file DataStore.cc.
std::vector< std::string > getListOfRelations | ( | EDurability | durability | ) | const |
Returns a list of names of StoreObjPtr-objects whose class is (or inherits from) RelationContainer.
Definition at line 688 of file DataStore.cc.
TObject ** getObject | ( | const StoreAccessorBase & | accessor | ) |
Get a pointer to a pointer of an object in the DataStore.
If the map of requested durability already contains an object under the key name with a DIFFERENT type than the given type one, an error will be reported.
accessor | Encapsulates name, durability, and type |
Definition at line 306 of file DataStore.cc.
|
inlinestatic |
Get the object to or from which another object has a relation.
object | Pointer to the object to or from which the relation points. |
T | The class of objects to or from which the relation points. |
name | The name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 432 of file DataStore.h.
RelationVectorBase getRelationsWith | ( | ESearchSide | searchSide, |
const TObject * | object, | ||
DataStore::StoreEntry *& | entry, | ||
int & | index, | ||
const TClass * | withClass, | ||
const std::string & | withName, | ||
const std::string & | namedRelation | ||
) |
Get the relations between an object and other objects in a store array.
searchSide | Search objects of type withClass on this side of relations (with 'object' on the other side). |
object | Pointer to the object from or to which the relations point. |
entry | Data store entry that contains the object. Used for caching. Will be set if 0. |
index | Index in TClonesArray that contains the object. Used for caching. Will be set if < 0. |
withClass | Class of the objects to or from which the relations point. |
withName | The name of the store array to or from which the relations point. If empty the default store array name for withClass will be used. If the special name "ALL" is given all store arrays containing object of type withClass are considered. |
namedRelation | Additional name for the relation, or "" for the default naming. If withName is "ALL", the namedRelation parameter is ignored and all related objects are returned. |
Definition at line 545 of file DataStore.cc.
|
inlinestatic |
Get the relations between an object and other objects in a store array.
Relations in both directions are returned.
object | Pointer to the object from or to which the relations point. |
T | Class of the objects to or from which the relations point. |
name | The name of the store array to or from which the relations point. If empty the default store array name for withClass will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 412 of file DataStore.h.
RelationEntry getRelationWith | ( | ESearchSide | searchSide, |
const TObject * | object, | ||
DataStore::StoreEntry *& | entry, | ||
int & | index, | ||
const TClass * | withClass, | ||
const std::string & | withName, | ||
const std::string & | namedRelation | ||
) |
Get the first relation between an object and another object in a store array.
searchSide | Search objects of type withClass on this side of relations (with 'object' on the other side). |
object | Pointer to the object from or to which the relation points. |
entry | Data store entry that contains the object. Used for caching. Will be set if 0. |
index | Index in TClonesArray that contains the object. Used for caching. Will be set if < 0. |
withClass | Class of the objects to or from which the relation points. |
withName | The name of the store array to or from which the relation points. If empty the default store array name for withClass will be used. If the special name "ALL" is given all store arrays containing object of type withClass are considered. |
namedRelation | Additional name for the relation, or "" for the default naming. If withName is "ALL", the namedRelation parameter is ignored and all related objects are returned. |
Definition at line 597 of file DataStore.cc.
std::vector< std::string > getSortedListOfDataStore | ( | EDurability | durability | ) | const |
Returns a (sorted) list of all the content of the DataStore (Objs-Arrays-Relations).
Definition at line 703 of file DataStore.cc.
|
inline |
Get a reference to the object/array map.
This is intended to be used for input/output or other framework-internal modules.
Definition at line 325 of file DataStore.h.
|
static |
Tries to deduce the TClass from a default array name, which is generally the name of the C++ class with an appended 's'.
The namespace qualification Belle2:: can be ommitted
Definition at line 116 of file DataStore.cc.
|
static |
Tries to deduce the TClass from a default object name, which is generally the name of the C++ class.
The namespace qualification Belle2:: can be ommitted.
Definition at line 105 of file DataStore.cc.
bool hasRelation | ( | const StoreAccessorBase & | fromArray, |
const StoreAccessorBase & | toArray, | ||
EDurability | durability, | ||
const std::string & | namedRelation | ||
) |
Check for the existence of a relation in the DataStore map.
fromArray | Origin of the relation |
toArray | Target of the relation |
durability | Decide with which durability map you want to perform the requested action. |
namedRelation | Additional name for the relation, or "" for the default naming. |
Definition at line 271 of file DataStore.cc.
|
static |
Instance of singleton Store.
This method is used to access the DataStore directly. It is used internally in the Store accessor classes.
Definition at line 54 of file DataStore.cc.
void invalidateData | ( | EDurability | durability | ) |
Clears all registered StoreEntry objects of a specified durability, invalidating all objects.
Called by the framework once the given durability is over. Users should usually not use this function without a good reason.
Definition at line 715 of file DataStore.cc.
void mergeContentsTo | ( | const std::string & | id, |
const std::vector< std::string > & | entrylist_event = {} |
||
) |
merge contents (actual array / object contents) of current DataStore to the DataStore with given ID.
Definition at line 815 of file DataStore.cc.
|
inlinestatic |
Return the storage name for an object of the given type and name.
Definition at line 137 of file DataStore.h.
|
static |
Return the storage name for an object of the given TClass and name.
Definition at line 151 of file DataStore.cc.
bool optionalInput | ( | const StoreAccessorBase & | accessor | ) |
Register the given object/array as an optional input.
Mainly useful for creating diagrams of module inputs and outputs.
accessor | Encapsulates name, durability, and type |
Definition at line 739 of file DataStore.cc.
bool optionalRelation | ( | const StoreAccessorBase & | fromArray, |
const StoreAccessorBase & | toArray, | ||
EDurability | durability, | ||
std::string const & | namedRelation | ||
) |
Register the given relation as an optional input.
Mainly useful for creating diagrams of module inputs and outputs.
fromArray | Origin of the relation |
toArray | Target of the relation |
durability | Decide with which durability map you want to perform the requested action. |
namedRelation | Additional name for the relation, or "" for the default naming1 |
Definition at line 766 of file DataStore.cc.
bool registerEntry | ( | const std::string & | name, |
EDurability | durability, | ||
TClass * | objClass, | ||
bool | array, | ||
EStoreFlags | storeFlags | ||
) |
Register an entry in the DataStore map.
If the map of requested durability already contains an object under the key name with a DIFFERENT type than the given type, an error will be reported.
Otherwise a new map slot is created. This must be called in the initialization phase. Otherwise an error is returned.
name | Name under which you want to save the object in the DataStore. |
durability | Decide with which durability map you want to perform the requested action. |
objClass | The class of the object. |
array | Whether it is a TClonesArray or not. |
storeFlags | ORed combination of DataStore::EStoreFlags. |
Definition at line 190 of file DataStore.cc.
bool registerRelation | ( | const StoreAccessorBase & | fromArray, |
const StoreAccessorBase & | toArray, | ||
EDurability | durability, | ||
EStoreFlags | storeFlags, | ||
const std::string & | namedRelation | ||
) |
Register a relation in the DataStore map.
This must be called in the initialization phase. Otherwise an error is returned.
fromArray | Origin of the relation |
toArray | Target of the relation |
durability | Decide with which durability map you want to perform the requested action. |
storeFlags | ORed combination of DataStore::EStoreFlags. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 244 of file DataStore.cc.
|
inlinestatic |
Return storage name for a relation between two arrays of the given names.
Definition at line 180 of file DataStore.h.
void replaceData | ( | const StoreAccessorBase & | from, |
const StoreAccessorBase & | to | ||
) |
For two StoreAccessors of same type, move all data in 'from' into 'to', discarding previous contents of 'to' and leaving 'from' empty.
Meta-data like c_DontWriteOut flags or info about associated arrays for RelationContainers is not replaced.
Definition at line 343 of file DataStore.cc.
bool requireInput | ( | const StoreAccessorBase & | accessor | ) |
Produce ERROR message if no entry of the given type is registered in the DataStore.
accessor | Encapsulates name, durability, and type |
Definition at line 722 of file DataStore.cc.
bool requireRelation | ( | const StoreAccessorBase & | fromArray, |
const StoreAccessorBase & | toArray, | ||
EDurability | durability, | ||
std::string const & | namedRelation | ||
) |
Produce ERROR message if no relation of given durability exists between fromArray and toArray (in that direction).
fromArray | Origin of the relation |
toArray | Target of the relation |
durability | Decide with which durability map you want to perform the requested action. |
namedRelation | Additional name for the relation, or "" for the default naming |
Definition at line 749 of file DataStore.cc.
void reset | ( | ) |
Clears contents of the datastore (all durabilities)
Called by the framework. Users should usually not use this function without good reason.
Definition at line 74 of file DataStore.cc.
void reset | ( | EDurability | durability | ) |
Frees memory occupied by data store items and removes all objects from the map.
Afterwards, m_storeEntryMap[durability] is empty. Called by the framework. Users should usually not use this function without good reason.
Definition at line 86 of file DataStore.cc.
void setInitializeActive | ( | bool | active | ) |
Setter for m_initializeActive.
This should only be called by EventProcessor.
Definition at line 94 of file DataStore.cc.
void switchID | ( | const std::string & | id | ) |
switch to DataStore with given ID.
Definition at line 794 of file DataStore.cc.
|
staticprivate |
For an array containing RelationsObjects, update index and entry cache for entire contents.
You must ensure the array actually contains objects inheriting from RelationsObject!
Definition at line 387 of file DataStore.cc.
|
static |
|
private |
Collect information about the dependencies between modules.
Definition at line 637 of file DataStore.h.
|
private |
True if modules are currently being initialized.
Creating new map slots is only allowed in a Module's initialize() function.
Definition at line 628 of file DataStore.h.
|
private |
Regular expression to check that no special characters and no white spaces are in the string given for namedRelations.
Definition at line 634 of file DataStore.h.
|
private |
Maps (name, durability) key to StoreEntry objects.
Definition at line 621 of file DataStore.h.
|
static |
Global flag to to decide if we can do normal cleanup.
If the normal basf2 execution is bypassed, e.g. in tests or separate binaries, we cannot guarantee that exit handlers are called in the correct order. Since this may lead to double deletion of objects through ROOT and misleading error stack traces, we will skip cleanup in these exceptional cases.
Definition at line 100 of file DataStore.h.