ATLAS Offline Software
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
DataModel_detail::iterator< DVL > Class Template Reference

(Non-const) Iterator class for DataVector/DataList. More...

#include <DVLIterator.h>

Inheritance diagram for DataModel_detail::iterator< DVL >:
Collaboration diagram for DataModel_detail::iterator< DVL >:

Public Types

typedef DVL Container
 
typedef DVL::BaseContainer BaseContainer
 

Public Member Functions

 iterator ()
 Default constructor. More...
 
 iterator (typename BaseContainer::iterator it, DVL *container)
 Constructor. More...
 
ElementProxy operator[] (int n) const
 Element access. More...
 
 operator const_iterator () const
 Convert to a const_iterator. More...
 
DVL * container ()
 Return the container holding the referenced element. More...
 
const DVL * container () const
 Return the container holding the referenced element. More...
 
SG::OwnershipPolicy ownPolicy () const
 Return the ownership policy of the container from which this iterator was created. More...
 
void testInsert (const char *op)
 Test if we can insert; raise an exception if not. More...
 
bool operator== (const iterator &i) const
 
bool operator!= (const iterator &i) const
 
bool operator< (const iterator &i) const
 
bool operator> (const iterator &i) const
 
bool operator<= (const iterator &i) const
 
bool operator>= (const iterator &i) const
 
bool operator== (const const_iterator &i) const
 
bool operator!= (const const_iterator &i) const
 
bool operator< (const const_iterator &i) const
 
bool operator> (const const_iterator &i) const
 
bool operator<= (const const_iterator &i) const
 
bool operator>= (const const_iterator &i) const
 
iterator_adaptor_::difference_type operator- (const iterator &i) const
 
iterator operator- (typename iterator_adaptor_::difference_type i) const
 
iterator_adaptor_::difference_type operator- (const const_iterator &i) const
 

Private Types

typedef boost::iterator_adaptor< iterator, typename DVL::BaseContainer::iterator, typename DVL::value_type, typename DVL::BaseContainer::const_iterator::iterator_category, typename DVL::ElementProxy > iterator_adaptor_
 
typedef DVL::ElementProxy ElementProxy
 
typedef DVL::const_iterator const_iterator
 

Private Member Functions

DVL::pointer operator-> ()
 
ElementProxy dereference () const
 Dereference the iterator. More...
 

Private Attributes

DVL * m_container
 The referenced container. More...
 

Friends

class boost::iterator_core_access
 

Detailed Description

template<class DVL>
class DataModel_detail::iterator< DVL >

(Non-const) Iterator class for DataVector/DataList.

Except for dereferencing, we want this to be the same as the iterator of the underlying container type. So, we use boost::iterator_adaptor and override dereference.

This should nearly meets underlying container's iterator requirements, except that the dereferencing operations return an ElementProxy instead of a reference.

This is templated on the specific DataVector/List class.

Definition at line 171 of file DVLIterator.h.

Member Typedef Documentation

◆ BaseContainer

template<class DVL >
typedef DVL::BaseContainer DataModel_detail::iterator< DVL >::BaseContainer

Definition at line 202 of file DVLIterator.h.

◆ const_iterator

template<class DVL >
typedef DVL::const_iterator DataModel_detail::iterator< DVL >::const_iterator
private

Definition at line 197 of file DVLIterator.h.

◆ Container

template<class DVL >
typedef DVL DataModel_detail::iterator< DVL >::Container

Definition at line 201 of file DVLIterator.h.

◆ ElementProxy

template<class DVL >
typedef DVL::ElementProxy DataModel_detail::iterator< DVL >::ElementProxy
private

Definition at line 196 of file DVLIterator.h.

◆ iterator_adaptor_

template<class DVL >
typedef boost::iterator_adaptor<iterator, typename DVL::BaseContainer::iterator, typename DVL::value_type, typename DVL::BaseContainer:: const_iterator::iterator_category, typename DVL::ElementProxy> DataModel_detail::iterator< DVL >::iterator_adaptor_
private

