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/trackingUtilities/rootification/StoreWrapper.h>
12#include <framework/datastore/StoreObjPtr.h>
13
14namespace Belle2 {
19
20 namespace TrackingUtilities {
21
29 template<class T>
30 class StoreWrappedObjPtr : public StoreObjPtr<StoreWrapper<T> > {
31
32 public:
39 explicit StoreWrappedObjPtr(const std::string& name = "", DataStore::EDurability durability = DataStore::c_Event) :
40 StoreObjPtr<StoreWrapper<T> >(name, durability)
41 {}
42
43
50 // cppcheck-suppress duplInheritedMember ; intentionally hides the base class member to default to transient, non-streamed registration
55
63 // cppcheck-suppress duplInheritedMember ; intentionally hides the base class member to default to transient, non-streamed registration
69
71 // cppcheck-suppress duplInheritedMember ; intentionally hides the base class member to unwrap the StoreWrapper
72 T& operator*() const
73 {
74 return StoreObjPtr<StoreWrapper<T> >::operator*().get();
75 }
76
78 // cppcheck-suppress duplInheritedMember ; intentionally hides the base class member to unwrap the StoreWrapper
79 T* operator->() const
80 {
81 return &(operator*());
82 }
83
84 };
85 }
87}
88
89
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
StoreObjPtr(const std::string &name="", DataStore::EDurability durability=DataStore::c_Event)
StoreWrappedObjPtr(const std::string &name="", DataStore::EDurability durability=DataStore::c_Event)
Constructor to access an object in the DataStore.
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...
Abstract base class for different kinds of events.