lestes::std::stack< T, Container > Class Template Reference

Collectible stack of entities. More...

#include <stack.hh>

Inheritance diagram for lestes::std::stack< T, Container >:

lestes::std::object lestes::std::mem::keystone List of all members.

Public Types

typedef Container::value_type value_type
typedef Container::size_type size_type
typedef Container container_type
typedef Container::const_reverse_iterator const_iterator
typedef Container::reverse_iterator iterator
typedef Container::const_iterator const_reverse_iterator
typedef Container::iterator reverse_iterator

Public Member Functions

virtual ptr< object::reflection_listreflection_get () const
virtual ptr< object::field_list_listfield_values_get () const
virtual void gc_mark (void)
 Marks the keystone.
bool empty () const
size_type size () const
value_typetop ()
const value_typetop () const
void push (const value_type &x)
void pop ()
const_iterator begin () const
iterator begin ()
const_iterator end () const
iterator end ()
const_reverse_iterator rbegin () const
reverse_iterator rbegin ()
const_reverse_iterator rend () const
reverse_iterator rend ()

Static Public Member Functions

static ptr< stack< T > > create (ptr< Container > container=Container::create())

Protected Member Functions

 stack (ptr< Container > container)

Protected Attributes

srp< Container > c

Static Private Attributes

static ptr< object::reflection_listreflection

Detailed Description

template<class T, class Container = list<T>>
class lestes::std::stack< T, Container >

Collectible stack of entities.

An analogon for STL stack class tailored to be compatible with our garbage collector. Includes namely marking routine and factory method.

In addition to std::stack an iterator is provided. The sense of the iteration is reversed with respect to the underlying container. Thus the ``normal'' iteration starts at the stack top, which is the back of the underlying container.

Definition at line 65 of file stack.hh.


Member Typedef Documentation

template<class T, class Container = list<T>>
typedef Container::value_type lestes::std::stack< T, Container >::value_type

Definition at line 67 of file stack.hh.

template<class T, class Container = list<T>>
typedef Container::size_type lestes::std::stack< T, Container >::size_type

Definition at line 68 of file stack.hh.

template<class T, class Container = list<T>>
typedef Container lestes::std::stack< T, Container >::container_type

Definition at line 69 of file stack.hh.

template<class T, class Container = list<T>>
typedef Container::const_reverse_iterator lestes::std::stack< T, Container >::const_iterator

Definition at line 70 of file stack.hh.

template<class T, class Container = list<T>>
typedef Container::reverse_iterator lestes::std::stack< T, Container >::iterator

Definition at line 71 of file stack.hh.

template<class T, class Container = list<T>>
typedef Container::const_iterator lestes::std::stack< T, Container >::const_reverse_iterator

Definition at line 72 of file stack.hh.

template<class T, class Container = list<T>>
typedef Container::iterator lestes::std::stack< T, Container >::reverse_iterator

Definition at line 73 of file stack.hh.


Constructor & Destructor Documentation

template<class T, class Container = list<T>>
lestes::std::stack< T, Container >::stack ( ptr< Container >  container  )  [inline, protected]


Member Function Documentation

template<class T, class Container = list<T>>
static ptr< stack < T > > lestes::std::stack< T, Container >::create ( ptr< Container >  container = Container::create()  )  [inline, static]

Definition at line 75 of file stack.hh.

00076         { return new stack < T > (container); }

template<typename T, typename C>
ptr< object::reflection_list > lestes::std::stack< T, C >::reflection_get (  )  const [inline, virtual]

Reimplemented from lestes::std::object.

Definition at line 125 of file stack.hh.

References lestes::std::class_reflection::create(), lestes::std::list< T >::create(), lestes::std::stack< T, Container >::reflection, and lestes::std::object::reflection_get().

00126 {
00127         if (!reflection) {
00128                 typedef class_reflection::field_metadata md;
00129                 typedef class_reflection::field_metadata_list mdlist;
00130                 ptr<mdlist> mdl = mdlist::create();
00131                 mdl->push_back( md::create( "c", "Collection &lt; T &gt;" ) );
00132                 reflection = reflection_list::create( object::reflection_get() );
00133                 reflection->push_back( class_reflection::create( "stack_of_T", mdl ) );
00134         }
00135         return reflection;
00136 }

template<typename T, typename C>
ptr< object::field_list_list > lestes::std::stack< T, C >::field_values_get (  )  const [inline, virtual]