Definition at line 193 of file DVLIterator.h.

Constructor & Destructor Documentation

◆ iterator() [1/2]

template<class DVL >
DataModel_detail::iterator< DVL >::iterator ( )
inline

Default constructor.

Definition at line 208 of file DVLIterator.h.

208  :
209  m_container(0)
210  {}

◆ iterator() [2/2]

template<class DVL >
DataModel_detail::iterator< DVL >::iterator ( typename BaseContainer::iterator< DVL >  it,
DVL *  container 
)
inline

Constructor.

Parameters
itThe underlying container iterator.
containerThe container over which we're iterating.

Definition at line 218 of file DVLIterator.h.

220  : iterator_adaptor_ (it),
222  {}

Member Function Documentation

◆ container() [1/2]

template<class DVL >
DVL* DataModel_detail::iterator< DVL >::container ( )
inline

Return the container holding the referenced element.

Definition at line 253 of file DVLIterator.h.

254  {
255  return m_container;
256  }

◆ container() [2/2]

template<class DVL >
const DVL* DataModel_detail::iterator< DVL >::container ( ) const
inline

Return the container holding the referenced element.

Definition at line 262 of file DVLIterator.h.

263  {
264  return m_container;
265  }

◆ dereference()

template<class DVL >
ElementProxy DataModel_detail::iterator< DVL >::dereference ( ) const
inlineprivate

Dereference the iterator.

Returns
A proxy to the pointed-to element.

Definition at line 335 of file DVLIterator.h.

336  {
338  return ElementProxy (this->base(), container);
339  }

◆ operator const_iterator()

template<class DVL >
DataModel_detail::iterator< DVL >::operator const_iterator ( ) const
inline

Convert to a const_iterator.

This is needed to allow iterator to convert to const_iterator.

Definition at line 244 of file DVLIterator.h.

245  {
246  return const_iterator (this->base());
247  }

