ATLAS Offline Software
AssociationObjectIterator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
86 #ifdef ASSOCIATIONMAP_CONTEXT
87 
89 {
90 public:
91 
95 AssociationObjectIterator() : m_store(0)
96 { }
97 
102 AssociationObjectIterator(const store_type& theStore)
103  : m_store(&theStore)
104  , m_actual(theStore.begin())
105 { }
106 
112 AssociationObjectIterator(const store_type& theStore,
113  const typename store_type::const_iterator& pos)
114  : m_store(&theStore)
115  , m_actual(pos)
116 { }
117 
121  m_store ( rhs.m_store ),
122  m_actual( rhs.m_actual )
123 {}
124 
128 {
129  if ( this != &rhs ) {
130  m_store = rhs.m_store;
131  m_actual= rhs.m_actual;
132  }
133  return *this;
134 }
135 
138 { }
143 
146 { return AssociationObjectIterator(*m_store); }
147 
150 { return AssociationObjectIterator(*m_store, m_store->end()); }
151 
153 { return AssociationObjectIterator(*m_store); }
157 { return AssociationObjectIterator(*m_store,m_store->end()); }
158 
161 { ++m_actual; return *this; }
162 
165 { --m_actual; return *this; }
166 
169 {
171  ++m_actual;
172  return tmp;
173 }
174 
176 AssociationObjectIterator operator++(int) { return this->next(); }
177 
179 AssociationObjectIterator operator--()
180 {
182  --m_actual;
183  return tmp;
184 }
185 
187 AssociationObjectIterator operator--(int) { return this->prev(); }
196 bool operator==(const AssociationObjectIterator& anOther) const
197 { return m_actual == anOther.m_actual; }
198 // bool operator==(AssociationObjectIterator& anOther)
199 // { return m_actual == anOther.m_actual; }
204 bool operator!=(const AssociationObjectIterator& anOther) const
205 { return m_actual != anOther.m_actual; }
206 // bool operator!=(AssociationObjectIterator& anOther)
207 // { return m_actual != anOther.m_actual; }
220 AssociationObjectIterator operator*() const { return *this; }
221 
223 const object_type* operator->()
224 { return this->getObject(); }
225 
227 const object_type* operator->() const
228 { return this->getObject(); }
229 
231 const object_type* first() const { return *(m_actual->first); }
233 asso_iterator second() const
234 { return asso_iterator(m_actual->second,m_actual->second.begin()); }
243 AssociationObjectIterator find(const object_type* objectPointer) const
244 {
245  const AssociationObjectIterator lastObj = this->end();
246  AssociationObjectIterator firstObj = this->begin();
247  AssociationObjectIterator foundObj = lastObj;
248  while (firstObj != lastObj )
249  {
250  if ( firstObj.isValid() && firstObj.getObject() == objectPointer )
251  {
252  foundObj = firstObj;
253  firstObj = lastObj;
254  }
255  else
256  {
257  ++firstObj;
258  }
259  }
260  return foundObj;
261 }
268 const object_type* getObject() const { return this->first(); }
269 
271 const object_link& getObjectLink() const { return m_actual->first; }
272 
273 bool isValid() const { return this->m_actual->first.isValid(); }
274 
276 asso_iterator getFirstAssociation() const
277 {
278  return asso_iterator(m_actual->second, m_actual->second.begin());
279 }
280 
282 asso_iterator getLastAssociation() const
283 {
284  return asso_iterator(m_actual->second, m_actual->second.end());
285 }
286 
288 asso_iterator findAssociation(const asso_type* assoPointer) const
289 {
290  asso_iterator assItr = asso_iterator(m_actual->second,
291  m_actual->second.begin());
292  return assItr.find(assoPointer);
293 }
294 
296 bool containsAssociation(const asso_type* assoPointer) const
297 { return this->findAssociation(assoPointer) != this->getLastAssociation(); }
298 
300 size_t getNumberOfAssociations() const
301 { return m_actual->second.size(); }
302 
303 size_t size() const { return m_store->size(); }
304 
305 private:
306 
307  const store_type* m_store;
308  typename store_type::const_iterator m_actual;
309 };
310 #endif
311 
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
operator==
bool operator==(const DataVector< T > &a, const DataVector< T > &b)
Vector equality comparison.
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:225
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
InDetDD::operator*
SiLocalPosition operator*(const SiLocalPosition &position, const double factor)
Definition: SiLocalPosition.cxx:98
AssociationObjectIterator
object iterator for association maps (internal use only!)
operator!=
bool operator!=(const DataVector< T > &a, const DataVector< T > &b)
Based on operator==.
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
LVL1TGCTrigger::operator++
TGCHBChip operator++(TGCHBChip &rs, int)
Definition: TGCHighPtBoard.h:28
IsoCloseByCorrectionTest.object_type
object_type
Definition: IsoCloseByCorrectionTest.py:56
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
DeMoScan.first
bool first
Definition: DeMoScan.py:536