Edinburgh Speech Tools  2.1-release
EST_TList< T > Class Template Reference

#include <include/EST_TList.h>

Inheritance diagram for EST_TList< T >:
Collaboration diagram for EST_TList< T >:

Classes

class  IPointer
 

Public Types

typedef T Entry
 
typedef EST_TIterator< EST_TList< T >, IPointer, T > Entries
 
typedef EST_TRwIterator< EST_TList< T >, IPointer, T > RwEntries
 

Public Member Functions

void init ()
 
Constructor functions
 EST_TList ()
 default constructor More...
 
 EST_TList (const EST_TList< T > &l)
 copy constructor More...
 
 ~EST_TList ()
 
Access functions for reading and writing items.

See EST_TList_Accessing for examples.

T & item (const EST_Litem *p)
 
const T & item (const EST_Litem *p) const
 
T & nth (int n)
 return the Nth value More...
 
const T & nth (int n) const
 return a const Nth value More...
 
const T & first () const
 return const reference to first item in list More...
 
const T & last () const
 return const reference to last item in list More...
 
T & first ()
 
T & last ()
 return reference to last item in list More...
 
const T & operator() (const EST_Litem *ptr) const
 return const reference to item in list pointed to by ptr More...
 
T & operator() (const EST_Litem *ptr)
 return non-const reference to item in list pointed to by ptr More...
 
Removing items in a list.
EST_Litemremove (EST_Litem *ptr)
 
EST_Litemremove_nth (int n)
 remove nth item, return pointer to previous item More...
 
Adding items to a list.

In all cases, a complete copy of the item is made and added to the list. See Addition for examples.

void append (const T &item)
 add item onto end of list More...
 
void prepend (const T &item)
 add item onto start of list More...
 
EST_Liteminsert_after (EST_Litem *ptr, const T &item)
 
EST_Liteminsert_before (EST_Litem *ptr, const T &item)
 
- Public Member Functions inherited from EST_UList
 EST_UList ()
 
virtual ~EST_UList ()
 
EST_UItemnth_pointer (int n) const
 
EST_UIteminsert_after (EST_UItem *ptr, EST_UItem *new_item)
 
EST_UIteminsert_before (EST_UItem *ptr, EST_UItem *new_item)
 
EST_UItemremove (EST_UItem *ptr, void(*item_free)(EST_UItem *item))
 
EST_UItemremove (int n, void(*item_free)(EST_UItem *item))
 
void exchange (EST_UItem *a, EST_UItem *b)
 
void exchange (int i, int j)
 
void reverse ()
 
int length () const
 
int index (EST_UItem *item) const
 
int empty () const
 
void clear (void)
 
void append (EST_UItem *item)
 
void prepend (EST_UItem *item)
 
EST_UItemhead () const
 
EST_UItemtail () const
 

Static Public Member Functions

static void free_item (EST_UItem *item)
 
- Static Public Member Functions inherited from EST_UList
static bool operator_eq (const EST_UList &a, const EST_UList &b, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2))
 
static int index (const EST_UList &l, const EST_UItem &b, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2))
 
static void sort (EST_UList &a, bool(*gt)(const EST_UItem *item1, const EST_UItem *item2))
 
static void qsort (EST_UList &a, bool(*gt)(const EST_UItem *item1, const EST_UItem *item2), void(*exchange)(EST_UItem *item1, EST_UItem *item2))
 
static void sort_unique (EST_UList &l, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2), bool(*gt)(const EST_UItem *item1, const EST_UItem *item2), void(*item_free)(EST_UItem *item))
 
static void merge_sort_unique (EST_UList &l, EST_UList &m, bool(*eq)(const EST_UItem *item1, const EST_UItem *item2), bool(*gt)(const EST_UItem *item1, const EST_UItem *item2), void(*item_free)(EST_UItem *item))
 

Protected Member Functions

void point_to_first (IPointer &ip) const
 
void move_pointer_forwards (IPointer &ip) const
 
bool points_to_something (const IPointer &ip) const
 
T & points_at (const IPointer &ip)
 
- Protected Member Functions inherited from EST_UList
void init ()
 
void clear_and_free (void(*item_free)(EST_UItem *item))
 

Friends

class EST_TIterator< EST_TList< T >, IPointer, T >
 
class EST_TRwIterator< EST_TList< T >, IPointer, T >
 

Exchange

void exchange (EST_Litem *a, EST_Litem *b)
 exchange 1 More...
 
void exchange (int i, int j)
 exchange 2 More...
 
static void exchange_contents (EST_Litem *a, EST_Litem *b)
 exchange 3 More...
 

General functions

std::ostream & operator<< (std::ostream &st, EST_TList< T > const &list)
 print list More...
 
EST_TList< T > & operator= (const EST_TList< T > &a)
 make full copy of list More...
 
EST_TList< T > & operator+= (const EST_TList< T > &a)
 Add list onto end of existing list. More...
 
void clear (void)
 remove all items in list More...
 

Additional Inherited Members

- Protected Attributes inherited from EST_UList
EST_UItemh
 
EST_UItemt
 

Detailed Description

template<class T>
class EST_TList< T >

A Template doubly linked list class. This class contains doubly linked lists of a type denoted by T. A pointer of type EST_Litem is used to access items in the list. The class supports a variety of ways of adding, removing and accessing items in the list. For examples of how to operate lists, see list_example.

Iteration through the list is performed using a pointer of type EST_Litem. See Iteration for example code.

Definition at line 61 of file EST_TList.h.

Member Typedef Documentation

template<class T>
typedef T EST_TList< T >::Entry

Definition at line 266 of file EST_TList.h.

template<class T>
typedef EST_TIterator< EST_TList<T>, IPointer, T > EST_TList< T >::Entries

