Belle II Software  release-08-01-10
StoreEntry Struct Reference

Wraps a stored array/object, stored under unique (name, durability) key. More...

#include <StoreEntry.h>

Collaboration diagram for StoreEntry:

Public Member Functions

 StoreEntry (bool isArray, TClass *cl, std::string name, bool dontWriteOut)
 useful constructor, creates 'object', but leaves 'ptr' NULL.
 
void invalidate ()
 invalidate entry for next event. More...
 
void resetForGetEntry ()
 Reset stored object to defaults, or nullptr. More...
 
void recoverFromNullObject ()
 Recreate object if null. More...
 
void recreate ()
 Reset stored object to defaults, set ptr to new object. More...
 
TClonesArray * getPtrAsArray () const
 Return ptr cast to TClonesArray. More...
 

Public Attributes

bool isArray
 Flag that indicates whether the object is a TClonesArray.
 
bool dontWriteOut
 Flag that indicates whether the object should be written to the output by default.
 
TClass * objClass
 class of object. More...
 
TObject * object
 The pointer to the actual object. More...
 
TObject * ptr
 The pointer to the returned object, either equal to 'object' or null, depending on wether the object was created in the current event.
 
std::string name
 Name of the entry. More...
 

Detailed Description

Wraps a stored array/object, stored under unique (name, durability) key.

See DataStore::m_storeEntryMap.

Definition at line 22 of file StoreEntry.h.

Member Function Documentation

◆ getPtrAsArray()

TClonesArray * getPtrAsArray ( ) const

Return ptr cast to TClonesArray.

If this is not an array, return null.

Definition at line 83 of file StoreEntry.cc.

84 {
85  if (!isArray)
86  return nullptr;
87  return static_cast<TClonesArray*>(ptr);
88 }
TObject * ptr
The pointer to the returned object, either equal to 'object' or null, depending on wether the object ...
Definition: StoreEntry.h:51
bool isArray
Flag that indicates whether the object is a TClonesArray.
Definition: StoreEntry.h:39

◆ invalidate()

void invalidate ( )

invalidate entry for next event.

(ptr will be null afterwards, memory may be reused.)

Definition at line 77 of file StoreEntry.cc.

◆ recoverFromNullObject()

void recoverFromNullObject ( )

Recreate object if null.

Used to recover from temporary invalid states after reading empty branches.

Definition at line 30 of file StoreEntry.cc.

◆ recreate()

void recreate ( )

Reset stored object to defaults, set ptr to new object.

More or less equivalent to delete object; object = new X;, but optimized.

Definition at line 68 of file StoreEntry.cc.

◆ resetForGetEntry()

void resetForGetEntry ( )

Reset stored object to defaults, or nullptr.

Only useful for input modules (before GetEntry()).

Definition at line 55 of file StoreEntry.cc.

Member Data Documentation

◆ name

std::string name

Name of the entry.

Equal to the key in the map.

Definition at line 53 of file StoreEntry.h.

◆ objClass

TClass* objClass

class of object.

If isArray==true, class of array objects

Definition at line 41 of file StoreEntry.h.

◆ object

TObject* object

The pointer to the actual object.

Associated memory may exceed object durability, and is kept until the object is replaced. In normal use, this should never be null. Temporary exceptions are allowed for input modules.

Definition at line 48 of file StoreEntry.h.


The documentation for this struct was generated from the following files: