OEIter

template<class A>
class OEIter

This class represents OEIter.

The OEIter template class is used to represent iterator functionality. The template is parameterized over class A, defining the behavior of iterators of across collections of type A. The iterator can be thought of a behaving like a pointer to type A.

OEIters are typically initialized by assigning them the value of an OEIterBase(of compatible type T), return from a function.

Constructors

OEIter()
OEIter(OEIterBase<A> *rhs)
OEIter(const OEIter<A> &rhs)
OEIter(OEIterBase<NonConstA> *rhs)
template<typename P>
OEIter(const P &pred, OEIter<A> &rhs)
template<typename P>
OEIter(const P &pred, OEIterBase<A> *rhs)

Default and copy constructors.

operator!

bool operator!() const

operator*

A &operator*() const

Dereference the iterator as a reference. This operator returns a C++ reference to the current item pointed to by the iterator.

operator=

OEIter<A> &operator=(OEIterBase<A> *rhs)
OEIter<A> &operator=(const OEIter<A> &rhs)

The assignment operator initializes the OEIter to the given OEIterBase, typically returned by an OEChem or OESystem function. If the OEIter has already been initialized, the internal OEIterBase is destroy and replaced with the new value.

operator!=

bool operator!=(const OEIter<A> &rhs) const

Returns true if the item pointed to by the first iterator is not the same as the item pointed to by the second iterator (using pointer inequality). This operator is the negation of OEIter.operator==.

operator++

OEIter<A> &operator++()

This prefix OEIter.operator++ advances the iterator one position.

operator+=

OEIter<A> &operator+=(int x)
OEIter<A> &operator+=(unsigned int x)

Advances the iterator ‘x’ places forward.

operator–

OEIter<A> &operator--()

This prefix OEIter.operator-- operator moves the iterator back one position, if possible.

operator-=

OEIter<A> &operator-=(int x)
OEIter<A> &operator-=(unsigned int x)

Attempts to move the iterator ‘x’ places backward.

operator->

A *operator->() const

Dereferences the iterator as a pointer. This operator returns a pointer to the current item pointed to by the iterator.

operator==

bool operator==(const OEIter<A> &rhs) const

Returns true if the item pointed to by the first iterator is the same as the item pointed to by the second iterator (using pointer equality). This operator is the negation of OEIter.operator!=.

operator A &

operator A &() const

operator A *

operator A *() const

operator bool

operator bool() const

Returns true if the current iterator position is valid. This should typically be checked before each dereference of an iterator.

Copy

OEIterBase<A> *Copy() const

Copies an OEIter. The returned value is a newly allocated OEIterBase <A>* that should be immediately assigned to an OEIter. The current location in the iterator is preserved by the copy.

Push

void Push(OEIter<A> &iter)
void Push(OEIterBase<A> *ib)
template<typename F>
void Push(const F &pred)

Sort

void Sort(const OESystem::OEBinaryPredicate<A, A> &sort_criterion)

Sorts contents of the iterator and resets the iterator to its first item. The re-ordering is local to the given instance of the iterator (i.e., the container holding the items the iterator traverses is unchanged). Once this function is called the iterator is never delete safe, even if it normally would be.

The OEBinaryPredicate <A,A> passed to this function is used as the less comparison in the sort. It should return true if the first argument is less than the second argument and false otherwise. An item that is less than another item will appear first after sorting.

ToFirst

OEIter<A> &ToFirst()

Resets the iterator to its first item, if possible.

ToLast

OEIter<A> &ToLast()

Resets the iterator to its last item, if possible.