Belle II Software  release-05-02-19
RelationContainer.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2011 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <TClonesArray.h>
13 #include <string>
14 
15 namespace Belle2 {
20  class RelationElement;
21 
28  class RelationContainer: public TObject {
29  public:
30 
33 
35  const std::string& getFromName() const { return m_fromName; }
36 
38  int getFromDurability() const { return m_fromDurability; }
39 
41  const std::string& getToName() const { return m_toName; }
42 
44  int getToDurability() const { return m_toDurability; }
45 
47  void setFromName(const std::string& name) { m_fromName = name; }
48 
50  void setFromDurability(int durability) { m_fromDurability = durability; }
51 
53  void setToName(const std::string& name) { m_toName = name; }
54 
56  void setToDurability(int durability) { m_toDurability = durability; }
57 
59  void setModified(bool modified) { m_modified = modified; }
60 
62  bool isDefaultConstructed() const
63  {
64  return (m_fromDurability == -1 and m_toDurability == -1 and
65  m_fromName.empty() and m_toName.empty() and getEntries() == 0);
66  }
67 
69  virtual void Clear(Option_t* = "");
70 
72  TClonesArray& elements() { return m_elements; }
73 
75  const TClonesArray& elements() const { return m_elements; }
76 
78  const RelationElement& getElement(int i) const;
79 
81  int getEntries() const { return m_elements.GetEntriesFast(); }
82 
84  bool getModified() const { return m_modified; }
85 
86  protected:
87 
89  TClonesArray m_elements;
90 
92  std::string m_fromName;
93 
95  int m_fromDurability;
96 
98  std::string m_toName;
99 
101  int m_toDurability;
102 
104  bool m_modified;
105 
106  friend class RelationArray;
107  friend class DataStore;
108 
110  };
112 }
Belle2::RelationArray
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:72
Belle2::RelationContainer::setToDurability
void setToDurability(int durability)
Set durability of the StoreArray we relate to.
Definition: RelationContainer.h:63
Belle2::RelationContainer::isDefaultConstructed
bool isDefaultConstructed() const
Returns true if no information was set yet or Clear() was called.
Definition: RelationContainer.h:69
Belle2::RelationContainer::getFromDurability
int getFromDurability() const
Get durability of the StoreArray we relate from.
Definition: RelationContainer.h:45
Belle2::RelationContainer::m_modified
bool m_modified
check for modification since creation or deserialization.
Definition: RelationContainer.h:111
Belle2::RelationContainer::getElement
const RelationElement & getElement(int i) const
Get reference to RelationElement at index i.
Definition: RelationContainer.cc:25
Belle2::RelationContainer
Class to store relations between StoreArrays in the DataStore.
Definition: RelationContainer.h:35
Belle2::RelationContainer::setModified
void setModified(bool modified)
check for modification since creation or deserialization.
Definition: RelationContainer.h:66
Belle2::RelationContainer::ClassDef
ClassDef(RelationContainer, 1)
Class to store relations between StoreArrays in the DataStore.
Belle2::RelationContainer::setFromDurability
void setFromDurability(int durability)
Set durability of the StoreArray we relate from.
Definition: RelationContainer.h:57
Belle2::RelationContainer::getToDurability
int getToDurability() const
Get durability of the StoreArray we relate to.
Definition: RelationContainer.h:51
Belle2::RelationContainer::getEntries
int getEntries() const
Get number of elements.
Definition: RelationContainer.h:88
Belle2::RelationContainer::setToName
void setToName(const std::string &name)
Set name of the StoreArray we relate to.
Definition: RelationContainer.h:60
Belle2::RelationContainer::setFromName
void setFromName(const std::string &name)
Set name of the StoreArray we relate from.
Definition: RelationContainer.h:54
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RelationContainer::elements
TClonesArray & elements()
Get reference to the elements.
Definition: RelationContainer.h:79
Belle2::RelationContainer::getModified
bool getModified() const
check for modification since creation or deserialization.
Definition: RelationContainer.h:91
Belle2::RelationContainer::m_toDurability
int m_toDurability
durability of the StoreArray we relate to.
Definition: RelationContainer.h:108
Belle2::RelationContainer::m_toName
std::string m_toName
name of the StoreArray we relate to.
Definition: RelationContainer.h:105
Belle2::RelationContainer::getFromName
const std::string & getFromName() const
Get name of the StoreArray we relate from.
Definition: RelationContainer.h:42
Belle2::RelationContainer::Clear
virtual void Clear(Option_t *="")
Clear container to free memory.
Definition: RelationContainer.cc:29
Belle2::RelationContainer::m_elements
TClonesArray m_elements
TClonesArray to store all elements.
Definition: RelationContainer.h:96
Belle2::RelationContainer::m_fromName
std::string m_fromName
name of the StoreArray we relate from.
Definition: RelationContainer.h:99
Belle2::RelationContainer::getToName
const std::string & getToName() const
Get name of the StoreArray we relate to.
Definition: RelationContainer.h:48
Belle2::RelationContainer::m_fromDurability
int m_fromDurability
durability of the StoreArray we relate from.
Definition: RelationContainer.h:102
Belle2::DataStore
In the store you can park objects that have to be accessed by various modules.
Definition: DataStore.h:53
Belle2::RelationContainer::RelationContainer
RelationContainer()
Default constructor, initialize all values to sane default.
Definition: RelationContainer.cc:18