Public Types | Public Member Functions | Private Attributes | List of all members
WireCell::Iterator< ValueType > Class Template Reference

#include <Iterator.h>

Inheritance diagram for WireCell::Iterator< ValueType >:

Public Types

typedef WireCell::IteratorBase< ValueType > BaseIteratorType
 

Public Member Functions

 Iterator ()
 
 Iterator (const Iterator &other)
 
 Iterator (const BaseIteratorType &base_other)
 
 ~Iterator ()
 
bool operator== (const Iterator &rhs) const
 
bool operator!= (const Iterator &rhs) const
 
Iteratoroperator++ ()
 
ValueType operator* () const
 
Iteratoroperator= (const Iterator &rhs)
 

Private Attributes

BaseIteratorTypebase_itr
 

Detailed Description

template<typename ValueType>
class WireCell::Iterator< ValueType >

This iterator provides a facade over a WireCell::IteratorBase<ValueType>.

This facade can be passed by value without slicing the abstract base iterator.

Definition at line 16 of file Iterator.h.

Member Typedef Documentation

template<typename ValueType >
typedef WireCell::IteratorBase<ValueType> WireCell::Iterator< ValueType >::BaseIteratorType

Definition at line 18 of file Iterator.h.

Constructor & Destructor Documentation

template<typename ValueType >
WireCell::Iterator< ValueType >::Iterator ( )
inline

Definition at line 21 of file Iterator.h.

21 : base_itr(0) { }
BaseIteratorType * base_itr
Definition: Iterator.h:69
template<typename ValueType >
WireCell::Iterator< ValueType >::Iterator ( const Iterator< ValueType > &  other)
inline

Definition at line 24 of file Iterator.h.

24  : base_itr(0) {
25  if (other.base_itr) {
26  base_itr = other.base_itr->clone();
27  }
28  }
BaseIteratorType * base_itr
Definition: Iterator.h:69
template<typename ValueType >
WireCell::Iterator< ValueType >::Iterator ( const BaseIteratorType base_other)
inline

Definition at line 29 of file Iterator.h.

29  : base_itr(0) {
30  base_itr = base_other.clone();
31  }
virtual IteratorBase * clone() const =0
BaseIteratorType * base_itr
Definition: Iterator.h:69
template<typename ValueType >
WireCell::Iterator< ValueType >::~Iterator ( )
inline

Definition at line 32 of file Iterator.h.

32  {
33  if (base_itr) {
34  delete base_itr;
35  }
36  base_itr = 0;
37  }
BaseIteratorType * base_itr
Definition: Iterator.h:69

Member Function Documentation

template<typename ValueType >
bool WireCell::Iterator< ValueType >::operator!= ( const Iterator< ValueType > &  rhs) const
inline

Definition at line 44 of file Iterator.h.

44  {
45  if (base_itr && rhs.base_itr) {
46  return *base_itr != *rhs.base_itr;
47  }
48  return base_itr != rhs.base_itr;
49  }
BaseIteratorType * base_itr
Definition: Iterator.h:69
template<typename ValueType >
ValueType WireCell::Iterator< ValueType >::operator* ( ) const
inline

Definition at line 56 of file Iterator.h.

56  {
57  return *(*base_itr);
58  }
template<typename ValueType >
Iterator& WireCell::Iterator< ValueType >::operator++ ( )
inline

Definition at line 51 of file Iterator.h.

51  {
52  ++(*base_itr);
53  return *this;
54  }
template<typename ValueType >
Iterator& WireCell::Iterator< ValueType >::operator= ( const Iterator< ValueType > &  rhs)
inline

Definition at line 60 of file Iterator.h.

60  {
61  if (base_itr) {
62  delete base_itr;
63  }
64  base_itr = rhs.base_itr->clone();
65  return *this;
66  }
virtual IteratorBase * clone() const =0
BaseIteratorType * base_itr
Definition: Iterator.h:69
template<typename ValueType >
bool WireCell::Iterator< ValueType >::operator== ( const Iterator< ValueType > &  rhs) const
inline

Definition at line 39 of file Iterator.h.

39  {
40  if (base_itr == rhs.base_itr) return true;
41  if (!base_itr || !rhs.base_itr) return false;
42  return *base_itr == *rhs.base_itr;
43  }
BaseIteratorType * base_itr
Definition: Iterator.h:69

Member Data Documentation

template<typename ValueType >
BaseIteratorType* WireCell::Iterator< ValueType >::base_itr
private

Definition at line 69 of file Iterator.h.


The documentation for this class was generated from the following file: