![]() |
Belle II Software development
|
Class to hold one entry from the ConditionsDB in the DBStore. More...
#include <DBStoreEntry.h>
Public Types | |
enum | EPayloadType { c_RawFile , c_ROOTFile , c_Object } |
Possible Store entry types. More... | |
Public Member Functions | |
DBStoreEntry (EPayloadType type, const std::string &name, const TClass *objClass, bool isArray, bool isRequired) | |
Construct a new DBStoreEntry. | |
DBStoreEntry (const DBStoreEntry &)=delete | |
Don't copy the entries around. | |
DBStoreEntry & | operator= (const DBStoreEntry &)=delete |
Also don't just assign them to each other. | |
DBStoreEntry (DBStoreEntry &&)=default | |
But we're fine with moving them. | |
~DBStoreEntry () | |
Clean up memory. | |
const std::string & | getName () const |
get the name of the payload | |
const std::string & | getGlobaltag () const |
get the globaltag name (or testing payloads path) from which the payload is picked. | |
unsigned int | getRevision () const |
get the revision of the payload, this is an abitrary number which indicates the conditions version | |
IntervalOfValidity | getIoV () const |
get the validity of the payload | |
const std::string & | getFilename () const |
get the filename for this payload | |
const std::string & | getChecksum () const |
get the checksum of the payload. | |
const TObject * | getObject () const |
get the object for this payload, can be nullptr if the payload is not loaded or not of type c_Object | |
const TFile * | getTFile () const |
get the ROOT TFile pointer for this payload. | |
const TClass * | getClass () const |
get the class of this payload | |
bool | isArray () const |
get whether this payload is an array of objects or a single objects | |
bool | isRequired () const |
check whether this payload is required for operation | |
bool | keepUntilExpired () const |
check whether the payload should be kept until expired | |
bool | isIntraRunDependent () const |
return whether or not the payload might change even during the run | |
const std::vector< unsigned int > | getIntraRunBoundaries () const |
return the boundaries of the intra-run changes of the payload, if any | |
void | registerAccessor (DBAccessorBase *object) |
Register an Accessor object to be notified on changes by calling DBAccessorBase::storeEntryChanged() | |
void | removeAccessor (DBAccessorBase *object) |
Deregister an Accessor object and remove it from the list of registered objects. | |
Static Public Member Functions | |
static DBStoreEntry | fromObject (const std::string &name, const TObject *obj, bool isRequired) |
Construct a new DBStoreEntry with a requested name and an object directly. | |
Private Member Functions | |
void | resetPayload () |
reset the payload to nothing | |
void | updatePayload (unsigned int revision, const IntervalOfValidity &iov, const std::string &filename, const std::string &checksum, const std::string &globaltag, const EventMetaData &event) |
Update the payload information for this entry and if appropriate open the new file and extract the object as needed. | |
void | loadPayload (const EventMetaData &event) |
Actual load the payload from file after all info is set. | |
void | updateObject (const EventMetaData &event) |
update the payload object according to the new event information. | |
void | overrideObject (TObject *obj, const IntervalOfValidity &iov) |
Set an override object in case we want to use a different object then actually provided by the database. | |
TObject * | releaseObject () |
Return the pointer to the current object and release ownership: The caller is responsible to clean up the object. | |
bool | checkType (const TObject *object) const |
Check if a given TObject instance is compatible with the type of this entry. | |
bool | checkType (EPayloadType type, const TClass *objClass, bool array, bool inverse=false) const |
Check if a given TClass is compatible with the type of this entry. | |
void | notifyAccessors (bool onDestruction=false) |
Notify all the registered accessors. | |
void | require () |
Change status of this payload to required. | |
Private Attributes | |
const EPayloadType | m_payloadType |
Type of this payload. | |
const std::string | m_name |
Name of this payload. | |
const TClass *const | m_objClass |
Class of this payload. | |
const bool | m_isArray |
True if this payload is an array of objects. | |
bool | m_isRequired {false} |
True if at least one user marked this payload as required, false if this payload is marked optional. | |
bool | m_keep {false} |
if True this payload should not be updated unless it's really out of date. | |
std::string | m_globaltag {""} |
globaltag name (or testing payloads path) from which this payload is picked. | |
unsigned int | m_revision {0} |
revision of this payload | |
IntervalOfValidity | m_iov {0, 0, 0, 0} |
validity of this payload | |
std::string | m_filename {""} |
filename containing which contains the actual payload data | |
std::string | m_checksum |
checksum of the payload file | |
TFile * | m_tfile {nullptr} |
Pointer to the open ROOT TFile pointer for m_filename. | |
TObject * | m_object {nullptr} |
Pointer to the actual payload object. | |
IntraRunDependency * | m_intraRunDependency {nullptr} |
If the payload has intra run dependency this will point to the whole payload and m_object will just point to the part currently valid. | |
std::unordered_set< DBAccessorBase * > | m_accessors |
Vector of all the accessors registered with this entry. | |
Friends | |
class | DBStore |
Allow only the DBStore class to update the payload contents. | |
class | Database |
Also allow the Database class to return TObject* pointers for now. | |
Class to hold one entry from the ConditionsDB in the DBStore.
This class is what every DBObjPtr and DBArray are pointing to. It owns the TFile pointer for the payload and the payload object itself.
Any update of the Payload goes through here: when the payload changes after a run the updatePayload() will be called with the new revision, iov and filename. This class then opens the File and obtains the payload object.
This class also supports raw file payloads (where we do not even open the file but will just return the filename to interested parties) or ROOTFile payloads (where we make sure the file can be read by ROOT but don't extract anything from it) But at the moment there is no api to use these types.
Definition at line 47 of file DBStoreEntry.h.
enum EPayloadType |
Possible Store entry types.
Enumerator | |
---|---|
c_RawFile | Just a plain old file, we don't look at it just provide the filename. |
c_ROOTFile | Normal ROOT file but no extraction of any specific object. |
c_Object | A ROOT file containing a object with the name of the DBStoreEntry. |
Definition at line 50 of file DBStoreEntry.h.
|
inline |
Construct a new DBStoreEntry.
type | store entry type |
name | name of the payload, ususally the class name of the payload but can be any string identifying the payload in the database |
objClass | TClass* pointer of the payload, used to check that we actually obtained the correct payload from the database |
isArray | if true the object is required to be a TClonesArray containing objClass objects. |
isRequired | if false don't emit errors if the payload cannot be found for any run |
Definition at line 68 of file DBStoreEntry.h.
|
inline |
get the checksum of the payload.
This is a fixed size string calculated from the file contents. If this changes the payload data also changed
Definition at line 104 of file DBStoreEntry.h.
|
inline |
|
inline |
get the filename for this payload
Definition at line 101 of file DBStoreEntry.h.
|
inline |
get the globaltag name (or testing payloads path) from which the payload is picked.
Definition at line 94 of file DBStoreEntry.h.
|
inline |
return the boundaries of the intra-run changes of the payload, if any
Definition at line 121 of file DBStoreEntry.h.
|
inline |
get the validity of the payload
Definition at line 99 of file DBStoreEntry.h.
|
inline |
|
inline |
get the object for this payload, can be nullptr if the payload is not loaded or not of type c_Object
Definition at line 107 of file DBStoreEntry.h.
|
inline |
get the revision of the payload, this is an abitrary number which indicates the conditions version
Definition at line 97 of file DBStoreEntry.h.
|
inline |
get the ROOT TFile pointer for this payload.
Can be nullptr if the payload is not loaded or neither c_ROOTFile or c_Object
Definition at line 109 of file DBStoreEntry.h.
|
inline |
get whether this payload is an array of objects or a single objects
Definition at line 113 of file DBStoreEntry.h.
|
inline |
return whether or not the payload might change even during the run
Definition at line 119 of file DBStoreEntry.h.
|
inline |
|
inline |
check whether the payload should be kept until expired
Definition at line 117 of file DBStoreEntry.h.
|
inline |
Register an Accessor object to be notified on changes by calling DBAccessorBase::storeEntryChanged()
Definition at line 123 of file DBStoreEntry.h.
|
inlineprivate |
Return the pointer to the current object and release ownership: The caller is responsible to clean up the object.
Definition at line 161 of file DBStoreEntry.h.
|
inline |
Deregister an Accessor object and remove it from the list of registered objects.
Definition at line 125 of file DBStoreEntry.h.
|
inlineprivate |
|
friend |
Also allow the Database class to return TObject* pointers for now.
Definition at line 206 of file DBStoreEntry.h.
|
friend |
Allow only the DBStore class to update the payload contents.
Definition at line 204 of file DBStoreEntry.h.
|
private |
Vector of all the accessors registered with this entry.
Definition at line 202 of file DBStoreEntry.h.
|
private |
checksum of the payload file
Definition at line 193 of file DBStoreEntry.h.
|
private |
filename containing which contains the actual payload data
Definition at line 191 of file DBStoreEntry.h.
|
private |
globaltag name (or testing payloads path) from which this payload is picked.
Definition at line 185 of file DBStoreEntry.h.
|
private |
If the payload has intra run dependency this will point to the whole payload and m_object will just point to the part currently valid.
Definition at line 200 of file DBStoreEntry.h.
|
private |
validity of this payload
Definition at line 189 of file DBStoreEntry.h.
|
private |
True if this payload is an array of objects.
Definition at line 177 of file DBStoreEntry.h.
|
private |
True if at least one user marked this payload as required, false if this payload is marked optional.
Definition at line 180 of file DBStoreEntry.h.
|
private |
if True this payload should not be updated unless it's really out of date.
Usually only set for overrides
Definition at line 183 of file DBStoreEntry.h.
|
private |
Name of this payload.
Definition at line 173 of file DBStoreEntry.h.
|
private |
Class of this payload.
Definition at line 175 of file DBStoreEntry.h.
|
private |
Pointer to the actual payload object.
Definition at line 197 of file DBStoreEntry.h.
|
private |
Type of this payload.
Definition at line 171 of file DBStoreEntry.h.
|
private |
revision of this payload
Definition at line 187 of file DBStoreEntry.h.
|
private |
Pointer to the open ROOT TFile pointer for m_filename.
Definition at line 195 of file DBStoreEntry.h.