Belle II Software development
StoreWrappedObjPtr.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
9#pragma once
10
11#include <tracking/trackFindingCDC/rootification/StoreWrapper.h>
12#include <framework/datastore/StoreObjPtr.h>
13
14namespace Belle2 {
20 namespace TrackFindingCDC {
21
29 template<class T>
30 class StoreWrappedObjPtr : public StoreObjPtr<StoreWrapper<T> > {
31
32 public:
39 StoreWrappedObjPtr(const std::string& name = "", DataStore::EDurability durability = DataStore::c_Event) :
40 StoreObjPtr<StoreWrapper<T> >(name, durability)
41 {}
42
43
51 {
53 }
54
62 bool registerInDataStore(const std::string& name,
64 {
65 return StoreObjPtr<StoreWrapper<T> >::registerInDataStore(name, storeFlags);
66 }
67
69 T& operator*() const
70 {
71 return StoreObjPtr<StoreWrapper<T> >::operator*().get();
72 }
73
75 T* operator->() const
76 {
77 return &(operator*());
78 }
79
80 };
81 }
83}
84
85
EStoreFlags
Flags describing behaviours of objects etc.
Definition: DataStore.h:69
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:71
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:72
EDurability
Durability types.
Definition: DataStore.h:58
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Definition: DataStore.h:59
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
This class is for convenience access and registration of objects, that are stored inside the StoreWra...
T & operator*() const
Dereference to the wrapped object.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_DontWriteOut|DataStore::c_ErrorIfAlreadyRegistered)
Register the object/array in the DataStore.
StoreWrappedObjPtr(const std::string &name="", DataStore::EDurability durability=DataStore::c_Event)
Constructor to access an object in the DataStore.
T * operator->() const
Forward pointer access to the wrapped object.
bool registerInDataStore(const std::string &name, DataStore::EStoreFlags storeFlags=DataStore::c_DontWriteOut|DataStore::c_ErrorIfAlreadyRegistered)
Register the object/array in the DataStore.
This template functions as a wrapper for objects that do not inherit from TObject to be put on the Da...
Definition: StoreWrapper.h:29
Abstract base class for different kinds of events.