libcsdbg  1.28
C++ exception (and generic) stack trace debug library
csdbg::stack< T > Class Template Reference

Lightweight, templated, singly-linked LIFO queue (stack) More...

#include <stack.hpp>

+ Inheritance diagram for csdbg::stack< T >:
+ Collaboration diagram for csdbg::stack< T >:

Public Member Functions

 stack ()
 Object default constructor. More...
 
 stack (const stack &)
 Object copy constructor. More...
 
virtual ~stack ()
 Object destructor. More...
 
virtual stackclone () const
 Object virtual copy constructor. More...
 
virtual u32 size () const
 Get the stack size (node count) More...
 
virtual stackoperator= (const stack &)
 Assignment operator. More...
 
virtual T * operator[] (u32) const
 Subscript operator. More...
 
virtual stackpush (T *)
 Push a node on the stack. More...
 
virtual stackpop ()
 Remove the top stack node. More...
 
virtual stackclear ()
 Empty the stack. More...
 
virtual T * peek (u32) const
 Get the node data pointer at a stack offset. More...
 
virtual stackforeach (void(*)(u32, T *)) const
 Traverse the stack with a callback for each node. More...
 
- Public Member Functions inherited from csdbg::object
virtual ~object ()=0
 To be implemented. More...
 
virtual const i8class_name () const
 Query the class name of an object descending from csdbg::object. More...
 

Protected Member Functions

virtual node< T > * node_at (u32 i) const
 Get the node at a stack offset. More...
 
virtual node< T > * node_with (const T *) const
 Get the node with m_data == d. More...
 

Protected Attributes

node< T > * m_top
 Stack top. More...
 
u32 m_size
 Node count. More...
 

Detailed Description

template<class T>
class csdbg::stack< T >

Lightweight, templated, singly-linked LIFO queue (stack)

The stack supports shared data (multiple stacks can point to the same data) but it is not thread safe, callers should synchronize thread access. This implementation doesn't allow a node with a NULL or a duplicate data pointer. A stack can be traversed using simple callbacks and method stack::foreach. Apart from the legacy push/pop functions, node data can be accessed using stack offsets, just like a singly-linked list

See Also
csdbg::node

Definition at line 28 of file stack.hpp.


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