80 virtual stack&
foreach(
void (*)(
u32, T*))
const;
97 throw exception(
"offset out of stack bounds (%d >= %d)", i, m_size);
181 return new stack(*
this);
225 copy =
new T(*n->m_data);
269 throw exception(
"invalid argument: d (=%p)", d);
272 if (
unlikely(node_with(d) != NULL) )
273 throw exception(
"stack @ %p has a node with data @ %p",
this, d);
293 if (
likely(m_size != 0) ) {
313 while (
likely(n != NULL) ) {
337 return node_at(i)->m_data;
353 return const_cast<stack<T>&
> (*this);
357 pfunc(i++, n->m_data);
359 return const_cast<stack<T>&
> (*this);
virtual T * operator[](u32) const
Subscript operator.
virtual ~stack()
Object destructor.
virtual stack * clone() const
Object virtual copy constructor.
This abstract class serves as the root of the class hierarchy tree.
virtual T * peek(u32) const
Get the node data pointer at a stack offset.
virtual u32 size() const
Get the stack size (node count)
virtual node< T > * node_at(u32 i) const
Get the node at a stack offset.
Lightweight, templated, singly-linked LIFO queue (stack)
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
virtual stack & foreach(void(*)(u32, T *)) const
Traverse the stack with a callback for each node.
A node in a templated chain (doubly-linked list) or stack (singly-linked LIFO queue) ...
node< T > * m_top
Stack top.
Class csdbg::exception definition.
stack()
Object default constructor.
unsigned int u32
32-bit unsigned integer
Class csdbg::node definition and method implementation.
virtual stack & clear()
Empty the stack.
This class is a throwable with a textual description of an error.
virtual stack & push(T *)
Push a node on the stack.
virtual node< T > * node_with(const T *) const
Get the node with m_data == d.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
node * m_link
Next node link (direct or XOR link)
virtual stack & operator=(const stack &)
Assignment operator.
#define __D_ASSERT(x)
Assertion macro.
virtual stack & pop()
Remove the top stack node.