Simpatico  v1.10
List of all members | Public Member Functions
Util::ArrayIterator< Data > Class Template Reference

Detailed Description

template<typename Data>
class Util::ArrayIterator< Data >

Forward iterator for an Array or a C array.

An ArrayIterator is an abstraction of a pointer, similar to an STL forward iterator. The * operator returns a reference to an associated Data object, the -> operator returns a pointer to that object. The ++ operator increments the current pointer by one array element.

Unlike an STL forward iterator, an ArrayIterator 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, and cannot be incremented further.

An ArrayIterator behave like a pointer to non-const data, and provides read-write access to the objects to which it points. A ConstArrayIterator behaves like a pointer to const, and provides read-only access

Definition at line 39 of file ArrayIterator.h.

#include <ArrayIterator.h>

Public Member Functions

 ArrayIterator ()
 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 the current pointer not at the end of the array? More...
 
Data * get () const
 Return a pointer to the current data. More...
 
Operators
Data & operator* () const
 Get a reference to the current Data. More...
 
Data * operator-> () const
 Provide a pointer to the current Data object. More...
 
ArrayIterator< Data > & operator++ ()
 Increment the current pointer. More...
 

Constructor & Destructor Documentation

template<typename Data>
Util::ArrayIterator< Data >::ArrayIterator ( )
inline

Default constructor.

Constructs an uninitialized iterator.

Definition at line 49 of file ArrayIterator.h.

Member Function Documentation

template<typename Data>
void Util::ArrayIterator< Data >::setCurrent ( Data *  ptr)
inline

Set the current pointer value.

Parameters
ptrPointer to current element of the array.

Definition at line 59 of file ArrayIterator.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().

template<typename Data>
void Util::ArrayIterator< Data >::setEnd ( Data *  ptr)
inline

Set the value of the end pointer.

Parameters
ptrPointer to one element past end of array.

Definition at line 67 of file ArrayIterator.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().

template<typename Data>
bool Util::ArrayIterator< Data >::isEnd ( ) const
inline

Has the end of the array been reached?

Returns
true if at end, false otherwise.

Definition at line 75 of file ArrayIterator.h.

template<typename Data>
bool Util::ArrayIterator< Data >::notEnd ( ) const
inline

Is the current pointer not at the end of the array?

Returns
true if not at end, false otherwise.

Definition at line 83 of file ArrayIterator.h.

Referenced by Tools::ConfigReader::addAtomsToSpecies(), McMd::ExternalPotentialImpl< Interaction >::addForces(), McMd::MdEwaldPotential::addForces(), McMd::MdSpmePotential::addForces(), McMd::BondPotentialImpl< Interaction >::addForces(), McMd::DihedralPotentialImpl< Interaction >::addForces(), McMd::AnglePotentialImpl< Interaction >::addForces(), McMd::McPairPotential::buildCellList(), McMd::MdPairPotential::buildPairList(), McMd::MdEwaldPotential::computeEnergy(), McMd::MdSpmePotential::computeEnergy(), Tools::DdMdConfigWriter::DdMdConfigWriter(), McMd::McExternalPerturbation< Interaction >::derivative(), McMd::McPairExternalPerturbation< PairInteraction, ExternalInteraction >::derivative(), McMd::DeformCommand::execute(), McMd::ClusterIdentifier::identifyClusters(), McMd::ClusterIdentifier::initialize(), McMd::System::loadConfig(), McMd::MdSpmePotential::makeWaves(), McMd::MdEwaldPotential::makeWaves(), McMd::HybridMdMove::move(), McMd::HybridNphMdMove::move(), McMd::ReplicaMove::move(), McMd::SmpConfigIo::read(), McMd::McMdConfigIo::read(), McMd::DdMdConfigIo::read(), McMd::LammpsConfigIo::read(), McMd::LammpsDumpReader::readFrame(), McMd::DdMdTrajectoryReader::readFrame(), McMd::DCDTrajectoryReader::readFrame(), McMd::McCommandManager::readStandardCommand(), McMd::MdSystem::removeDriftVelocity(), McMd::McExternalEnergyAverage::sample(), Tools::AtomMSD::sample(), McMd::VelProf::sample(), Tools::PairEnergy::sample(), McMd::BondLengthDist::sample(), McMd::System::saveConfig(), McMd::MdSystem::setBoltzmannVelocities(), Tools::AtomMSD::setup(), McMd::MdSystem::setZeroForces(), McMd::MdSystem::setZeroVelocities(), McMd::MdSystem::shiftAtoms(), McMd::NveVvIntegrator::step(), McMd::NvtLangevinIntegrator::step(), McMd::NvtDpdVvIntegrator::step(), McMd::NvtNhIntegrator::step(), McMd::DdMdConfigIo::write(), McMd::LammpsConfigIo::write(), Tools::DdMdConfigWriter::writeConfig(), Tools::HoomdConfigWriter::writeConfig(), and Tools::LammpsDumpWriter::~LammpsDumpWriter().

template<typename Data>
Data* Util::ArrayIterator< Data >::get ( ) const
inline

Return a pointer to the current data.

Returns
true if at end, false otherwise.

Definition at line 91 of file ArrayIterator.h.

template<typename Data>
Data& Util::ArrayIterator< Data >::operator* ( ) const
inline

Get a reference to the current Data.

Returns
reference to associated Data object

Definition at line 102 of file ArrayIterator.h.

template<typename Data>
Data* Util::ArrayIterator< Data >::operator-> ( ) const
inline

Provide a pointer to the current Data object.

Returns
const pointer to the Data object

Definition at line 110 of file ArrayIterator.h.

template<typename Data>
ArrayIterator<Data>& Util::ArrayIterator< Data >::operator++ ( )
inline

Increment the current pointer.

Returns
this ArrayIterator, after modification.

Definition at line 118 of file ArrayIterator.h.


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