33 #include <casacore/casa/aips.h> 34 #include <casacore/casa/Utilities/Register.h> 35 #include <casacore/casa/Utilities/Notice.h> 36 #include <casacore/casa/Containers/Link.h> 37 #include <casacore/casa/Utilities/Assert.h> 38 #include <casacore/casa/Containers/IterError.h> 52 template<
class t>
class List;
113 mod(m),oprev(op),ocur(oc),nprev(np),ncur(nc), off(of), otherOff(nf) {}
120 nprev(0),ncur(0),off(0),otherOff(0) {}
215 enum {ListVersion = 2};
315 cur(st.head), prev(0), curPos(0),
316 container_((
List<t> *) (&st))
327 cur(other.cur), prev(other.prev), curPos(other.curPos),
328 container_(other.container_) {}
355 void notify(
const Notice &);
367 if (prev == 0)
return True;
372 if (cur == 0)
return True;
407 prev = (*prev).prev();
414 prev = (*prev).prev();
437 return (*container_).length;}
452 toffset = offset < 0 && -offset >
Int(curPos) ? -((- curPos - offset) % ((*container_).length + 1))
453 : (curPos + offset) % ((*container_).length + 1);
454 return(pos(toffset >= 0 ? toffset : (*container_).length + toffset + 1));}
465 return((*cur).val());}
491 cur = (*container_).head; prev = 0; curPos = 0;}
498 prev = (*container_).tail;
500 curPos = (*container_).length;
648 this->cur = newLink(e,this->prev,this->cur);
650 (*this->container_).added(this->prev,this->cur);
653 (*this->container_).notify(state);
679 return((*this->cur).val());}
753 #ifndef CASACORE_NO_AUTO_TEMPLATES 754 #include <casacore/casa/Containers/List.tcc> 755 #endif //# CASACORE_NO_AUTO_TEMPLATES doubly linked list primitive
t & getRight()
Returns the element to the right of the cursor.
ConstListIter(const ConstListIter< t > &other)
This constructor creates a "ConstListIter" which tracks the same list tracked by the "ConstListIter<t...
Bool atStart() const
This functions allows one to checked if the cursor is at an extreme list position.
abstract base class for notice receptors
ListIter(List< t > *st, Bool OWN=False)
This constructor allows one to construct a ListIter and attach it to the List parameter.
Link< t > * cur
enum outside class because of compiler errors on HPUX enum {ConstListIterVersion = 1}; ...
void operator--()
This function allow for stepping the cursor toward the front of the 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.
ListNotice()
This constructor is used to initialize a notice for a deleted "List".
PtrHolder< T > & operator=(const PtrHolder< T > &other)
List()
Creates an empty list.
Doubly linked constant list iterator.
const List< t > * container() const
Get the container over which we are iterating, could be null...
void throw_list_init_error()
base class for notice originators
void throw_list_swapright_same_error()
uInt len() const
Returns the length of the list.
void toEnd()
This function moves the cursor to the end of the list.
const t & getRight() const
uInt step(Int offset)
"step()" with no parameters advances the cursor forward one element.
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
int operator==(const Notice &op) const
This operator can be used to compare two ListNotices.
#define AlwaysAssert(expr, exception)
These marcos are provided for use instead of simply using the constructors of assert_ to allow additi...
bool Bool
Define the standard types used by Casacore.
abstract base class for notices
Linked list update notice.
ConstListIter()
This is the default constructor.
ConstListIter(const List< t > &st)
void addRight(t e)
This function adds the element to the right of the current cursor position.
void operator++()
This function is used to step the cursor forward through the list.
ListIter(const ListIter< t > *other)
uInt len() const
This function returns the number of elements in the list.
const Double e
e and functions thereof:
void throw_list_end_error()
The function which throws an exception for advancing the internal cursor past the end of a list...
Doubly linked non-constant list iterator The List class above only provides for the list framework...
const Double c
Fundamental physical constants (SI units):
uInt type() const
This function returns the Notice "type", which is retrieved from the "type registry".
const t & getRight() const
Returns the element to the right of the cursor.
Bool own
Indicates if this iterator "owns" the container it observes.
void toStart()
This function moves the cursor to the beginning of the list.
this file contains all the compiler specific defines
void throw_list_start_error()
ListIter()
This is the default constructor.
Invalide iteration error class.