Simpatico
v1.10
|
Forward const iterator for an Array or a C array.
A ConstArrayIterator is a forward iterator for an array of const data. It is an abstraction of a pointer to const, similar to an STL const forward iterator. The * operator returns a const reference to an associated Data object the -> operator returns a const pointer to that object. The ++ operator increments the current pointer by one array element.
Unlike an STL const forward iterator, an ConstArrayIterator contains the address of the end of the array. The isEnd() method can be used to test for termination of a for or while loop. When isEnd() is true, the current pointer is one past the end of the array, and thus the iterator has no current value.
A ConstArrayIterator behave like a pointer to constant data, and provides read-only access to the object to which it points. Use an ArrayIterator if you need read-write access.
Definition at line 37 of file ConstArrayIterator.h.
#include <ConstArrayIterator.h>
Public Member Functions | |
ConstArrayIterator () | |
Default constructor. More... | |
void | setCurrent (Data *ptr) |
Set the current pointer value. More... | |
void | setEnd (Data *ptr) |
Set the value of the end pointer. More... | |
bool | isEnd () const |
Has the end of the array been reached? More... | |
bool | notEnd () const |
Is this not the end of the array? More... | |
const Data * | get () const |
Return a pointer to the current data. More... | |
Operators | |
const Data & | operator* () const |
Get a reference to the current Data. More... | |
const Data * | operator-> () const |
Provide a pointer to the current Data object. More... | |
ConstArrayIterator< Data > & | operator++ () |
Increment the current pointer. More... | |
|
inline |
Default constructor.
Constructs an uninitialized iterator.
Definition at line 47 of file ConstArrayIterator.h.
|
inline |
Set the current pointer value.
ptr | Pointer to current element of the array. |
Definition at line 57 of file ConstArrayIterator.h.
Referenced by Util::Array< Data >::begin(), Util::FSArray< Data, Capacity >::begin(), Util::FArray< Data, Capacity >::begin(), Util::GArray< Data >::begin(), Util::DSArray< Data >::begin(), and McMd::Molecule::begin().
|
inline |
Set the value of the end pointer.
ptr | Pointer to one element past end of array. |
Definition at line 65 of file ConstArrayIterator.h.
Referenced by Util::Array< Data >::begin(), Util::FSArray< Data, Capacity >::begin(), Util::FArray< Data, Capacity >::begin(), Util::GArray< Data >::begin(), Util::DSArray< Data >::begin(), and McMd::Molecule::begin().
|
inline |
Has the end of the array been reached?
Definition at line 73 of file ConstArrayIterator.h.
|
inline |
Is this not the end of the array?
Definition at line 81 of file ConstArrayIterator.h.
Referenced by McMd::BondPotentialImpl< Interaction >::addForces(), McMd::DihedralPotentialImpl< Interaction >::addForces(), McMd::AnglePotentialImpl< Interaction >::addForces(), McMd::Cluster::clusterCOM(), McMd::ExternalPotentialImpl< Interaction >::computeEnergy(), McMd::BondPotentialImpl< Interaction >::computeEnergy(), McMd::DihedralPotentialImpl< Interaction >::computeEnergy(), McMd::AnglePotentialImpl< Interaction >::computeEnergy(), McMd::MdSystem::kineticEnergy(), McMd::Cluster::momentTensor(), Tools::HoomdConfigWriter::readAuxiliaryFile(), McMd::CompositionProfile::sample(), McMd::MdPairEnergyCoefficients::sample(), McMd::IntraBondStressAutoCorr< SystemType >::sample(), McMd::RDF::sample(), McMd::IntraBondTensorAutoCorr< SystemType >::sample(), McMd::StructureFactor::sample(), McMd::VanHove::sample(), McMd::StructureFactorP::sample(), McMd::IntraStructureFactor::sample(), McMd::McMdConfigIo::write(), and McMd::SmpConfigIo::write().
|
inline |
Return a pointer to the current data.
Definition at line 89 of file ConstArrayIterator.h.
|
inline |
Get a reference to the current Data.
Definition at line 100 of file ConstArrayIterator.h.
|
inline |
Provide a pointer to the current Data object.
Definition at line 108 of file ConstArrayIterator.h.
|
inline |
Increment the current pointer.
Definition at line 116 of file ConstArrayIterator.h.