Edinburgh Speech Tools 2.4-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

struct  IPointer
 

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 \Ref{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 {\tt ptr} More...
 
T & operator() (const EST_Litem *ptr)
 return non-const reference to item in list pointed to by {\tt ptr} More...
 
Removing items in a list.

more.

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 \Ref{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_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))
 

General functions

typedef T Entry
 
typedef EST_TIterator< EST_TList< T >, IPointer, T > Entries
 
typedef EST_TRwIterator< EST_TList< T >, IPointer, T > RwEntries
 
class EST_TIterator< EST_TList< T >, IPointer, T >
 
class EST_TRwIterator< EST_TList< T >, IPointer, T >
 
ostream & operator<< (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...
 
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)
 

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...
 

Additional Inherited Members

- Protected Member Functions inherited from EST_UList
void init ()
 
void clear_and_free (void(*item_free)(EST_UItem *item))
 
- 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 {\tt T}. A pointer of type \Ref{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 \Ref{list_example}.

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

Definition at line 108 of file EST_TList.h.

Member Typedef Documentation

◆ Entry

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

Definition at line 257 of file EST_TList.h.

◆ Entries

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

Definition at line 258 of file EST_TList.h.

◆ RwEntries

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

Definition at line 259 of file EST_TList.h.

Constructor & Destructor Documentation

◆ EST_TList() [1/2]

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

default constructor

Definition at line 119 of file EST_TList.h.

◆ EST_TList() [2/2]

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

copy constructor

Definition at line 92 of file EST_TList.cc.

◆ ~EST_TList()

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

Definition at line 122 of file EST_TList.h.

Member Function Documentation

◆ init()

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

Definition at line 113 of file EST_TList.h.

◆ free_item()

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

Definition at line 88 of file EST_TList.cc.

◆ item() [1/2]

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 133 of file EST_TList.h.

◆ item() [2/2]

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 136 of file EST_TList.h.

◆ nth() [1/2]

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

return the Nth value

Definition at line 139 of file EST_TList.h.

◆ nth() [2/2]

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

return a const Nth value

Definition at line 142 of file EST_TList.h.

◆ first() [1/2]

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

return const reference to first item in list

Definition at line 146 of file EST_TList.h.

◆ last() [1/2]

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

return const reference to last item in list

Definition at line 149 of file EST_TList.h.

◆ first() [2/2]

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

return reference to first item in list

See also
last

Definition at line 154 of file EST_TList.h.

◆ last() [2/2]

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

return reference to last item in list

Definition at line 157 of file EST_TList.h.

◆ operator()() [1/2]

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 {\tt ptr}

Definition at line 161 of file EST_TList.h.

◆ operator()() [2/2]

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

return non-const reference to item in list pointed to by {\tt ptr}

Definition at line 164 of file EST_TList.h.

◆ remove()

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

remove item pointed to by {\tt ptr}, return pointer to previous item. See \Ref{Removing} for example code.

Definition at line 175 of file EST_TList.h.

◆ remove_nth()

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

remove nth item, return pointer to previous item

Definition at line 179 of file EST_TList.h.

◆ append()

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

add item onto end of list

Definition at line 191 of file EST_TList.h.

◆ prepend()

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

add item onto start of list

Definition at line 194 of file EST_TList.h.

◆ insert_after()

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

add {\tt item} after position given by {\tt ptr}, return pointer to added item.

Definition at line 200 of file EST_TList.h.

◆ insert_before()

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

add {\tt item} before position given by {\tt ptr}, return pointer to added item.

Definition at line 206 of file EST_TList.h.

◆ exchange() [1/2]

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

exchange 1

Definition at line 214 of file EST_TList.h.

◆ exchange() [2/2]

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

exchange 2

Definition at line 217 of file EST_TList.h.

◆ exchange_contents()

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.

◆ operator=()

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.

◆ operator+=()

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.

◆ clear()

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

remove all items in list

Definition at line 239 of file EST_TList.h.

◆ point_to_first()

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

Definition at line 248 of file EST_TList.h.

◆ move_pointer_forwards()

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

Definition at line 249 of file EST_TList.h.

◆ points_to_something()

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

Definition at line 250 of file EST_TList.h.

◆ points_at()

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

Definition at line 251 of file EST_TList.h.

Friends And Related Function Documentation

◆ EST_TIterator< EST_TList< T >, IPointer, T >

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

Definition at line 251 of file EST_TList.h.

◆ EST_TRwIterator< EST_TList< T >, IPointer, T >

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

Definition at line 251 of file EST_TList.h.

◆ operator<<

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

print list

Definition at line 231 of file EST_TList.h.


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