casa
$Rev:20696$
|
Doubly linked list. More...
#include <List.h>
Public Types | |
enum | { ListVersion } |
List version. More... | |
Public Member Functions | |
List () | |
Creates an empty list. | |
List (const List< t > &other) | |
Copy Semantics. | |
List (const List< t > *other) | |
List< t > & | operator= (const List< t > &other) |
List< t > & | operator= (const List< t > *other) |
~List () | |
*display 4 | |
uInt | len () const |
Returns the length of the list. | |
Protected Member Functions | |
virtual void | added (Link< t > *, Link< t > *) |
Updates the extreme pointers, head or tail under the appropriate conditions. | |
virtual void | removed (Link< t > *, Link< t > *, Link< t > *) |
Protected Attributes | |
Link< t > * | head |
Link< t > * | tail |
uInt | length |
Friends | |
class | ConstListIter< t > |
class | ListIter< t > |
Doubly linked list.
Public interface
This class is a container which by itself has little functionality because the iteration functionality is contained in the iterator classes, ListIter and ConstListIterr . These iterator classes allow traversal, insertion into list, and removal from the list.
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.
#include <casa/Containers/List.h> #include <casa/Containers/ListIO.h> main() { // List, conceptual // cursor = "|" ListIter<int> list(new List<int>(),True); // | list.addRight(12); // | 12 list.addRight(2); // | 2 12 list.addRight(89); // | 89 2 12 list++; // 89 | 2 12 list.addRight(10); // 89 | 10 2 12 list++; // 89 10 | 2 12 list.addRight(8); // 89 10 | 8 2 12 list--; // 89 | 10 8 2 12 list.pos(0); // | 89 10 8 2 12 list.pos(5); // 89 10 8 2 12 | list.pos(4); // 89 10 8 2 | 12 list.step(3); // 89 | 10 8 2 12 list.step(); // 89 10 | 8 2 12 list.step(-4); // 89 10 8 2 | 12 list.removeRight(); // 89 10 8 2 | cout << list << endl; return 0; }
The output from this example looks like:
len=4 pos=4 89 10 8 2
anonymous enum |
casa::List< t >::List | ( | ) | [inline] |
casa::List< t >::List | ( | const List< t > & | other | ) |
Copy Semantics.
casa::List< t >::List | ( | const List< t > * | other | ) |
casa::List< t >::~List | ( | ) |
*display 4
Destructs the list.
virtual void casa::List< t >::added | ( | Link< t > * | , |
Link< t > * | |||
) | [protected, virtual] |
Updates the extreme pointers, head or tail under the appropriate conditions.
uInt casa::List< t >::len | ( | ) | const [inline] |
Returns the length of the list.
Definition at line 209 of file List.h.
Referenced by casa::MultiWCHolder::nWCHs().
List<t>& casa::List< t >::operator= | ( | const List< t > & | other | ) |
List<t>& casa::List< t >::operator= | ( | const List< t > * | other | ) |
virtual void casa::List< t >::removed | ( | Link< t > * | , |
Link< t > * | , | ||
Link< t > * | |||
) | [protected, virtual] |
friend class ConstListIter< t > [friend] |
Link<t>* casa::List< t >::head [protected] |
uInt casa::List< t >::length [protected] |
Definition at line 219 of file List.h.
Referenced by casa::List< WorldCanvasHolder * >::len().
Link<t>* casa::List< t >::tail [protected] |