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

A node in a templated chain (doubly-linked list) or stack (singly-linked LIFO queue) More...

#include <node.hpp>

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

Protected Member Functions

 node (T *)
 Object constructor. More...
 
 node (const node &)
 Object copy constructor. More...
 
virtual ~node ()
 Object destructor. More...
 
virtual nodeclone () const
 Object virtual copy constructor. More...
 
virtual nodelink (const node *=NULL) const
 Get the next node (using direct or XOR linking) More...
 
virtual nodelink_to (const node *)
 Link with a node (for XOR linking) More...
 
virtual nodeunlink_from (const node *)
 Unlink from a node (for XOR linking) More...
 
virtual T * detach ()
 Detach the data pointer from the node. More...
 
virtual nodeoperator= (const node &)
 Assignment operator. More...
 
virtual nodeoperator^ (const node &) const
 Get the next node (XOR linking) More...
 

Protected Attributes

nodem_link
 Next node link (direct or XOR link) More...
 
T * m_data
 Node data. More...
 

Friends

template<class F >
class chain
 
template<class F >
class stack
 

Additional Inherited Members

- 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...
 

Detailed Description

template<class T>
class csdbg::node< T >

A node in a templated chain (doubly-linked list) or stack (singly-linked LIFO queue)

A node object, through its m_link member variable, can be linked to a single node (direct addressing), or to two nodes (XOR linking). Class csdbg::stack uses singly-linked nodes, class csdbg::chain is a doubly-linked list. A node can be instantiated only through the public methods of a chain or stack object. A node can point to data of any type (intrinsic or user defined) except arrays. When a node is released it also calls delete (not delete[]) on its data pointer, unless it's previously detached. Therefore each node must point to a single T and not a T[], otherwise memory leaks are bound to happen. When a node is copied or assigned, only its data are copied. Data copying invokes T(const T&) or T::operator=(const T&), exceptions thrown from these methods are not handled by the node nor its container, they are propagated up the call stack

See Also
csdbg::chain
csdbg::stack

Definition at line 36 of file node.hpp.


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