Definition at line 267 of file EST_TList.h.

template<class T>
typedef EST_TRwIterator< EST_TList<T>, IPointer, T > EST_TList< T >::RwEntries

Definition at line 268 of file EST_TList.h.

Constructor & Destructor Documentation

template<class T>
EST_TList< T >::EST_TList ( )
inline

default constructor

Definition at line 125 of file EST_TList.h.

template<class T>
EST_TList< T >::EST_TList ( const EST_TList< T > &  l)

copy constructor

Definition at line 92 of file EST_TList.cc.

template<class T>
EST_TList< T >::~EST_TList ( )
inline

Definition at line 128 of file EST_TList.h.

Member Function Documentation

template<class T>
void EST_TList< T >::init ( void  )
inline

Definition at line 119 of file EST_TList.h.

template<class T >
void EST_TList< T >::free_item ( EST_UItem item)
static

Definition at line 88 of file EST_TList.cc.

template<class T>
T& EST_TList< T >::item ( const EST_Litem p)
inline

return the value associated with the EST_Litem pointer. This has the same functionality as the overloaded () operator.

Definition at line 139 of file EST_TList.h.

template<class T>
const T& EST_TList< T >::item ( const EST_Litem p) const
inline

return a const value associated with the EST_Litem pointer.

Definition at line 142 of file EST_TList.h.

template<class T>
T& EST_TList< T >::nth ( int  n)
inline

return the Nth value

Definition at line 145 of file EST_TList.h.

template<class T>
const T& EST_TList< T >::nth ( int  n) const
inline

return a const Nth value

Definition at line 148 of file EST_TList.h.

template<class T>
const T& EST_TList< T >::first ( ) const
inline

return const reference to first item in list

Definition at line 152 of file EST_TList.h.

template<class T>
const T& EST_TList< T >::last ( ) const
inline

return const reference to last item in list

Definition at line 155 of file EST_TList.h.

template<class T>
T& EST_TList< T >::first ( )
inline

return reference to first item in list

See also
last

Definition at line 160 of file EST_TList.h.

template<class T>
T& EST_TList< T >::last ( )
inline

return reference to last item in list

Definition at line 163 of file EST_TList.h.

template<class T>
const T& EST_TList< T >::operator() ( const EST_Litem ptr) const
inline

return const reference to item in list pointed to by ptr

Definition at line 167 of file EST_TList.h.

template<class T>
T& EST_TList< T >::operator() ( const EST_Litem ptr)
inline

return non-const reference to item in list pointed to by ptr

Definition at line 170 of file EST_TList.h.

template<class T>
EST_Litem* EST_TList< T >::remove ( EST_Litem ptr)
inline

remove item pointed to by ptr, return pointer to previous item. See Removing for example code.

Definition at line 180 of file EST_TList.h.

template<class T>
EST_Litem* EST_TList< T >::remove_nth ( int  n)
inline

remove nth item, return pointer to previous item

Definition at line 184 of file EST_TList.h.

template<class T>
void EST_TList< T >::append ( const T &  item)
inline

add item onto end of list

Definition at line 196 of file EST_TList.h.

template<class T>
void EST_TList< T >::prepend ( const T &  item)
inline

add item onto start of list

Definition at line 199 of file EST_TList.h.

template<class T>
EST_Litem* EST_TList< T >::insert_after ( EST_Litem ptr,
const T &  item 
)
inline

add item after position given by ptr, return pointer to added item.

Definition at line 205 of file EST_TList.h.

template<class T>
EST_Litem* EST_TList< T >::insert_before ( EST_Litem ptr,
const T &  item 
)
inline

add item before position given by ptr, return pointer to added item.

Definition at line 211 of file EST_TList.h.

template<class T>
void EST_TList< T >::exchange ( EST_Litem a,
EST_Litem b 
)
inline

exchange 1

Definition at line 219 of file EST_TList.h.

template<class T>
void EST_TList< T >::exchange ( int  i,
int  j 
)
inline

exchange 2

Definition at line 222 of file EST_TList.h.

template<class T >
void EST_TList< T >::exchange_contents ( EST_Litem a,
EST_Litem b 
)
static

exchange 3

Definition at line 98 of file EST_TList.cc.

template<class T>
EST_TList< T > & EST_TList< T >::operator= ( const EST_TList< T > &  a)

make full copy of list

Definition at line 113 of file EST_TList.cc.

template<class T>
EST_TList< T > & EST_TList< T >::operator+= ( const EST_TList< T > &  a)

Add list onto end of existing list.

Definition at line 121 of file EST_TList.cc.

template<class T>
void EST_TList< T >::clear ( void  )
inline

remove all items in list

Definition at line 244 of file EST_TList.h.

template<class T>
void EST_TList< T >::point_to_first ( IPointer ip) const
inlineprotected

Definition at line 257 of file EST_TList.h.

template<class T>
void EST_TList< T >::move_pointer_forwards ( IPointer ip) const
inlineprotected

Definition at line 258 of file EST_TList.h.

template<class T>
bool EST_TList< T >::points_to_something ( const IPointer ip) const
inlineprotected

Definition at line 259 of file EST_TList.h.

template<class T>
T& EST_TList< T >::points_at ( const IPointer ip)
inlineprotected

Definition at line 260 of file EST_TList.h.

Friends And Related Function Documentation

template<class T>
friend class EST_TIterator< EST_TList< T >, IPointer, T >
friend

Definition at line 262 of file EST_TList.h.

template<class T>
friend class EST_TRwIterator< EST_TList< T >, IPointer, T >
friend

Definition at line 263 of file EST_TList.h.

template<class T>
std::ostream& operator<< ( std::ostream &  st,
EST_TList< T > const &  list 
)
friend

print list

Definition at line 236 of file EST_TList.h.


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