AAO DRAMA/DRAMA2 C++ Interface
Public Member Functions | List of all members
drama::sds::IdIterator Class Reference

Detailed Description

An iterator for working through SDS Structures and SDS arrays of structures.

This class provides a forward iterator which can be used to work through the items within an SDS structure, or the elements of a one dimension array of SDS structures.

This iterator is designed for use with C++11 for loops using the range constructor, so it provides the operator++, operator!= and operator* methods. It will work in other cases as well, but it is not clear if the implementation is currently complete for other standard cases.

The example below shows how to work through the items in the structure "id". Each time around the loop, variable "s" will refer to the next item in the structure or structure array.

for (auto s:id)
{
    s.List();
}

The std::begin() and std::end() methods overriden, to provide implementations that take a * drama::sds::Id argument and returns drama::sds::IdIterator.

#include "sds.hh"

Inherits iterator< std::forward_iterator_tag, Id >.

Public Member Functions

 IdIterator (const Id &id, const bool setEnd=false)
 Construct a forward iterator for working through an SDS structure or array of structures. More...
 
bool operator!= (const IdIterator &other) const
 Inequality operator. More...
 
Id operator* () const
 Dereference operator - return the sds::Id item the iterator is pointing to. More...
 
const IdIteratoroperator++ ()
 Increment operator (prefix version). More...
 

Constructor & Destructor Documentation

drama::sds::IdIterator::IdIterator ( const Id id,
const bool  setEnd = false 
)
inlineexplicit

Construct a forward iterator for working through an SDS structure or array of structures.

Currently, if an array of structures, this iterator can only work with a single dimensional array.

Parameters
idThe SDS structure we want to iterator through.
setEndIf true, the current cell is set to the end() value. Used to implement std::end().

References DramaTHROW, DramaTHROW_S, drama::sds::Id::GetCode(), and drama::sds::Id::GetDims().

Member Function Documentation

bool drama::sds::IdIterator::operator!= ( const IdIterator other) const
inline

Inequality operator.

Returns true if are pointing to a different element from that the other iterator is pointing too.

Parameters
otherThe other item we want to compare against.
Id drama::sds::IdIterator::operator* ( ) const
inline

Dereference operator - return the sds::Id item the iterator is pointing to.

Returns
The item we are pointing to.

References drama::sds::Id::Cell(), DramaTHROW, and drama::sds::Id::Index().

const IdIterator& drama::sds::IdIterator::operator++ ( )
inline

Increment operator (prefix version).

Increments the iterator to point to the next object.


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

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aao.gov.au 

Generated on Mon Feb 22 2016 15:57:53 for AAO DRAMA/DRAMA2 C++ Interface by doxygen 1.8.10