Belle II Software  release-05-02-19
StoreWrapper.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 #include <framework/datastore/RelationsObject.h>
13 
14 namespace Belle2 {
20  namespace TrackFindingCDC {
21 
30  template<class T>
31  class StoreWrapper : public RelationsObject {
32 
33  public:
35  const T& get() const
36  { return m_item; }
37 
39  T& get()
40  { return m_item; }
41 
43  T& unwrap()
44  { return m_item; }
45 
47  T* operator->() { return &m_item; }
48 
50  const T* operator->() const { return &m_item; }
51 
53  T& operator*() { return m_item; }
54 
56  const T& operator*() const { return m_item; }
57 
59  const T& __iter__() const { return m_item; }
60 
61  public:
63  T m_item;
64 
65  private:
68  };
69 
70  }
71 
73 }
74 
75 
Belle2::TrackFindingCDC::StoreWrapper::__iter__
const T & __iter__() const
Forwards an iteration request from python to the wrapped object. If iteration is feasable depends on ...
Definition: StoreWrapper.h:67
Belle2::TrackFindingCDC::StoreWrapper::get
const T & get() const
Constant getter for the the contained object.
Definition: StoreWrapper.h:43
Belle2::TrackFindingCDC::StoreWrapper::m_item
T m_item
Memory for the wrapped item.
Definition: StoreWrapper.h:71
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::StoreWrapper::ClassDef
ClassDef(StoreWrapper, 1)
ROOT Macro to unconditionally make StoreWrapper a ROOT class.
Belle2::TrackFindingCDC::StoreWrapper::operator*
T & operator*()
Unpacks the wrapped object as if the wrapper was a pointer to it.
Definition: StoreWrapper.h:61
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::TrackFindingCDC::StoreWrapper::unwrap
T & unwrap()
Alias getter for the the contained object to stress that the wrapper is being removed.
Definition: StoreWrapper.h:51
Belle2::TrackFindingCDC::StoreWrapper
This template functions as a wrapper for objects that do not inherit from TObject to be put on the Da...
Definition: StoreWrapper.h:39
Belle2::TrackFindingCDC::StoreWrapper::operator->
T * operator->()
Forwarding -> access to the wrapped object as if the wrapper would be a pointer to it.
Definition: StoreWrapper.h:55