casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
casacore::List< t > Class Template Reference

Doubly linked list. More...

#include <List.h>

Inheritance diagram for casacore::List< t >:
casacore::NoticeSource

Public Types

enum  { ListVersion }
 List version. More...
 

Public Member Functions

 List ()
 Creates an empty list. More...
 
 List (const List< t > &other)
 Copy Semantics. More...
 
 List (const List< t > *other)
 
List< t > & operator= (const List< t > &other)
 
List< t > & operator= (const List< t > *other)
 
 ~List ()
 display 4 More...
 
uInt len () const
 Returns the length of the list. More...
 
- Public Member Functions inherited from casacore::NoticeSource
 NoticeSource ()
 
virtual ~NoticeSource ()
 
void notify (const Notice &note)
 Sends the note to all NoticeTargets in the target list. More...
 

Protected Member Functions

virtual void added (Link< t > *, Link< t > *)
 Updates the extreme pointers, head or tail under the appropriate conditions. More...
 
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 >
 

Detailed Description

template<class t>
class casacore::List< t >

Doubly linked list.

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

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.

Example

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
 

Definition at line 55 of file List.h.

Member Enumeration Documentation

template<class t>
anonymous enum

List version.

Enumerator
ListVersion 

Definition at line 218 of file List.h.

Constructor & Destructor Documentation

template<class t>
casacore::List< t >::List ( )
inline

Creates an empty list.

Definition at line 194 of file List.h.

template<class t>
casacore::List< t >::List ( const List< t > &  other)

Copy Semantics.

template<class t>
casacore::List< t >::List ( const List< t > *  other)
template<class t>
casacore::List< t >::~List ( )

display 4

Destructs the list.

Member Function Documentation

template<class t>
virtual void casacore::List< t >::added ( Link< t > *  ,
Link< t > *   
)
protectedvirtual

Updates the extreme pointers, head or tail under the appropriate conditions.

template<class t>
uInt casacore::List< t >::len ( ) const
inline

Returns the length of the list.

Definition at line 213 of file List.h.

Referenced by ConstMirPolSetup::getCorrCount(), MirPolRecps::getPolCount(), and MirSource::offSource().

template<class t>
List<t>& casacore::List< t >::operator= ( const List< t > &  other)
template<class t>
List<t>& casacore::List< t >::operator= ( const List< t > *  other)
template<class t>
virtual void casacore::List< t >::removed ( Link< t > *  ,
Link< t > *  ,
Link< t > *   
)
protectedvirtual

Friends And Related Function Documentation

template<class t>
friend class ConstListIter< t >
friend

Definition at line 188 of file List.h.

template<class t>
friend class ListIter< t >
friend

Definition at line 189 of file List.h.

Member Data Documentation

template<class t>
Link<t>* casacore::List< t >::head
protected

Definition at line 221 of file List.h.

template<class t>
uInt casacore::List< t >::length
protected

Definition at line 223 of file List.h.

Referenced by casacore::List< MirFreqSetup * >::len().

template<class t>
Link<t>* casacore::List< t >::tail
protected

Definition at line 222 of file List.h.


The documentation for this class was generated from the following file: