Belle II Software  release-08-01-10
StoreEntry.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <string>
11 
12 class TObject;
13 class TClass;
14 class TClonesArray;
15 
16 namespace Belle2 {
22  struct StoreEntry {
23  StoreEntry() : isArray(false), dontWriteOut(false), objClass(nullptr), object(nullptr), ptr(nullptr), name() {};
24 
26  StoreEntry(bool isArray, TClass* cl, std::string name, bool dontWriteOut);
27 
29  void invalidate();
31  void resetForGetEntry();
33  void recoverFromNullObject();
35  void recreate();
37  TClonesArray* getPtrAsArray() const;
38 
39  bool isArray;
40  bool dontWriteOut;
41  TClass* objClass;
48  TObject* object;
49 
51  TObject* ptr;
52 
53  std::string name;
54  };
56 }
Abstract base class for different kinds of events.
Wraps a stored array/object, stored under unique (name, durability) key.
Definition: StoreEntry.h:22
TObject * ptr
The pointer to the returned object, either equal to 'object' or null, depending on wether the object ...
Definition: StoreEntry.h:51
TClonesArray * getPtrAsArray() const
Return ptr cast to TClonesArray.
Definition: StoreEntry.cc:83
bool dontWriteOut
Flag that indicates whether the object should be written to the output by default.
Definition: StoreEntry.h:40
TObject * object
The pointer to the actual object.
Definition: StoreEntry.h:48
void invalidate()
invalidate entry for next event.
Definition: StoreEntry.cc:77
bool isArray
Flag that indicates whether the object is a TClonesArray.
Definition: StoreEntry.h:39
std::string name
Name of the entry.
Definition: StoreEntry.h:53
void recoverFromNullObject()
Recreate object if null.
Definition: StoreEntry.cc:30
void resetForGetEntry()
Reset stored object to defaults, or nullptr.
Definition: StoreEntry.cc:55
void recreate()
Reset stored object to defaults, set ptr to new object.
Definition: StoreEntry.cc:68
TClass * objClass
class of object.
Definition: StoreEntry.h:41