Reimplemented from lestes::std::object.

Definition at line 139 of file stack.hh.

References lestes::std::stack< T, Container >::c, lestes::std::list< T >::create(), and lestes::std::object::field_values_get().

00140 {
00141         ptr<field_list_list> result = object::field_values_get();
00142         result->push_back( value_list::create() );
00143         result->back()->push_back( c );
00144         return result;
00145 }

template<class T, class Container = list<T>>
virtual void lestes::std::stack< T, Container >::gc_mark ( void   )  [inline, virtual]

Marks the keystone.

Marks all directly reachable parts of the class. The method must be overriden for each inherited class. It should contain abc.gc_mark() for each field abc of the inherited class and call to gc_mark() of the direct ancestor of the class. Does nothing for keystone, only stops processing of ancestors.

Reimplemented from lestes::std::mem::keystone.

Definition at line 86 of file stack.hh.

00087         { c.gc_mark(); return object::gc_mark(); }

template<class T, class Container = list<T>>
bool lestes::std::stack< T, Container >::empty (  )  const [inline]

Definition at line 89 of file stack.hh.

00090         { return c->empty(); }

template<class T, class Container = list<T>>
size_type lestes::std::stack< T, Container >::size (  )  const [inline]

Definition at line 91 of file stack.hh.

00092         { return c->size(); }

template<class T, class Container = list<T>>
value_type& lestes::std::stack< T, Container >::top (  )  [inline]

Definition at line 93 of file stack.hh.

References lassert.

00094         { lassert(!empty()); return c->back(); }

template<class T, class Container = list<T>>
const value_type& lestes::std::stack< T, Container >::top (  )  const [inline]

Definition at line 95 of file stack.hh.

References lassert.

00096         { lassert(!empty()); return c->back(); }

template<class T, class Container = list<T>>
void lestes::std::stack< T, Container >::push ( const value_type x  )  [inline]

Definition at line 97 of file stack.hh.

00098         { c->push_back(x); }

template<class T, class Container = list<T>>
void lestes::std::stack< T, Container >::pop (  )  [inline]

Definition at line 99 of file stack.hh.

References lassert.

00100         { lassert(!empty()); c->pop_back(); }

template<class T, class Container = list<T>>
const_iterator lestes::std::stack< T, Container >::begin (  )  const [inline]

Definition at line 102 of file stack.hh.

00103         { return c->rbegin(); }

template<class T, class Container = list<T>>
iterator lestes::std::stack< T, Container >::begin (  )  [inline]

Definition at line 104 of file stack.hh.

00105         { return c->rbegin(); }

template<class T, class Container = list<T>>
const_iterator lestes::std::stack< T, Container >::end (  )  const [inline]

Definition at line 106 of file stack.hh.

00107         { return c->rend(); }

template<class T, class Container = list<T>>
iterator lestes::std::stack< T, Container >::end (  )  [inline]

Definition at line 108 of file stack.hh.

00109         { return c->rend(); }

template<class T, class Container = list<T>>
const_reverse_iterator lestes::std::stack< T, Container >::rbegin (  )  const [inline]

Definition at line 111 of file stack.hh.

00112         { return c->begin(); }

template<class T, class Container = list<T>>
reverse_iterator lestes::std::stack< T, Container >::rbegin (  )  [inline]

Definition at line 113 of file stack.hh.

00114         { return c->begin(); }

template<class T, class Container = list<T>>
const_reverse_iterator lestes::std::stack< T, Container >::rend (  )  const [inline]

Definition at line 115 of file stack.hh.

00116         { return c->end(); }

template<class T, class Container = list<T>>
reverse_iterator lestes::std::stack< T, Container >::rend (  )  [inline]

Definition at line 117 of file stack.hh.

00118         { return c->end(); }


Member Data Documentation

template<class T, class Container = list<T>>
srp< Container > lestes::std::stack< T, Container >::c [protected]

Definition at line 78 of file stack.hh.

Referenced by lestes::std::stack< T, Container >::field_values_get().

template<class T, class Container = list<T>>
ptr< object::reflection_list > lestes::std::stack< T, C >::reflection [inline, static, private]

Reimplemented from lestes::std::object.

Definition at line 82 of file stack.hh.

Referenced by lestes::std::stack< T, Container >::reflection_get().


The documentation for this class was generated from the following file:
Generated on Mon Feb 12 18:26:00 2007 for lestes by doxygen 1.5.1-20070107