Simpatico
v1.10
|
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... | |
|
inline |
Default constructor.
Constructs an uninitialized iterator.
Definition at line 49 of file ArrayIterator.h.
|
inline |
Set the current pointer value.
ptr | Pointer 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().
|
inline |
Set the value of the end pointer.
ptr | Pointer 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().
|
inline |
Has the end of the array been reached?
Definition at line 75 of file ArrayIterator.h.
|
inline |
Is the current pointer not at the end of the array?
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().
|
inline |
Return a pointer to the current data.
Definition at line 91 of file ArrayIterator.h.
|
inline |
Get a reference to the current Data.
Definition at line 102 of file ArrayIterator.h.
|
inline |
Provide a pointer to the current Data object.
Definition at line 110 of file ArrayIterator.h.
|
inline |
Increment the current pointer.
Definition at line 118 of file ArrayIterator.h.