casacore
|
Doubly linked non-constant list iterator The List class above only provides for the list framework. More...
#include <List.h>
Public Member Functions | |
ListIter (List< t > *st, Bool OWN=False) | |
This constructor allows one to construct a ListIter and attach it to the List parameter. More... | |
ListIter (List< t > &st) | |
This constructor allows one to construct a ListIter and attach it to the List parameter. More... | |
ListIter (const ListIter< t > &other) | |
These constructors allow for the creation of a ListIter from another ListIter. More... | |
ListIter (const ListIter< t > *other) | |
ListIter () | |
This is the default constructor. More... | |
void | addRight (t e) |
This function adds the element to the right of the current cursor position. More... | |
void | removeRight () |
This function removes the element to the right of the current cursor position. More... | |
virtual void | swapRight (ListIter< t > &) |
This function swaps the list section after the current position of the list with the right section of the list of another iterator. More... | |
t & | getRight () |
Returns the element to the right of the cursor. More... | |
const t & | getRight () const |
virtual ListIter< t > & | assign (List< t > *other, Bool OWN=False) |
This function changes the List which this ListIter tracks and specifies that the List should be deleted when this iterator is deleted. More... | |
virtual ListIter< t > & | operator= (List< t > &other) |
This assignment operator changes the List which this iterator tracks to the List parameter. More... | |
virtual ListIter< t > & | operator= (List< t > *other) |
virtual ListIter< t > & | operator= (const ListIter< t > &other) |
These assignment operators allow one to change the List to which this iterator tracks to the List currently associated with the argument ListIter. More... | |
virtual ListIter< t > & | operator= (const ListIter< t > *other) |
~ListIter () | |
Public Member Functions inherited from casacore::ConstListIter< t > | |
ConstListIter (const List< t > *st) | |
This constructor creates a "ConstListIter" which tracks the "List<t>" parameter. More... | |
ConstListIter (const List< t > &st) | |
ConstListIter (const ConstListIter< t > &other) | |
This constructor creates a "ConstListIter" which tracks the same list tracked by the "ConstListIter<t>" parameter. More... | |
ConstListIter (const ConstListIter< t > *other) | |
ConstListIter () | |
This is the default constructor. More... | |
~ConstListIter () | |
void | notify (const Notice &) |
Hook through which NoticeTarget s are notified (by NoticeSource s). More... | |
Bool | atStart () const |
This functions allows one to checked if the cursor is at an extreme list position. More... | |
Bool | atEnd () const |
void | operator++ () |
This function is used to step the cursor forward through the list. More... | |
void | operator++ (int) |
void | operator-- () |
This function allow for stepping the cursor toward the front of the list. More... | |
void | operator-- (int) |
virtual uInt | pos (uInt) |
"pos()" without arguments returns the current postion of the cursor. More... | |
uInt | pos () const |
uInt | len () const |
This function returns the number of elements in the list. More... | |
uInt | step (Int offset) |
"step()" with no parameters advances the cursor forward one element. More... | |
uInt | step () |
const t & | getRight () const |
Returns the element to the right of the cursor. More... | |
void | toStart () |
This function moves the cursor to the beginning of the list. More... | |
void | toEnd () |
This function moves the cursor to the end of the list. More... | |
const List< t > * | container () const |
Get the container over which we are iterating, could be null... More... | |
Public Member Functions inherited from casacore::NoticeTarget | |
virtual | ~NoticeTarget () |
Destructs this NoticeTarget . More... | |
Bool | isValid () const |
Returns a boolean value telling whether this NoticeTarget is still "valid". More... | |
Bool | isAttached () const |
Returns a boolean value telling whether this NoticeTarget is still attached to a NoticeSource or not. More... | |
void | invalidate () |
Makes the current NoticeTarget "invalid". More... | |
Protected Member Functions | |
virtual Link< t > * | newLink (t &e, Link< t > *p=0, Link< t > *n=0) |
Protected Member Functions inherited from casacore::NoticeTarget | |
NoticeTarget () | |
Creates an unlinked, "invalid" NoticeTarget . More... | |
NoticeTarget (NoticeSource *v) | |
Creates a "valid" NoticeTarget linked to the specified NoticeSource . More... | |
NoticeTarget (NoticeSource &v) | |
NoticeTarget (NoticeTarget &other) | |
Creates a "valid" NoticeTarget linked to the same NoticeSource as the other NoticeTarget . More... | |
NoticeTarget (NoticeTarget *other) | |
void | unlink () |
Unlinks this NoticeTarget from its NoticeSource . More... | |
void | link (const NoticeTarget &other) |
Links this NoticeTarget to the same NoticeSource as the other NoticeTarget . More... | |
void | link (const NoticeTarget *other) |
Link< NoticeTarget * > * | next () |
Retrieves the next NoticeTarget in the target list of the associated NoticeSource . More... | |
const Link< NoticeTarget * > * | next () const |
void | attach (NoticeSource *v) |
Adds this NoticeTarget to the target list in the specified NoticeSource , so that it will receive all notices sent out by that NoticeSource . More... | |
void | attach (NoticeSource &v) |
Protected Attributes | |
Bool | own |
Indicates if this iterator "owns" the container it observes. More... | |
Protected Attributes inherited from casacore::ConstListIter< t > | |
Link< t > * | cur |
enum outside class because of compiler errors on HPUX enum {ConstListIterVersion = 1}; More... | |
Link< t > * | prev |
uInt | curPos |
List< t > * | container_ |
Protected Attributes inherited from casacore::NoticeTarget | |
Link< NoticeTarget * > * | ilink |
NoticeSource * | container |
Bool | valid |
Private Member Functions | |
ConstListIter< t > & | operator= (const List< t > &) |
This assignment operator substitutes the "List<t>" tracked by this iterator to the "List<t>" passed as an argument. More... | |
ConstListIter< t > & | operator= (const List< t > *) |
ConstListIter< t > & | operator= (const ConstListIter< t > &) |
This assignment operator substitutes the "List<t>" tracked by this iterator to the "List<t>" tracked by the passed "ConstListIter<t>" argument. More... | |
ConstListIter< t > & | operator= (const ConstListIter< t > *) |
Doubly linked non-constant list iterator 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.
The output from this example would look like:
89 89 21 21 2 2 2 17 2 17 one: len=5 pos=2 21 17 2 12 18 two: len=5 pos=4 21 17 2 12 18 three: len=5 pos=0 21 17 2 12 18
Tip: 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;
|
inline |
casacore::ListIter< t >::ListIter | ( | List< t > & | st | ) |
casacore::ListIter< t >::ListIter | ( | const ListIter< t > & | other | ) |
|
inline |
|
inline |
casacore::ListIter< t >::~ListIter | ( | ) |
|
inline |
This function adds the element to the right of the current cursor position.
Allow container to update
Definition at line 647 of file List.h.
References AlwaysAssert, casacore::C::c, casacore::ConstListIter< t >::container_, casacore::ConstListIter< t >::cur, casacore::ConstListIter< t >::curPos, casacore::NoticeTarget::isValid(), casacore::ListIter< t >::newLink(), casacore::ConstListIter< t >::notify(), and casacore::ConstListIter< t >::prev.
|
virtual |
|
inline |
Returns the element to the right of the cursor.
Definition at line 679 of file List.h.
References AlwaysAssert, casacore::ConstListIter< t >::cur, casacore::NoticeTarget::isValid(), and casacore::throw_list_end_error().
|
inline |
|
protectedvirtual |
Referenced by casacore::ListIter< t >::addRight().
|
privatevirtual |
This assignment operator substitutes the "List<t>" tracked by this iterator to the "List<t>" tracked by the passed "ConstListIter<t>" argument.
Reimplemented from casacore::ConstListIter< t >.
|
privatevirtual |
Reimplemented from casacore::ConstListIter< t >.
|
privatevirtual |
This assignment operator substitutes the "List<t>" tracked by this iterator to the "List<t>" passed as an argument.
Reimplemented from casacore::ConstListIter< t >.
|
privatevirtual |
Reimplemented from casacore::ConstListIter< t >.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
void casacore::ListIter< t >::removeRight | ( | ) |
This function removes the element to the right of the current cursor position.
|
virtual |
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.
|
protected |