Belle II Software development
RelationContainer.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 <TClonesArray.h>
12#include <string>
13
14namespace Belle2 {
19 class RelationElement;
20
27 class RelationContainer: public TObject {
28 public:
29
32
34 const std::string& getFromName() const { return m_fromName; }
35
37 int getFromDurability() const { return m_fromDurability; }
38
40 const std::string& getToName() const { return m_toName; }
41
43 int getToDurability() const { return m_toDurability; }
44
46 void setFromName(const std::string& name) { m_fromName = name; }
47
49 void setFromDurability(int durability) { m_fromDurability = durability; }
50
52 void setToName(const std::string& name) { m_toName = name; }
53
55 void setToDurability(int durability) { m_toDurability = durability; }
56
58 void setModified(bool modified) { m_modified = modified; }
59
62 {
63 return (m_fromDurability == -1 and m_toDurability == -1 and
64 m_fromName.empty() and m_toName.empty() and getEntries() == 0);
65 }
66
68 virtual void Clear(Option_t* = "");
69
71 TClonesArray& elements() { return m_elements; }
72
74 const TClonesArray& elements() const { return m_elements; }
75
77 const RelationElement& getElement(int i) const;
78
80 int getEntries() const { return m_elements.GetEntriesFast(); }
81
83 bool getModified() const { return m_modified; }
84
85 protected:
86
88 TClonesArray m_elements;
89
91 std::string m_fromName;
92
95
97 std::string m_toName;
98
101
104
105 friend class RelationArray;
106 friend class DataStore;
107
109 };
111}
In the store you can park objects that have to be accessed by various modules.
Definition: DataStore.h:51
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
Class to store relations between StoreArrays in the DataStore.
bool getModified() const
check for modification since creation or deserialization.
virtual void Clear(Option_t *="")
Clear container to free memory.
void setFromDurability(int durability)
Set durability of the StoreArray we relate from.
int getToDurability() const
Get durability of the StoreArray we relate to.
TClonesArray m_elements
TClonesArray to store all elements.
const std::string & getFromName() const
Get name of the StoreArray we relate from.
void setToDurability(int durability)
Set durability of the StoreArray we relate to.
int getFromDurability() const
Get durability of the StoreArray we relate from.
const TClonesArray & elements() const
Get const reference to the elements.
const RelationElement & getElement(int i) const
Get reference to RelationElement at index i.
RelationContainer()
Default constructor, initialize all values to sane default.
int m_toDurability
durability of the StoreArray we relate to.
const std::string & getToName() const
Get name of the StoreArray we relate to.
bool isDefaultConstructed() const
Returns true if no information was set yet or Clear() was called.
ClassDef(RelationContainer, 1)
Class to store relations between StoreArrays in the DataStore.
std::string m_fromName
name of the StoreArray we relate from.
void setModified(bool modified)
check for modification since creation or deserialization.
bool m_modified
check for modification since creation or deserialization.
std::string m_toName
name of the StoreArray we relate to.
int getEntries() const
Get number of elements.
void setToName(const std::string &name)
Set name of the StoreArray we relate to.
void setFromName(const std::string &name)
Set name of the StoreArray we relate from.
int m_fromDurability
durability of the StoreArray we relate from.
TClonesArray & elements()
Get reference to the elements.
Class to store a single element of a relation.
Abstract base class for different kinds of events.