Go to the documentation of this file.
31 #ifndef AIPS_USE_DEPRECATED
32 #error "List.h is deprecated; use -DBUILD_DEPRECATED=ON to use it"
36 #include <casacore/casa/aips.h>
37 #include <casacore/casa/Utilities/Register.h>
38 #include <casacore/casa/Utilities/Notice.h>
39 #include <casacore/casa/Containers/Link.h>
40 #include <casacore/casa/Utilities/Assert.h>
41 #include <casacore/casa/Containers/IterError.h>
55 template<
class t>
class List;
186 template<
class t>
class List :
public NoticeSource
188 friend class ConstListIter<t>;
189 friend class ListIter<t>;
410 prev = (*prev).prev();
417 prev = (*prev).prev();
440 return (*container_).length;}
455 toffset = offset < 0 && -offset >
Int(
curPos) ? -((-
curPos - offset) % ((*container_).length + 1))
456 : (
curPos + offset) % ((*container_).length + 1);
457 return(
pos(toffset >= 0 ? toffset : (*container_).length + toffset + 1));}
468 return((*cur).val());}
501 prev = (*container_).tail;
503 curPos = (*container_).length;
651 this->cur =
newLink(
e,this->prev,this->cur);
653 (*this->container_).added(this->prev,this->cur);
656 (*this->container_).notify(state);
682 return((*this->cur).val());}
756 #ifndef CASACORE_NO_AUTO_TEMPLATES
757 #include <casacore/casa/Containers/List.tcc>
758 #endif //# CASACORE_NO_AUTO_TEMPLATES
ListIter()
This is the default constructor.
ConstListIter< t > & operator=(const List< t > &)
ConstListIter(const List< t > *st)
This constructor creates a "ConstListIter" which tracks the "List<t>" parameter.
List< t > & operator=(const List< t > &other)
abstract base class for notices
ListIter(const ListIter< t > &other)
These constructors allow for the creation of a ListIter from another ListIter.
void throw_list_end_error()
The function which throws an exception for advancing the internal cursor past the end of a list.
virtual ConstListIter< t > & operator=(const 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 cur...
doubly linked list primitive
const t & getRight() const
ConstListIter< t > & operator=(const ConstListIter< t > &)
void throw_list_swapright_same_error()
ListIter(List< t > &st)
This constructor allows one to construct a ListIter and attach it to the List parameter.
uInt type() const
This function returns the Notice "type", which is retrieved from the "type registry".
Doubly linked non-constant list iterator The List class above only provides for the list framework....
ConstListIter< t > & operator=(const ConstListIter< t > *)
const t & getRight() const
Returns the element to the right of the cursor.
void addRight(t e)
This function adds the element to the right of the current cursor position.
Bool atStart() const
This functions allows one to checked if the cursor is at an extreme list position.
abstract base class for notice receptors
ConstListIter(const ConstListIter< t > &other)
This constructor creates a "ConstListIter" which tracks the same list tracked by the "ConstListIter<t...
Doubly linked constant list iterator.
List(const List< t > *other)
virtual Link< t > * newLink(t &e, Link< t > *p=0, Link< t > *n=0)
Link< t > * cur
enum outside class because of compiler errors on HPUX enum {ConstListIterVersion = 1};
Linked list update notice.
void operator++()
This function is used to step the cursor forward through the list.
void operator--()
This function allow for stepping the cursor toward the front of the list.
virtual void removed(Link< t > *, Link< t > *, Link< t > *)
t & getRight()
Returns the element to the right of the cursor.
virtual void added(Link< t > *, Link< t > *)
Updates the extreme pointers, head or tail under the appropriate conditions.
void throw_list_init_error()
ConstListIter(const ConstListIter< t > *other)
virtual void swapRight(ListIter< t > &)
This function swaps the list section after the current position of the list with the right section of...
virtual ListIter< t > & operator=(List< t > &other)
This assignment operator changes the List which this iterator tracks to the List parameter.
Invalide iteration error class.
void toStart()
This function moves the cursor to the beginning of the list.
ListIter(List< t > *st, Bool OWN=False)
This constructor allows one to construct a ListIter and attach it to the List parameter.
const List< t > * container() const
Get the container over which we are iterating, could be null...
List(const List< t > &other)
Copy Semantics.
void throw_list_start_error()
base class for notice originators
int operator==(const Notice &op) const
This operator can be used to compare two ListNotices.
this file contains all the compiler specific defines
void removeRight()
This function removes the element to the right of the current cursor position.
List()
Creates an empty list.
virtual ListIter< t > & operator=(const ListIter< t > *other)
virtual ConstListIter< t > & operator=(const List< t > &other)
This assignment operator substitutes the "List<t>" tracked by this iterator to the "List<t>" passed a...
#define AlwaysAssert(expr, exception)
These marcos are provided for use instead of simply using the constructors of assert_ to allow additi...
ListIter(const ListIter< t > *other)
virtual ConstListIter< t > & operator=(const ConstListIter< t > &other)
This assignment operator substitutes the "List<t>" tracked by this iterator to the "List<t>" tracked ...
const Double c
Fundamental physical constants (SI units):
virtual ConstListIter< t > & operator=(const ConstListIter< t > *other)
uInt len() const
Returns the length of the list.
ConstListIter< t > & operator=(const List< t > *)
ListNotice()
This constructor is used to initialize a notice for a deleted "List".
ListNotice(modification m, Link< t > *oc, Link< t > *op, Link< t > *nc, Link< t > *np, int of, int nf=0)
This is used to construct a list notice.
const Double e
e and functions thereof:
ConstListIter(const List< t > &st)
uInt step(Int offset)
"step()" with no parameters advances the cursor forward one element.
virtual ListIter< t > & operator=(List< t > *other)
List< t > & operator=(const List< t > *other)
bool Bool
Define the standard types used by Casacore.
Bool own
Indicates if this iterator "owns" the container it observes.
void notify(const Notice &)
uInt len() const
This function returns the number of elements in the list.
virtual uInt pos(uInt)
"pos()" without arguments returns the current postion of the cursor.
void toEnd()
This function moves the cursor to the end of the list.
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 delet...
ConstListIter()
This is the default constructor.