Belle II Software light-2406-ragdoll
|
Base class for DBObjPtr and DBArray for easier common treatment. More...
#include <DBAccessorBase.h>
Public Member Functions | |
DBAccessorBase (const std::string &name, const TClass *objClass, bool isArray, bool isRequired) | |
Constructor to access an object in the DBStore. | |
DBAccessorBase (DBStoreEntry::EPayloadType type, const std::string &name, bool isRequired) | |
Constructor to access an object in the DBStore which is not a ROOT Object. | |
virtual | ~DBAccessorBase () |
Destructor. | |
const std::string & | getName () const |
Return name under which the object is saved in the DBStore. | |
bool | isValid () const |
Check whether a valid object was obtained from the database. | |
operator bool () const | |
Imitate pointer functionality. | |
virtual bool | operator== (const DBAccessorBase &other) const |
Check if two store accessors point to the same object/array. | |
virtual bool | operator!= (const DBAccessorBase &other) const |
Check if two store accessors point to a different object/array. | |
bool | hasChanged () |
Check whether the object has changed since the last call to hasChanged of the accessor). | |
void | addCallback (std::function< void(const std::string &)> callback, bool onDestruction=false) |
Add a callback method. | |
void | addCallback (std::function< void()> callback, bool onDestruction=false) |
Add a callback method. | |
template<class T > | |
void | addCallback (T *object, void(T::*callback)()) |
Add a callback method of an object. | |
const std::string & | getGlobaltag () const |
Return the globaltag name (or testing payloads path) this object is loaded from. | |
unsigned int | getRevision () const |
Return current revision of the object. | |
IntervalOfValidity | getIoV () const |
Return current IoV of the object. | |
const std::string & | getChecksum () const |
Get current checksum. | |
const std::string & | getFilename () const |
Get the filename this object is loaded from. | |
bool | isIntraRunDependent () const |
Check wether this conditions object has some intra-run dependencies. | |
const std::vector< unsigned int > | getIntraRunBoundaries () const |
Get the intra-run boundaries, if any. | |
bool | isRequired () const |
Check whether this conditions object is required (at least one user declared it as required) | |
Protected Member Functions | |
template<class T = TObject> | |
const T * | getObject () const |
Return a pointer to the Object already cast to the correct type. | |
bool | ensureAttached () const |
Make sure we are attached to the the DBStore. | |
void | storeEntryChanged (bool destructed) |
Callback function which gets called by the DBStoreEntry object if it changes. | |
Protected Attributes | |
const DBStoreEntry::EPayloadType | m_type |
Type of the payload. | |
const std::string | m_name |
Name of the payload in the database. | |
const TClass * | m_objClass |
Class of the payload if type is c_Object. | |
const bool | m_isArray |
True if the payload is an array of objects. | |
const bool | m_isRequired |
True if the payload is required, otherwise no errors will be raised if it cannot be found. | |
DBStoreEntry * | m_entry |
Pointer to the entry in the DBStore. | |
bool | m_changed {false} |
Internal flag whether the object has changed since we last checked. | |
std::vector< std::pair< std::function< void(const std::string &)>, bool > > | m_callbacks |
List of all registered callback functions. | |
Friends | |
class | DBStoreEntry |
Allow the DBStoreEntry to call the callback notifier. | |
Base class for DBObjPtr and DBArray for easier common treatment.
Definition at line 26 of file DBAccessorBase.h.
|
inline |
Constructor to access an object in the DBStore.
name | Name under which the object is stored in the database (and DBStore). |
objClass | The type of the object. |
isArray | Flag that indicates whether this is a single object or a TClonesArray. |
isRequired | If true emit errors if the object cannot be found in the Database |
Definition at line 36 of file DBAccessorBase.h.
|
inline |
Constructor to access an object in the DBStore which is not a ROOT Object.
type | should be one of c_RootFile or c_RawFile. |
name | Name under which the object is stored in the database (and DBStore). |
isRequired | If true emit errors if the object cannot be found in the Database |
Definition at line 49 of file DBAccessorBase.h.
|
inlinevirtual |
Destructor.
Virtual because this is a base class.
Definition at line 60 of file DBAccessorBase.h.
|
inline |
Add a callback method.
The given method will be called whenever there is a new database entry for this DBAccessor.
callback | function pointer to a callback function |
onDestruction | if true the callback will not be called for each change but only when the Database entry is deleted and can be used to remove dangling pointers to the entry. |
Definition at line 118 of file DBAccessorBase.h.
|
inline |
Add a callback method.
The given method will be called whenever there is a new database entry for this DBAccessor. The one parameter is the name of the DB entry which changed (in case the same callback method is to be used for multiple payloads.
callback | function pointer to a callback function |
onDestruction | if true the callback will not be called for each change but only when the Database entry is deleted and can be used to remove dangling pointers to the entry. |
Definition at line 105 of file DBAccessorBase.h.
|
inline |
Add a callback method of an object.
The given method will be called whenever there is a new database entry for this DBAccessor.
object | The object with the callback method. |
callback | The callback method. |
Definition at line 130 of file DBAccessorBase.h.
|
inlineprotected |
Make sure we are attached to the the DBStore.
If not try to reconnect
Definition at line 171 of file DBAccessorBase.h.
|
inline |
Get current checksum.
Definition at line 145 of file DBAccessorBase.h.
|
inline |
Get the filename this object is loaded from.
Definition at line 148 of file DBAccessorBase.h.
|
inline |
Return the globaltag name (or testing payloads path) this object is loaded from.
Definition at line 136 of file DBAccessorBase.h.
|
inline |
Get the intra-run boundaries, if any.
If the intra-run dependency is by event number, the event numbers used as boundaries are returned.
Definition at line 157 of file DBAccessorBase.h.
|
inline |
Return current IoV of the object.
Definition at line 142 of file DBAccessorBase.h.
|
inline |
Return name under which the object is saved in the DBStore.
Definition at line 66 of file DBAccessorBase.h.
|
inlineprotected |
Return a pointer to the Object already cast to the correct type.
Definition at line 164 of file DBAccessorBase.h.
|
inline |
Return current revision of the object.
Definition at line 139 of file DBAccessorBase.h.
|
inline |
Check whether the object has changed since the last call to hasChanged of the accessor).
Definition at line 89 of file DBAccessorBase.h.
|
inline |
Check wether this conditions object has some intra-run dependencies.
Definition at line 151 of file DBAccessorBase.h.
|
inline |
Check whether this conditions object is required (at least one user declared it as required)
Definition at line 160 of file DBAccessorBase.h.
|
inline |
Check whether a valid object was obtained from the database.
Definition at line 72 of file DBAccessorBase.h.
|
inline |
Imitate pointer functionality.
Definition at line 74 of file DBAccessorBase.h.
|
inlinevirtual |
Check if two store accessors point to a different object/array.
Definition at line 83 of file DBAccessorBase.h.
|
inlinevirtual |
Check if two store accessors point to the same object/array.
Definition at line 77 of file DBAccessorBase.h.
|
inlineprotected |
Callback function which gets called by the DBStoreEntry object if it changes.
Definition at line 184 of file DBAccessorBase.h.
|
friend |
Allow the DBStoreEntry to call the callback notifier.
Definition at line 215 of file DBAccessorBase.h.
|
protected |
List of all registered callback functions.
Definition at line 213 of file DBAccessorBase.h.
|
mutableprotected |
Internal flag whether the object has changed since we last checked.
Definition at line 211 of file DBAccessorBase.h.
|
mutableprotected |
Pointer to the entry in the DBStore.
Definition at line 209 of file DBAccessorBase.h.
|
protected |
True if the payload is an array of objects.
Definition at line 205 of file DBAccessorBase.h.
|
protected |
True if the payload is required, otherwise no errors will be raised if it cannot be found.
Definition at line 207 of file DBAccessorBase.h.
|
protected |
Name of the payload in the database.
Definition at line 201 of file DBAccessorBase.h.
|
protected |
Class of the payload if type is c_Object.
Definition at line 203 of file DBAccessorBase.h.
|
protected |
Type of the payload.
Definition at line 199 of file DBAccessorBase.h.