libcsdbg
1.28
C++ exception (and generic) stack trace debug library
|
Lightweight, templated, singly-linked LIFO queue (stack) More...
#include <stack.hpp>
Public Member Functions | |
stack () | |
Object default constructor. More... | |
stack (const stack &) | |
Object copy constructor. More... | |
virtual | ~stack () |
Object destructor. More... | |
virtual stack * | clone () const |
Object virtual copy constructor. More... | |
virtual u32 | size () const |
Get the stack size (node count) More... | |
virtual stack & | operator= (const stack &) |
Assignment operator. More... | |
virtual T * | operator[] (u32) const |
Subscript operator. More... | |
virtual stack & | push (T *) |
Push a node on the stack. More... | |
virtual stack & | pop () |
Remove the top stack node. More... | |
virtual stack & | clear () |
Empty the stack. More... | |
virtual T * | peek (u32) const |
Get the node data pointer at a stack offset. More... | |
virtual stack & | foreach (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 i8 * | class_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... | |
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