ATLAS Offline Software
IAuxElement.icc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
3  */
4 /**
5  * @file AthContainersInterfaces/IAuxElement.icc
6  * @author scott snyder <snyder@bnl.gov>
7  * @date Jan, 2021
8  * @brief Flag that a class may have auxiliary data associated with it.
9  */
10 
11 
12 namespace SG {
13 
14 
15 /**
16  * @brief Default constructor.
17  * For an element not in a container.
18  */
19 inline
20 IAuxElement::IAuxElement()
21  : m_index (0),
22  m_privateStoreState (PrivateStoreState::NO_PRIVATE)
23 {
24 }
25 
26 
27 /**
28  * @brief Constructor.
29  * @param index The index of this element in its container.
30  */
31 inline
32 IAuxElement::IAuxElement(size_t index)
33  : m_index (index),
34  m_privateStoreState (PrivateStoreState::NO_PRIVATE)
35 {
36  // Check for overflow.
37  assert (m_index == index);
38 }
39 
40 
41 /**
42  * @brief Return the index of this element within its container.
43  */
44 inline
45 size_t IAuxElement::index() const
46 {
47  return m_index;
48 }
49 
50 
51 /**
52  * @brief True if this element has no private data.
53  */
54 inline
55 bool IAuxElement::noPrivateData() const
56 {
57  return m_privateStoreState == PrivateStoreState::NO_PRIVATE;
58 }
59 
60 
61 /**
62  * @brief True if this element currently has private data.
63  */
64 inline
65 bool IAuxElement::havePrivateData() const
66 {
67  return m_privateStoreState == PrivateStoreState::HAVE_PRIVATE;
68 }
69 
70 
71 /**
72  * @brief True if this element had private data before it was added
73  * to its current container.
74  */
75 inline
76 bool IAuxElement::hadPrivateData() const
77 {
78  return m_privateStoreState == PrivateStoreState::HAD_PRIVATE;
79 }
80 
81 
82 /**
83  * @brief Set the index of this element within its container.
84  */
85 inline
86 void IAuxElement::setIndex (size_t index)
87 {
88  m_index = index;
89  // Check for overflow.
90  assert (m_index == index);
91 }
92 
93 
94 /**
95  * @brief Record that this element does not have private data.
96  */
97 inline
98 void IAuxElement::setNoPrivateData()
99 {
100  m_privateStoreState = PrivateStoreState::NO_PRIVATE;
101 }
102 
103 
104 /**
105  * @brief Record that this element currently has private data.
106  */
107 inline
108 void IAuxElement::setHavePrivateData()
109 {
110  m_privateStoreState = PrivateStoreState::HAVE_PRIVATE;
111 }
112 
113 
114 /**
115  * @brief Record that this element used to have private data.
116  */
117 inline
118 void IAuxElement::setHadPrivateData()
119 {
120  m_privateStoreState = PrivateStoreState::HAD_PRIVATE;
121 }
122 
123 
124 } // namespace SG