simple_stack Class Template Reference

#include <stack.hpp>

Inheritance diagram for simple_stack:

Inheritance graph
[legend]
Collaboration diagram for simple_stack:

Collaboration graph
[legend]

List of all members.


Detailed Description

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

The usual FILO stack structure. This should only be used for storing simple types, as items will be copied around in memory.

Definition at line 48 of file stack.hpp.


Public Member Functions

virtual bool contains_index (const I &) const =0
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
simple_stackoperator= (const simple_stack &s)
T & operator[] (const I &index)
const T & operator[] (const I &index) const
 simple_stack (const simple_stack &s)
 simple_stack ()
virtual ~simple_stack ()
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
virtual void append (const T &)
 Add an item to the end of the collection.
virtual void insert (const iterator &i, const T &item)
 Insert an item before the one specified by the iterator.
virtual void remove (const iterator &i)
 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 &index) const
virtual T & item (const gsgl::index_t &index)
virtual const T & item (const gsgl::index_t &index) const
Array Functionality
void insert (const T &item, const typename index_t &index)
T * ptr ()
const T * ptr () const
void remove (const typename index_t &index)
Iterators
iterator iter ()
const_iterator iter () const
simple_stack Functionality
void pop ()
void push (const T &item)
T & top ()
const T & top () const

Protected Member Functions

void * allocate (const gsgl::index_t &num_bytes)
void copy (void *dest, void *src, const gsgl::index_t &num_bytes)
void deallocate (void *)
void move (void *dest, void *src, const gsgl::index_t &num_bytes)
void * reallocate (void *, const gsgl::index_t &num_bytes)
void resize (const gsgl::index_t &new_num_elements)
void set (void *dest, const unsigned char &val, const gsgl::index_t &num_bytes)

Constructor & Destructor Documentation

simple_stack (  )  [inline]

Definition at line 71 of file stack.hpp.

simple_stack ( const simple_stack< T > &  s  )  [inline]

Definition at line 78 of file stack.hpp.

~simple_stack (  )  [inline, virtual]

Definition at line 93 of file stack.hpp.


Member Function Documentation

void * allocate ( const gsgl::index_t num_bytes  )  [protected, inherited]

Definition at line 45 of file array.cpp.

Referenced by simple_array::simple_array().

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, inherited]

virtual void clear (  )  [inline, virtual, inherited]

Clears the contents of the collection.

Implements countable.

Definition at line 97 of file array.hpp.

Referenced by string::clear(), pqueue::clear(), config_record::from_stream(), string_impl::get_c_string(), and string_impl::get_p_string().

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

Implemented in dictionary.

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

Definition at line 114 of file array.hpp.

void copy ( void *  dest,
void *  src,
const gsgl::index_t num_bytes 
) [protected, inherited]

Definition at line 69 of file array.cpp.

void deallocate ( void *  ptr  )  [protected, inherited]

Definition at line 57 of file array.cpp.

Referenced by simple_array::~simple_array().

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

void insert ( const T &  item,
const typename index_t index 
) [inherited]

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

Insert an item before the one specified by the iterator.

Implements iterable.

Definition at line 201 of file array.hpp.

Referenced by string::insert(), and pqueue::push().

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, inherited]

Definition at line 225 of file array.hpp.

References simple_array::data, simple_array::num_elements, and simple_array::resize().

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

Definition at line 215 of file array.hpp.

References simple_array::data, and simple_array::num_elements.

Referenced by string::item(), and simple_stack::top().

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]

void move ( void *  dest,
void *  src,
const gsgl::index_t num_bytes 
) [protected, inherited]

Definition at line 63 of file array.cpp.

simple_stack< T > & operator= ( const simple_stack< T > &  s  )  [inline]

Definition at line 85 of file stack.hpp.

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 pop (  )  [inline]

Definition at line 126 of file stack.hpp.

References simple_array::resize(), and simple_array::size().

T* ptr (  )  [inline, inherited]

Definition at line 121 of file array.hpp.

const T* ptr (  )  const [inline, inherited]

void push ( const T &  item  )  [inline]

Definition at line 119 of file stack.hpp.

References simple_array::append().

void * reallocate ( void *  ptr,
const gsgl::index_t num_bytes 
) [protected, inherited]

Definition at line 51 of file array.cpp.

Referenced by simple_array::resize().

void remove ( const typename index_t index  )  [inherited]

void remove ( const iterator  )  [inline, virtual, inherited]

Remove the item specified by the iterator.

Implements iterable.

Definition at line 208 of file array.hpp.

Referenced by pqueue::pop(), string::remove(), and pqueue::remove().

void resize ( const gsgl::index_t new_num_elements  )  [inline, protected, inherited]

void set ( void *  dest,
const unsigned char &  val,
const gsgl::index_t num_bytes 
) [protected, inherited]

Definition at line 75 of file array.cpp.

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

A generic count function that iterates over the collection.

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

Reimplemented from iterable.

Definition at line 96 of file array.hpp.

Referenced by string::append(), vehicle::calculate_inertia_tensor(), shader_base::compile(), stellar_db::draw(), spherical_quadtree::get_new_vertex_index(), node_relative_path::initialize(), simple_stack::pop(), string::size(), pqueue::size(), simple_stack::top(), and stellar_db::~stellar_db().

T & top (  )  [inline]

Definition at line 109 of file stack.hpp.

References simple_array::item(), and simple_array::size().

const T & top (  )  const [inline]

Definition at line 99 of file stack.hpp.

References simple_array::item(), and simple_array::size().


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

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