9#include <framework/datastore/StoreAccessorBase.h>
10#include <framework/logging/Logger.h>
13#include <TClonesArray.h>
20 std::string str(
isArray() ?
"array" :
"object");
21 str +=
" '" +
getName() +
"' (durability: ";
39 const bool objIsArray = (
object->IsA() == TClonesArray::Class());
40 TClass* objClass = objIsArray ? (
static_cast<TClonesArray*
>(object))->GetClass() :
object->IsA();
42 B2ERROR(
"Cannot assign an object to an array (or vice versa); while assigning to " <<
readableName());
44 B2ERROR(
"Cannot assign() an object of type '" << objClass->GetName() <<
"' to " <<
readableName() <<
" of type '" <<
57 B2ERROR(
"notWrittenOut(): " <<
readableName() <<
" doesn't seem to be registered");
@ c_Persistent
Object is available during entire execution time.
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
static DataStore & Instance()
Instance of singleton Store.
StoreEntry * getEntry(const StoreAccessorBase &accessor)
Check whether an entry with the correct type is registered in the DataStore map and return it.
bool createObject(TObject *object, bool replace, const StoreAccessorBase &accessor)
Create a new object/array in the DataStore or add an existing one.
DataStore::EDurability getDurability() const
Return durability with which the object is saved in the DataStore.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool notWrittenOut() const
Returns true if this object/array should not be saved by output modules.
std::string readableName() const
Convert this acessor into a readable string (for messages).
bool assign(TObject *object, bool replace=false)
Assign 'object' to this accessor.
TClass * getClass() const
The underlying object's type.
bool isArray() const
Is this an accessor for an array?
Abstract base class for different kinds of events.
Wraps a stored array/object, stored under unique (name, durability) key.
bool dontWriteOut
Flag that indicates whether the object should be written to the output by default.