list Class Template Reference

#include <list.hpp>

Inheritance diagram for list:

Inheritance graph
[legend]
Collaboration diagram for list:

Collaboration graph
[legend]

List of all members.


Detailed Description

template<typename T>
class gsgl::data::list< T >

A simple linked list.

This class is optimized for fast iteration, insertion and deletion.

Definition at line 56 of file list.hpp.


Public Member Functions

virtual bool contains_index (const I &) const =0
T & get_head ()
const T & get_head () const
T & get_tail ()
const T & get_tail () const
virtual bool is_empty () const
 Returns true if the collection is empty.
virtual T & item (const I &index)=0
virtual const T & item (const I &index) const =0
 list (const list &)
 list ()
listoperator= (const list &)
bool operator== (const list &) const
T & operator[] (const I &index)
const T & operator[] (const I &index) const
virtual ~list ()
Other Useful Functions
virtual void append (const iterable< T, IBase > &)
 Append all members of a collection to this one.
virtual iterator find_value (const T &)
virtual const_iterator find_value (const T &) const
 A generic find function that iterates over the collection to find a particular value.
Iterable Implementation
Adds a data item to the end of the list.

virtual void append (const T &)
 Add an item to the end of the collection.
virtual void insert (const iterator &, const T &)
virtual void remove (const iterator &)
 Remove the item specified by the iterator.
Countable Implementation
virtual void clear ()
 Clears the contents of the collection.
virtual gsgl::index_t size () const
 A generic count function that iterates over the collection.
Indexable Implementation
virtual bool contains_index (const gsgl::index_t &) const
virtual T & item (const gsgl::index_t &)
virtual const T & item (const gsgl::index_t &) const
Iterators
iterator iter ()
const_iterator iter () const

Protected Attributes

gsgl::index_t count
list_nodehead
list_nodetail

Classes

struct  list_node

Constructor & Destructor Documentation

list (  )  [inline]

Definition at line 116 of file list.hpp.

list ( const list< T > &  l  )  [inline]

Definition at line 124 of file list.hpp.

References list::append(), list::head, and list::list_node::next.

~list (  )  [inline, virtual]

Definition at line 144 of file list.hpp.

References list::clear().


Member Function Documentation

void append ( const iterable< T, IBase > &  a  )  [inline, virtual, inherited]

Append all members of a collection to this one.

Definition at line 145 of file iterable.hpp.

void append ( const T &   )  [inline, virtual]

void clear (  )  [inline, virtual]

Clears the contents of the collection.

Implements countable.

Definition at line 217 of file list.hpp.

References list::count, list::head, list::list_node::next, and list::tail.

Referenced by application::load_scenery(), queue::operator=(), list::operator=(), application::~application(), and list::~list().

virtual bool contains_index ( const I &   )  const [pure virtual, inherited]

Implemented in dictionary.

bool contains_index ( const gsgl::index_t index  )  const [inline, virtual]

Definition at line 235 of file list.hpp.

References list::count.

iterable< T, IBase >::iterator find_value ( const T &  item  )  [inline, virtual, inherited]

Definition at line 168 of file iterable.hpp.

References iterable::iterator::is_valid().

iterable< T, IBase >::const_iterator find_value ( const T &  item  )  const [inline, virtual, inherited]

A generic find function that iterates over the collection to find a particular value.

Note:
Not efficient; should be overridden if possible.

Definition at line 153 of file iterable.hpp.

References iterable::const_iterator::is_valid().

Referenced by gsgl::data::global_unregister_resource_aux().

T & get_head (  )  [inline]

Definition at line 161 of file list.hpp.

References list::head, and list::list_node::item.

const T & get_head (  )  const [inline]

Definition at line 151 of file list.hpp.

References list::head, and list::list_node::item.

T & get_tail (  )  [inline]

Definition at line 181 of file list.hpp.

References list::list_node::item, and list::tail.

const T & get_tail (  )  const [inline]

Definition at line 171 of file list.hpp.

References list::list_node::item, and list::tail.

void insert ( const iterator i,
const T &  item 
) [inline, virtual]

Todo:
Implement list::insert().

Implements iterable.

Definition at line 288 of file list.hpp.

References list::append(), list::count, and list::head.

virtual bool is_empty (  )  const [inline, virtual, inherited]

virtual T& item ( const I &  index  )  [pure virtual, inherited]

Implemented in dictionary.

virtual const T& item ( const I &  index  )  const [pure virtual, inherited]

T & item ( const gsgl::index_t index  )  [inline, virtual]

Definition at line 256 of file list.hpp.

References list::head, list::list_node::item, and list::list_node::next.

const T & item ( const gsgl::index_t index  )  const [inline, virtual]

Definition at line 242 of file list.hpp.

References list::head, list::list_node::item, and list::list_node::next.

iterator iter (  )  [inline, inherited]

Returns:
An iterator pointing to the first item in the collection.

Definition at line 101 of file iterable.hpp.

const_iterator iter (  )  const [inline, inherited]

list< T > & operator= ( const list< T > &  l  )  [inline]

Definition at line 134 of file list.hpp.

References list::append(), list::clear(), list::head, and list::list_node::next.

bool operator== ( const list< T > &  l  )  const [inline]

Definition at line 191 of file list.hpp.

References iterable::iter().

T& operator[] ( const I &  index  )  [inline, inherited]

Definition at line 58 of file indexable.hpp.

const T& operator[] ( const I &  index  )  const [inline, inherited]

Definition at line 57 of file indexable.hpp.

void remove ( const iterator  )  [inline, virtual]

Remove the item specified by the iterator.

Implements iterable.

Definition at line 309 of file list.hpp.

References list::count, list::head, and list::tail.

Referenced by gsgl::data::global_unregister_resource_aux().

gsgl::index_t size (  )  const [inline, virtual]

A generic count function that iterates over the collection.

Note:
Not very efficient; should be overridden if possible.

Reimplemented from iterable.

Definition at line 210 of file list.hpp.

References list::count.

Referenced by mesh_file::load_obj_file(), and application::load_scenery().


Member Data Documentation

gsgl::index_t count [protected]

list_node* head [protected]

list_node * tail [protected]

Definition at line 73 of file list.hpp.

Referenced by list::append(), list::clear(), list::get_tail(), and list::remove().


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

Generated on Sat Mar 1 13:50:05 2008 for Periapsis Project by  doxygen 1.5.5