Go to the first, previous, next, last section, table of contents.


CNSLList -- Single Linked List of Objects

SYNOPSIS

#include <CNCL/SLList.h>

TYPE

CN_SLLIST

BASE CLASSES

CNObject

DERIVED CLASSES

CNDLList

RELATED CLASSES

CNSLObject, CNSLIterator

DESCRIPTION

CNSLList is a single linked list that can contain any CNCL compatible object.

Constructors:

CNSLList();
CNSLList(CNParam *param);
Initializes the list to empty state. Please note, that there is NO copy constructor supplied. Any attempt to copy a CNSLList will yield a fatal error.

Destructors:

~CNSLList();
Deletes the linked list and all CNSLObject nodes. It does NOT delete the objects referenced by the nodes.

In addition to the member functions required by CNCL, CNSLList provides:

CNSLObject *first() const;
Returns the first node in the list or NIL if the list is empty.
virtual CNSLObject *last() const;
Returns the last node in the list or NIL if the list is empty.
CNSLObject *next(CNSLObject *link) const;
Returns the next node in the list, where link points to the current node. This may be NIL if the next node doesn't exist.
virtual CNSLObject *prev(CNSLObject *link) const;
Returns the previous node in the list, where link points to the current node. This may be NIL if the previous node doesn't exist.
bool empty() const;
Checks if DLList is empty.
unsigned long length() const;
Returns the length (number of nodes) of this DLList.
virtual CNSLObject *append(CNObject *obj);
virtual CNSLObject *append(CNObject &obj);
Adds a new node to the end of the list, referencing the object obj. It returns the node allocated for the object.
virtual CNSLObject *append(CNSLObject *obj);
Adds an already allocated node to the list. It returns the pointer obj.
virtual CNSLObject *prepend(CNObject *obj);
virtual CNSLObject *prepend(CNObject &obj);
Adds a new node to the start of the list, referencing the object obj. It returns the node allocated for the object.
virtual CNSLObject *prepend(CNSLObject *obj);
Adds an already allocated node to the list. It returns the pointer obj.
virtual CNSLObject *delete_object(CNSLObject *pos);
Deletes the node pos from the list. It returns the next node. This function deletes the node (CNSLObject) from the list, but it does NOT delete the object referenced by the node.
virtual CNSLObject *remove_object(CNSLObject *pos);
Removes the node pos from the list. It returns the next node. This function does NOT delete the linked list node (CNSLObject) and it does NOT delete the object referenced by the node, either.
void delete_all();
Deletes all nodes from the linked list and initializes the list to empty. The objects referenced by the nodes are NOT deleted.
void delete_all_w_obj();
Deletes all nodes from the linked list, initializes the list to empty, AND deletes the referenced objects.
virtual CNSLObject *insert_before(CNSLObject *pos, CNObject *obj);
virtual CNSLObject *insert_before(CNSLObject *pos, CNObject &obj);
Creates a new node for obj and inserts it into the list before node pos. It returns the new node.
virtual CNSLObject *insert_before(CNSLObject *pos, CNSLObject *obj);
Inserts an already allocated node into the list before node pos. It returns obj.
virtual CNSLObject *insert_after(CNSLObject *pos, CNObject *obj);
virtual CNSLObject *insert_after(CNSLObject *pos, CNObject &obj);
Creates a new node for obj and inserts it into the list after node pos. It returns the new node.
virtual CNSLObject *insert_after(CNSLObject *pos, CNSLObject *obj);
Inserts an already allocated node into the list after node pos. It returns obj.


Go to the first, previous, next, last section, table of contents.