Belle II Software development
|
Singleton class to cache database objects. More...
#include <DBStore.h>
Public Member Functions | |
~DBStore () | |
Destructor. | |
DBStoreEntry * | getEntry (DBStoreEntry::EPayloadType payloadType, const std::string &name, const TClass *objClass, bool array, bool required=true) |
Returns the entry with the requested name in the DBStore. | |
DBStoreEntry * | getEntry (const std::string &name, const TClass *objClass, bool array, bool required=true) |
Returns the entry with the requested name in the DBStore. | |
void | update () |
Updates all objects that are outside their interval of validity. | |
void | update (const EventMetaData &event) |
Updates all objects that are outside their interval of validity. | |
void | updateEvent () |
Updates all intra-run dependent objects. | |
void | updateEvent (const unsigned int eventNumber) |
Updates all intra-run dependent objects. | |
void | reset (bool keepEntries=false) |
Invalidate all payloads. | |
std::set< std::string > | getAllEntryNames () |
Return the names of all the payloads stored in the database at the time of this function is called. | |
void | addConstantOverride (const std::string &name, TObject *obj, bool oneRun=false) |
Add constant override payload. | |
Static Public Member Functions | |
static DBStore & | Instance () |
Instance of a singleton DBStore. | |
template<class T > | |
static std::string | objectName (const std::string &name) |
Return the database name for an object of the given type and name. | |
template<class T > | |
static std::string | arrayName (const std::string &name) |
Return the database name for an object of the given type and name. | |
Private Member Functions | |
DBStore () | |
Hidden constructor, as it is a singleton. | |
DBStore (const DBStore &) | |
same for copy constructor | |
void | performUpdate (const EventMetaData &event) |
The main code that does an update, factored out so it can be used by both update and update(event). | |
void | performUpdateEvent (const EventMetaData &event) |
The main code that does an updateEvent. | |
Private Attributes | |
std::unordered_map< std::string, DBStoreEntry > | m_dbEntries |
Map names to DBEntry objects. | |
std::set< DBStoreEntry * > | m_intraRunDependencies |
List of intra-run dependent conditions. | |
StoreObjPtr< EventMetaData > | m_storeEvent |
StoreObjPtr for the EventMetaData to get the current experiment and run from the DataStore. | |
std::optional< EventMetaData > | m_manualEvent |
Optional EventMetaData variable. | |
Singleton class to cache database objects.
The DBStore is the owner of the objects retrieved from the database.
|
inlineexplicitprivate |
|
inlinestatic |
|
inline |
Returns the entry with the requested name in the DBStore.
If the DBStore entry does not exist yet it is added to the map.
If the DBStore map already contains an object under the key with a DIFFERENT type than the given type one, an error will be reported.
name | Name under which the object is stored in the database (and in the DBStore). |
objClass | The class of the object. |
array | Whether it is a TClonesArray or not. |
required | If true emit errors if the object cannot be found |
Definition at line 86 of file DBStore.h.
|
inlinestatic |
|
private |
|
private |
|
private |
Optional EventMetaData variable.
This is set by DBStore::Instance().update(event). Provides a similar interface to StoreObjPtr and allows us to check when not initialized/valid easily. Can be moved to a std::optional when/if we move to C++17.
|
private |
StoreObjPtr for the EventMetaData to get the current experiment and run from the DataStore.