◆ operator!=() [1/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator!= ( const const_iterator< DVL > &  i) const
inline

Definition at line 299 of file DVLIterator.h.

300  { return static_cast<const_iterator>(*this)!=i; }

◆ operator!=() [2/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator!= ( const iterator< DVL > &  i) const
inline

Definition at line 290 of file DVLIterator.h.

290 { return this->base() != i.base();}

◆ operator-() [1/3]

template<class DVL >
iterator_adaptor_::difference_type DataModel_detail::iterator< DVL >::operator- ( const const_iterator< DVL > &  i) const
inline

Definition at line 320 of file DVLIterator.h.

321  { return static_cast<const_iterator>(*this) - i; }

◆ operator-() [2/3]

template<class DVL >
iterator_adaptor_::difference_type DataModel_detail::iterator< DVL >::operator- ( const iterator< DVL > &  i) const
inline

Definition at line 312 of file DVLIterator.h.

313  { return this->base() - i.base(); }

◆ operator-() [3/3]

template<class DVL >
iterator DataModel_detail::iterator< DVL >::operator- ( typename iterator_adaptor_::difference_type  i) const
inline

Definition at line 314 of file DVLIterator.h.

315  {
317  return iterator (this->base() - i, container);
318  }

◆ operator->()

template<class DVL >
DVL::pointer DataModel_detail::iterator< DVL >::operator-> ( )
private

◆ operator<() [1/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator< ( const const_iterator< DVL > &  i) const
inline

Definition at line 301 of file DVLIterator.h.

302  { return static_cast<const_iterator>(*this)<i; }

◆ operator<() [2/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator< ( const iterator< DVL > &  i) const
inline

Definition at line 291 of file DVLIterator.h.

291 { return this->base() < i.base();}

◆ operator<=() [1/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator<= ( const const_iterator< DVL > &  i) const
inline

Definition at line 305 of file DVLIterator.h.

306  { return static_cast<const_iterator>(*this)<=i; }

◆ operator<=() [2/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator<= ( const iterator< DVL > &  i) const
inline

Definition at line 293 of file DVLIterator.h.

293 { return this->base() <= i.base();}

◆ operator==() [1/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator== ( const const_iterator< DVL > &  i) const
inline

Definition at line 297 of file DVLIterator.h.

298  { return static_cast<const_iterator>(*this)==i; }

◆ operator==() [2/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator== ( const iterator< DVL > &  i) const
inline

Definition at line 289 of file DVLIterator.h.

289 { return this->base() == i.base();}

◆ operator>() [1/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator> ( const const_iterator< DVL > &  i) const
inline

Definition at line 303 of file DVLIterator.h.

304  { return static_cast<const_iterator>(*this)>i; }

◆ operator>() [2/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator> ( const iterator< DVL > &  i) const
inline

Definition at line 292 of file DVLIterator.h.

292 { return this->base() > i.base();}

◆ operator>=() [1/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator>= ( const const_iterator< DVL > &  i) const
inline

Definition at line 307 of file DVLIterator.h.

308  { return static_cast<const_iterator>(*this)>=i; }

◆ operator>=() [2/2]

template<class DVL >
bool DataModel_detail::iterator< DVL >::operator>= ( const iterator< DVL > &  i) const
inline

Definition at line 294 of file DVLIterator.h.

294 { return this->base() >= i.base();}

◆ operator[]()

template<class DVL >
ElementProxy DataModel_detail::iterator< DVL >::operator[] ( int  n) const
inline

Element access.

Parameters
nIndex relative to the iterator of the element to access.
Returns
Proxy for the element.

We need to override this here in order to get the return type correct.

Definition at line 232 of file DVLIterator.h.

233  {
235  return ElementProxy (this->base()+n, container);
236  }

◆ ownPolicy()

template<class DVL >
SG::OwnershipPolicy DataModel_detail::iterator< DVL >::ownPolicy ( ) const
inline

Return the ownership policy of the container from which this iterator was created.

Definition at line 272 of file DVLIterator.h.

273  {
274  return m_container->ownPolicy();
275  }

◆ testInsert()

template<class DVL >
void DataModel_detail::iterator< DVL >::testInsert ( const char *  op)
inline

Test if we can insert; raise an exception if not.

Parameters
opDescription of the attempted operation.

Definition at line 282 of file DVLIterator.h.

283  {
284  m_container->testInsert (op);
285  }

Friends And Related Function Documentation

◆ boost::iterator_core_access

template<class DVL >
friend class boost::iterator_core_access
friend

Definition at line 328 of file DVLIterator.h.

Member Data Documentation

◆ m_container

template<class DVL >
DVL* DataModel_detail::iterator< DVL >::m_container
private

The referenced container.

Definition at line 343 of file DVLIterator.h.


The documentation for this class was generated from the following file:
base
std::string base
Definition: hcg.cxx:78
DataModel_detail::iterator::iterator_adaptor_
boost::iterator_adaptor< iterator, typename DVL::BaseContainer::iterator, typename DVL::value_type, typename DVL::BaseContainer::const_iterator::iterator_category, typename DVL::ElementProxy > iterator_adaptor_
Definition: DVLIterator.h:193
skel.it
it
Definition: skel.GENtoEVGEN.py:396
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
DataModel_detail::iterator::iterator
iterator()
Default constructor.
Definition: DVLIterator.h:208
DataModel_detail::iterator::m_container
DVL * m_container
The referenced container.
Definition: DVLIterator.h:343
DataModel_detail::iterator::ElementProxy
DVL::ElementProxy ElementProxy
Definition: DVLIterator.h:196
DataModel_detail::iterator::const_iterator
DVL::const_iterator const_iterator
Definition: DVLIterator.h:197
DataModel_detail::ATLAS_THREAD_SAFE
dvl_tinfo_map_t *s_dvl_tinfo_map ATLAS_THREAD_SAFE
Definition: DVLInfo.cxx:41
DataModel_detail::iterator::container
DVL * container()
Return the container holding the referenced element.
Definition: DVLIterator.h:253