libcsdbg
1.28
C++ exception (and generic) stack trace debug library
|
A node in a templated chain (doubly-linked list) or stack (singly-linked LIFO queue) More...
#include <node.hpp>
Protected Member Functions | |
node (T *) | |
Object constructor. More... | |
node (const node &) | |
Object copy constructor. More... | |
virtual | ~node () |
Object destructor. More... | |
virtual node * | clone () const |
Object virtual copy constructor. More... | |
virtual node * | link (const node *=NULL) const |
Get the next node (using direct or XOR linking) More... | |
virtual node & | link_to (const node *) |
Link with a node (for XOR linking) More... | |
virtual node & | unlink_from (const node *) |
Unlink from a node (for XOR linking) More... | |
virtual T * | detach () |
Detach the data pointer from the node. More... | |
virtual node & | operator= (const node &) |
Assignment operator. More... | |
virtual node * | operator^ (const node &) const |
Get the next node (XOR linking) More... | |
Protected Attributes | |
node * | m_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 i8 * | class_name () const |
Query the class name of an object descending from csdbg::object. More... | |
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