Belle II Software  release-05-01-25
StoreWrappedObjPtr.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <tracking/trackFindingCDC/rootification/StoreWrapper.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 
16 namespace Belle2 {
22  namespace TrackFindingCDC {
23 
31  template<class T>
32  class StoreWrappedObjPtr : public StoreObjPtr<StoreWrapper<T> > {
33 
34  public:
41  StoreWrappedObjPtr(const std::string& name = "", DataStore::EDurability durability = DataStore::c_Event) :
42  StoreObjPtr<StoreWrapper<T> >(name, durability)
43  {}
44 
45 
53  {
54  return StoreObjPtr<StoreWrapper<T> >::registerInDataStore(storeFlags);
55  }
56 
64  bool registerInDataStore(const std::string& name,
66  {
67  return StoreObjPtr<StoreWrapper<T> >::registerInDataStore(name, storeFlags);
68  }
69 
71  T& operator*() const
72  {
73  return StoreObjPtr<StoreWrapper<T> >::operator*().get();
74  }
75 
77  T* operator->() const
78  {
79  return &(operator*());
80  }
81 
82  };
83  }
85 }
86 
87 
Belle2::DataStore::EStoreFlags
EStoreFlags
Flags describing behaviours of objects etc.
Definition: DataStore.h:71
Belle2::TrackFindingCDC::StoreWrappedObjPtr::StoreWrappedObjPtr
StoreWrappedObjPtr(const std::string &name="", DataStore::EDurability durability=DataStore::c_Event)
Constructor to access an object in the DataStore.
Definition: StoreWrappedObjPtr.h:49
Belle2::DataStore::c_DontWriteOut
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:73
Belle2::TrackFindingCDC::StoreWrappedObjPtr::operator*
T & operator*() const
Dereference to the wrapped object.
Definition: StoreWrappedObjPtr.h:79
Belle2::TrackFindingCDC::StoreWrappedObjPtr::operator->
T * operator->() const
Forward pointer access to the wrapped object.
Definition: StoreWrappedObjPtr.h:85
Belle2::StoreObjPtr< StoreWrapper< T > >::StoreObjPtr
StoreObjPtr(const std::string &name="", DataStore::EDurability durability=DataStore::c_Event)
Constructor to access an object in the DataStore.
Definition: StoreObjPtr.h:113
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::TrackFindingCDC::StoreWrappedObjPtr::registerInDataStore
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_DontWriteOut|DataStore::c_ErrorIfAlreadyRegistered)
Register the object/array in the DataStore.
Definition: StoreWrappedObjPtr.h:60
Belle2::DataStore::c_ErrorIfAlreadyRegistered
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:74
Belle2::DataStore::c_Event
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Definition: DataStore.h:61
Belle2::DataStore::EDurability
EDurability
Durability types.
Definition: DataStore.h:60