Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

list_c Class Template Reference

A double linked list class. More...

#include <list.h>


Public Methods

 list_c ()
 c'tor

virtual ~list_c ()
 d'tor

void add_first (T *data)
 Add an element at the beginning.

void append (T *data)
 Add an element at the end.

void add_aftercurrent (T *data)
 Add an element after the current element.

void add_beforecurrent (T *data)
 Add an element before the current element.

long get_count ()
 Get element count.

T * get_first ()
 Get first element.

T * get_last ()
 Get last element.

T * get_current ()
 Get current element.

T * get_next ()
 Get next element.

T * get_prev ()
 Get previous element.

void set_current (T *ptr)
 Set active element.

void set_current_num (ulong n)
 Set active element.

void remove (T *ptr)
 Remove element from list.


Protected Attributes

entry_t< T > * first
 start of list

entry_t< T > * last
 ent of list

entry_t< T > * current
 currently active entry

long count
 number of entries


Detailed Description

template<class T>
class list_c< T >

The get_next/get_prev etc. functions are not thread safe! if you plan to use threads you need to create a copy of the list for each thread using it.

Definition at line 53 of file list.h.


Member Function Documentation

void add_aftercurrent T *    data [inline]
 

Inserts the element data after the currently active element. If no element is active, the element is just added using append().

Definition at line 166 of file list.h.

void add_beforecurrent T *    data [inline]
 

Inserts the element data before the currently active element. If no element is active, the element is just added using add_first().

Definition at line 199 of file list.h.

void add_first T *    data [inline]
 

Inserts the element data before the beginning of the list. Existing elements are shifted to the end.

Definition at line 105 of file list.h.

Referenced by list_c< shader_s >::add_beforecurrent().

void append T *    data [inline]
 

Inserts the element data after the end of the list.

Definition at line 136 of file list.h.

Referenced by list_c< shader_s >::add_aftercurrent().

long get_count   [inline]
 

Returns the total number of elements stored in the list.

Definition at line 233 of file list.h.

Referenced by path_c::get_count().

T* get_current   [inline]
 

Returns the currently active element in list. If the list is empty or no element is active NULL is returned.

Definition at line 270 of file list.h.

T* get_first   [inline]
 

Returns the first element in list. If the list is empty NULL is returned. Also makes the returned element the currently active.

Definition at line 244 of file list.h.

Referenced by list_c< shader_s >::set_current(), and list_c< shader_s >::set_current_num().

T* get_last   [inline]
 

Returns the last element in list. If the list is empty NULL is returned. Also makes the returned element the currently active.

Definition at line 257 of file list.h.

T* get_next   [inline]
 

Returns the next element in list following the currently active element. If the list is empty or no element is active NULL is returned. Also makes the returned element the currently active.

Definition at line 282 of file list.h.

Referenced by list_c< shader_s >::set_current(), and list_c< shader_s >::set_current_num().

T* get_prev   [inline]
 

Returns the previous element in list before the currently active element. If the list is empty or no element is active NULL is returned. Also makes the returned element the currently active.

Definition at line 296 of file list.h.

void remove T *    ptr [inline]
 

Find the element \ptr and makes remove it from the list. After calling this function no element will be the active one.

Definition at line 361 of file list.h.

void set_current T *    ptr [inline]
 

Find the element ptr and makes it the currently active. If ptr is not found there is no active element.

Definition at line 310 of file list.h.

Referenced by list_c< shader_s >::remove().

void set_current_num ulong    n [inline]
 

Find the n 'th element and makes it the currently active. If n is larger than the number of elements the last element of the list will be selected.

Definition at line 334 of file list.h.


The documentation for this class was generated from the following file:
Generated on Wed Dec 18 15:48:49 2002 for omicron engine by doxygen1.2.18