IlsInvertedRelationList::Iterator
 
IlsInvertedRelationList::Iterator
Category 
Nested class
Description 
Iterator is a class nested in the template IlsInvertedRelationList. Instances of that nested class are used to sequentially read or update a list of inverted relations.
Related Pattern 
Iterator
Library 
<server>
Header File 
#include <ilserver/model.h>
Synopsis 
class Iterator
{
public:
Iterator(IlsInvertedRelationList&);
Iterator(Iterator&);
Iterator& operator<<(OriginType*);
Iterator& operator>>(OriginType*&);
Iterator& operator++();
Iterator& operator++(int);
Iterator& operator--();
Iterator& operator--(int);
Iterator& operator=(const Position&);
Iterator& operator=(const Iterator&);
OriginType* operator*() const;
IlsBoolean operator==(const Iterator&);
IlsBoolean operator!=(const Iterator&);
Position operator+(int);
Position operator-(int);
Iterator& operator+=(int i);
Iterator& operator-=(int i);
OriginType* operator[](int i);
IlsBoolean eol()const;
operator IlsBoolean();
Iterator& shrink();
Iterator& shrinkBefore();
Position tellp();
Iterator& seekp(const Position& position);
Iterator& reset();
Iterator& gotoEnd();
};
Constructors 
Iterator(IlsInvertedRelationList&);
This constructor creates an iterator for the list supplied as its argument.
Iterator(Iterator&);
This copy constructor creates an iterator with the same characteristics as the one supplied as its argument. This iterator points to the same item in the list as the iterator supplied as its argument.
Member Functions 
Iterator& shrink();
This member function removes the item following the last element read from the list, or, if the list has not been read yet, it removes the first item in the list.
Warning: If several iterators, or positions, have been declared for the same list, be careful when you use the shrink function with one of these iterators or positions.

For example, suppose we have an iterator
iw that performs write operations and an iterator ir that performs read operations. If ir and iw point to the same item in the list and if iw executes the function shrink, ir may behave unexpectedly. Likewise, if iw points to a given item in the list and ir points to the next item, ir may behave unexpectedly if iw executes the function shrink.
If this function is called when the minimum cardinality of the list has been reached, the exception IlsMinCardViolated is thrown. If it is called when the iterator points to the last item of the list, then the exception IlsEndOfList is thrown.
Iterator& shrinkBefore();
This member function removes the last item read from the list. Restrictions of the same kind as those mentioned for shrink apply to shrinkBefore.
If this function is called when the minimal cardinality of the list has been reached, then the exception IlsMinCardViolated is thrown. If it is called when the iterator points to the first item of the list, then the exception IlsBeginningOfList is thrown.
Position tellp();
This member function returns the position of the iterator.
Iterator& seekp(const Position& position);
This member function moves the iterator to the specified position.
Iterator& reset();
This member function resets the iterator so that it points again to the first item of the list.
Iterator& gotoEnd();
This member function moves the iterator to the end of the list.
Operators 
Iterator& operator<<(OriginType*);
This operator adds an item to the list and puts it after the last item read by the iterator or at the beginning of the list if the iterator has not yet been used. If several iterators have been declared for the same list, be careful when you use one of these iterators to add an item to the list. Let us suppose that iw is an iterator that performs write operations and ir is an iterator that performs read operations. If ir and iw point to the same item in the list and if iw is used to add an item to this list, ir may behave unexpectedly.
Attempting to add an item to the list when the maximum cardinality has been reached causes the exception IlsMaxCardViolated to be thrown.
Iterator& operator>>(OriginType*&);
This operator sequentially reads the items in the list. When the iterator is used for the first time, the item read is the one at the beginning of the list. If the iterator has reached the last item in the list, and if the list is not empty, no value is assigned to the argument of the operator during the next read operation. The conversion operator to IlsBoolean returns IlsFalse. (See operator IlsBoolean.) If an iterator is built for an empty list, the conversion operator of the iterator returns IlsFalse.
Iterator& operator++();
This increment operator moves the iterator to the next item in the list. If the iterator is moved past the last list item, the exception IlsEndOfList is thrown.
Iterator& operator++(int);
This operator is identical to the previous one except that it uses a prefix notation.
Iterator& operator--();
This operator moves the iterator to the previous item in the list. If the iterator is moved past the first list item, the exception IlsBeginningOfList is thrown.
Iterator& operator--(int);
This operator is identical to the previous one except that it uses a prefix notation.
Iterator& operator=(const Position&);
This operator assigns the position provided as its argument to another position and returns the position supplied.
Iterator& operator=(const Iterator&);
This operator moves the iterator to the same position as the one supplied as its argument.
OriginType* operator*() const;
This operator returns the next item to be read. The iterator remains at the same position.
IlsBoolean operator==(const Iterator&);
This operator indicates whether the iterator is at the same position as the one supplied as its argument.
IlsBoolean operator!=(const Iterator&);
This operator indicates whether the iterator is not at the same position as the one supplied as its argument.
Position operator+(int);
This operator moves the iterator forward in the list according to the value supplied as its argument. If the iterator is moved past the last list item, the exception IlsEndOfList is thrown.
Position operator-(int);
This operator moves the iterator backward in the list according to the value supplied as its argument. If the iterator is moved past the first list item, the exception IlsBeginningOfList is thrown.
Iterator& operator+=(int i);
This operator moves the iterator forward according to the value supplied as its argument. If the value provided moves the iterator past the last list item, the exception IlsEndOfList is thrown.
Iterator& operator-=(int i);
This operator moves the iterator backward according to the value supplied as its argument. If the value provided moves the iterator past the first list item, the exception IlsBeginningOfList is thrown.
IlsBoolean eol()const;
This operator returns IlsTrue if the end of the list has been reached.
OriginType* operator[](int i);
This operator returns the i-th list element.
operator IlsBoolean();
This conversion operator indicates whether the iterator has reached the end of the list. It returns IlsFalse if the list is empty, or if at least one unsuccessful extraction has been performed.
See Also 
Exceptions, IlsInvertedRelationList, IlsInvertedRelationList::ConstIterator, IlsInvertedRelationList::Position

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.