- DELETE
- ADD
- REMOVE
- SWAP
This function returns the Notice "type", which is retrieved from the "type registry". The registry information is maintained automatically by the Notice constructors. A form of run time type information, this function is mostly intended for advanced users.
This operator can be used to compare two ListNotices.
This is used to construct a list notice. The parameters are:
This constructor is used to initialize a notice for a deleted "List".
- ListVersion = 2
This group of classes, List and iterators, was designed to allow multiple iterators to manipulate a list at the same time. However, if only one iterator is required the simple example below shows how a simple list can be created and used without complication. The more complete example below demonstrates all of the functionality of the List classes.
Creates an empty list.
Copy Semantics
Destructs the list.
Returns the length of the list.
List version
Updates the extreme pointers, head or tail under the appropriate conditions
All of the operations take place to the right of a conceptual cursor. The cursor starts out before the first element of the list and can be incremented past the last element of the list. Going further than the end of the list results in an exception.
void iterate(ListIter<int> &list) { // List, conceptual // cursor = "|" ConstListIter<int> li = list; // 89 10 8 2 | li--; // 89 10 8 | 2 cout << li.getRight() << " "; // 89 10 8 | 2 li--; // 89 10 | 8 2 li.pos(0); // | 89 10 8 2 li.pos(3); // 89 10 8 | 2 li.pos(1); // 89 | 10 8 2 li.step(); // 89 10 | 8 2 li.pos(0); // | 89 10 8 2 li.step(-3); // 89 10 | 8 2 cout << li.getRight() << endl; // 89 10 | 8 2 cout << li << endl; // 89 10 | 8 2 }The output which this function, iterate(), would produce would look like:
2 8 len=4 pos=2 89 10 8 2
As shown above:
This class uses the Notice classes to implement "dynamic" cursors so that multiple cursors are updated as elements are added and removed from the list.
This constructor creates a "ConstListIter" which tracks the
"List
This constructor creates a "ConstListIter" which tracks the
same list tracked by the "ConstListIter
This is the default constructor. It allows one
to create an initially invalid empty ConstListIter. The instantiated
class will accept assignment and thus become valid later.
Destructor doesn\'t do anything special because
all of the "real" information is in the "List
This function is the hook through which iterators
are notified of important changes to the underlying
list. For advanced users.
This functions allows one to checked if the cursor
is at an extreme list position. "atStart()" checks
to see if the cursor is at the beginning of the list,
and "atEnd()" checks to see if the cursor is at the
end of the list.
This function is used to step the cursor forward through
the list.
This function allow for stepping the cursor toward the
front of the list.
"pos()" without arguments returns the current postion
of the cursor.
"pos()" with an unsigned integer parameter
moves the cursor to an absolute position.
This function returns the number of elements in the list.
"step()" with no parameters advances the cursor forward
one element.
"step()" with a signed integer parameter moves the cursor
(forward or backward) by a relative offset indicated by the
parameter.
Returns the element to the right of the cursor.
This assignment operator substitutes the "List
This assignment operator substitutes the "List
This function moves the cursor to the beginning of the list.
This function moves the cursor to the end of the list.
Get the container over which we are iterating, could be null...
The List class above only provides for
the list framework. This is one of two classes which allow list
iteration, insertion, and removal. This class can be
used to modify a list. Unlike
ConstListIter, this class can
insert and remove elements from a list as well as look at
or observe a list. ConstListIter
should be used whenever the list is not modified.
All of the operations take place to the right of a conceptual cursor.
The cursor starts out before the first element of the list and can
be incremented past the last element of the list. Going further than
the end of the list results in an exception. All additions and deletions
occur to the right of this conceptual cursor. In addition, this class
uses the Notice class to ensure that multiple
iterators which are observing the same list are updated as the list
changes. This is important when multiple iterators are used.
This constructor allows one to construct a ListIter and
attach it to the List parameter. The own flag can be
set to indicate that the List should be destroyed when
the ListIter is deleted.
This constructor allows one to construct a ListIter and
attach it to the List parameter.
These constructors allow for the creation of a ListIter from
another ListIter. This will attach this ListIter to the List
tracked by the ListIter parameter at the time of construction.
This is the default constructor. It allows one
to create an initially invalid empty ListIter. The instantiated
class will accept assignment and thus become valid later.
This function adds the element to the right of the
current cursor position.
This function removes the element to the right of the
current cursor position.
This function swaps the list section after the
current position of the list with the right section
of the list of another iterator. This can be
particularly useful for "remembering" the position
of a cursor in a list.
Returns the element to the right of the cursor.
This function changes the List
which this ListIter tracks and specifies that the List
should be deleted when this iterator is deleted.
This assignment operator changes the List which this
iterator tracks to the List parameter.
These assignment operators allow one to change the List
to which this iterator tracks to the List currently associated
with the argument ListIter.
This function creates a new link. By separating link
creation out into "newLink", the "addRight(t)"
functionality can be performed in the base class.
ConstListIter(const ConstListIter<t> &other) : NoticeTarget((NoticeTarget &)other), cur(other.cur), prev(other.prev), curPos(other.curPos), container_(other.container_)
ConstListIter(const ConstListIter<t> *other)
ConstListIter() : NoticeTarget(),cur(0), prev(0), curPos(0), container_(0)
~ConstListIter()
void notify(const Notice &)
Bool atStart() const
Bool atEnd() const
void operator++()
inline void operator++(int)
void operator--()
void operator--(int)
virtual uInt pos(uInt)
uInt pos() const
uInt len() const
inline uInt step(Int offset)
inline uInt step()
const t &getRight() const
virtual ConstListIter<t> &operator=(const List<t> &other)
virtual ConstListIter<t> &operator=(const List<t> *other)
virtual ConstListIter<t> &operator=(const ConstListIter<t> &other)
virtual ConstListIter<t> &operator=(const ConstListIter<t> *other)
void toStart()
void toEnd()
const List<t> *container() const
template<class t> class ListIter : virtual public ConstListIter<t>
Interface
Description
This class uses the "Notice" classes to implement "dynamic" cursors
so that multiple cursors are updated as elements are added and
removed from the list.
Member Description
ListIter(List<t> *st, Bool OWN = False) : ConstListIter<t>(st), own(OWN)
ListIter(List<t> &st)
ListIter(const ListIter<t> &other)
ListIter(const ListIter<t> *other) : ConstListIter<t>(other), own(False)
ListIter() : ConstListIter<t>()
void addRight(t e)
void removeRight()
virtual void swapRight(ListIter<t> &)
t &getRight()
const t &getRight() const
virtual ListIter<t> &assign(List<t> *other,Bool OWN = False)
virtual ListIter<t> &operator=(List<t> &other)
virtual ListIter<t> &operator=(List<t> *other)
virtual ListIter<t> &operator=(const ListIter<t> &other)
virtual ListIter<t> &operator=(const ListIter<t> *other)
~ListIter()
virtual Link<t> *newLink(t &e, Link<t> *p=0, Link<t> *n=0)
ConstListIter<t> &operator=(const List<t> &)
These functions are for internal use. They ONLY throw an exception
to prevent improper initialization of a constant OrderedMapIter.
ConstListIter<t> &operator=(const List<t> *)
ConstListIter<t> &operator=(const ConstListIter<t> &)
ConstListIter<t> &operator=(const ConstListIter<t> *)