Belle II Software  release-08-01-10
StoreWrapper.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 #include <framework/datastore/RelationsObject.h>
11 
12 namespace Belle2 {
18  namespace TrackFindingCDC {
19 
28  template<class T>
29  class StoreWrapper : public RelationsObject {
30 
31  public:
33  const T& get() const
34  { return m_item; }
35 
37  T& get()
38  { return m_item; }
39 
41  T& unwrap()
42  { return m_item; }
43 
45  T* operator->() { return &m_item; }
46 
48  const T* operator->() const { return &m_item; }
49 
51  T& operator*() { return m_item; }
52 
54  const T& operator*() const { return m_item; }
55 
57  const T& __iter__() const { return m_item; }
58 
59  public:
61  T m_item;
62 
63  private:
66  };
67 
68  }
69 
71 }
72 
73 
Defines interface for accessing relations of objects in StoreArray.
This template functions as a wrapper for objects that do not inherit from TObject to be put on the Da...
Definition: StoreWrapper.h:29
T m_item
Memory for the wrapped item.
Definition: StoreWrapper.h:61
const T & get() const
Constant getter for the the contained object.
Definition: StoreWrapper.h:33
const T & operator*() const
Unpacks the wrapped object as if the wrapper was a pointer to it.
Definition: StoreWrapper.h:54
const T * operator->() const
Forwarding -> access to the wrapped object as if the wrapper would be a pointer to it.
Definition: StoreWrapper.h:48
T & get()
Getter for the the contained object.
Definition: StoreWrapper.h:37
T & unwrap()
Alias getter for the the contained object to stress that the wrapper is being removed.
Definition: StoreWrapper.h:41
ClassDef(StoreWrapper, 1)
ROOT Macro to unconditionally make StoreWrapper a ROOT class.
const T & __iter__() const
Forwards an iteration request from python to the wrapped object. If iteration is feasable depends on ...
Definition: StoreWrapper.h:57
T * operator->()
Forwarding -> access to the wrapped object as if the wrapper would be a pointer to it.
Definition: StoreWrapper.h:45
T & operator*()
Unpacks the wrapped object as if the wrapper was a pointer to it.
Definition: StoreWrapper.h:51
Abstract base class for different kinds of events.