87   virtual T* 
at(
u32) 
const;
 
   91   virtual chain& 
foreach(
void (*)(
u32, T*)) 
const;
 
  108     throw exception(
"offset out of chain bounds (%d >= %d)", i, m_size);
 
  112   i32 j = i, mid = m_size / 2;
 
  119   while ( 
likely(j-- > 0) ) {
 
  120     next = cur->
link(prev);
 
  143   node<T> *cur = m_head, *prev = NULL, *next;
 
  144   while ( 
likely(cur != NULL) ) {
 
  148     next = cur->
link(prev);
 
  170     throw exception(
"offset out of chain bounds (%d >= %d)", i, m_size);
 
  172   node<T> *cur = m_head, *prev = NULL, *next;
 
  173   while ( 
likely(i-- > 0) ) {
 
  174     next = cur->
link(prev);
 
  179   next = cur->
link(prev);
 
  193   else if ( 
unlikely(cur == m_tail) ) {
 
  266   return new chain(*
this);
 
  302   node<T> *cur = m_head, *prev = NULL, *next;
 
  303   while ( 
likely(cur != NULL) ) {
 
  307     next = cur->
link(prev);
 
  315   while ( 
likely(cur != NULL) ) {
 
  318       copy = 
new T(*cur->
m_data);
 
  327     next = cur->
link(prev);
 
  366     throw exception(
"invalid argument: d (=%p)", d);
 
  369   if ( 
unlikely(node_with(d) != NULL) )
 
  370     throw exception(
"chain @ %p already has a node with data @ %p", 
this, d);
 
  375   if ( 
likely(m_head != NULL) ) {
 
  402   delete detach_node(i);
 
  415   node<T> *cur = m_head, *prev = NULL, *next;
 
  416   while ( 
likely(cur != NULL) ) {
 
  417     next = cur->
link(prev);
 
  424   m_head = m_tail = NULL;
 
  442   return node_at(i)->m_data;
 
  477     return const_cast<chain<T>&
> (*this);
 
  480   node<T> *cur = m_head, *prev = NULL, *next;
 
  481   while ( 
likely(cur != NULL) ) {
 
  484     next = cur->
link(prev);
 
  489   return const_cast<chain<T>&
> (*this);
 
This abstract class serves as the root of the class hierarchy tree. 
 
virtual T * at(u32) const 
Get the node data pointer at a chain offset. 
 
virtual node< T > * detach_node(u32)
Detach the node at a chain offset. 
 
virtual chain & clear()
Empty the chain. 
 
virtual u32 size() const 
Get the chain size (node count) 
 
Lightweight, templated, doubly-linked list (using XOR linking) 
 
virtual T * detach(u32)
Detach the node at a chain offset. 
 
virtual node * link(const node *=NULL) const 
Get the next node (using direct or XOR linking) 
 
chain()
Object default constructor. 
 
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor. 
 
virtual ~chain()
Object destructor. 
 
node< T > * m_tail
Chain tail. 
 
node< T > * m_head
Chain head. 
 
virtual chain & remove(u32)
Dispose the node (and its data) at a chain offset. 
 
virtual node< T > * node_at(u32) const 
Get the node at a chain offset. 
 
A node in a templated chain (doubly-linked list) or stack (singly-linked LIFO queue) ...
 
virtual node & unlink_from(const node *)
Unlink from a node (for XOR linking) 
 
virtual T * detach()
Detach the data pointer from the node. 
 
virtual chain & add(T *)
Add a node to the chain. 
 
virtual node & link_to(const node *)
Link with a node (for XOR linking) 
 
Class csdbg::exception definition. 
 
unsigned int u32
32-bit unsigned integer 
 
virtual chain & operator=(const chain &)
Assignment operator. 
 
virtual T * operator[](u32) const 
Subscript operator. 
 
int i32
32-bit signed integer 
 
Class csdbg::node definition and method implementation. 
 
virtual chain & foreach(void(*)(u32, T *)) const 
Traverse the chain with a callback for each node. 
 
This class is a throwable with a textual description of an error. 
 
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor. 
 
node * m_link
Next node link (direct or XOR link) 
 
virtual node< T > * node_with(const T *) const 
Get the node with m_data == d. 
 
virtual chain * clone() const 
Object virtual copy constructor. 
 
#define __D_ASSERT(x)
Assertion macro.