Laxkit  0.0.7.1
Public Member Functions | Protected Attributes
Laxkit::LinkedList< T > Class Template Reference

Independent node type for doubly linked lists. More...

List of all members.

Public Member Functions

virtual ~LinkedList ()
virtual T * disconnectNode ()
virtual int connectNode (T *node)
 Insert a node or a node chain after or before this.
virtual int closeNodeLoop ()
 Close the loop, if it was open.
virtual T * openNodeLoop (int before)
 Open a closed loop. If after!=0, then cut the loop after *this, else before.

Protected Attributes

T * next_node
T * prev_node

Detailed Description

template<class T>
class Laxkit::LinkedList< T >

Independent node type for doubly linked lists.

Todo:
***** this needs testing

Constructor & Destructor Documentation

template<class T >
Laxkit::LinkedList< T >::~LinkedList ( )
virtual

Calls disconnectNode(), which results in prev_node and next_node being set to NULL. It does NOT delete adjacent nodes. The containing code should do that with judicious use of disconnectNode() and deletes.

References Laxkit::disconnectNode().


Member Function Documentation

template<class T >
int Laxkit::LinkedList< T >::closeNodeLoop ( )
virtual

Close the loop, if it was open.

If it was already closed, return 1. Else return 0 for success.

template<class T >
int Laxkit::LinkedList< T >::connectNode ( T *  node)
virtual

Insert a node or a node chain after or before this.

If node is part of a list, not an independent node, then the whole list is added. If node is part of a closed list, then that loop is cut between node and node->prev_node.

Return 0 for success, nonzero for error.

template<class T >
T * Laxkit::LinkedList< T >::openNodeLoop ( int  after)
virtual

Open a closed loop. If after!=0, then cut the loop after *this, else before.

Return NULL if loop was already open and nothing was severed. On success return pointer to the severed bit. That is, say you have a-this-b, and you call this->openNodeLoop(0), then a is returned. Else b is returned.

Note that if this is looped to itself, then this is still returned.


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

Mon Feb 17 2014 11:52:59, Laxkit