SListItem Class Reference
[Embedded Linked List Package]

Embedded Singly-linked list Class. More...

#include <list.h>

Collaboration diagram for SListItem:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SListItem ()
 Regular Constructor.
bool Empty () const
 Is list empty?
void Reinitialize (void)
 Reinitialize list item.
SListItemUnlinkNext ()
 Unlink and reinitialize successor.
SListItemUnlinkNextOnly ()
 Unlink successor without reinitialization.
void PrependItem (SListItem &item)
 Insert a single item immediately after this element.
void SpliceAfter (SListItem &before_first, SListItem &last)
 Insert a sublist immediately after this element.
int Length () const
 Compute the length of a list.
void Push (SListItem &item)
 Alias for PrependItem().
SListItemPop (void)
 Alias for UnlinkNext().

Public Attributes

SListItemnext
 List member pointer.


Detailed Description

Embedded Singly-linked list Class.

Low-overhead embedded singly-linked-list. Enforces strict LIFO insertion/removal semantics, and is less powerful and capable than ListItem, its doubly-linked counterpart.

Like the ListItem, SListItem can be used as both a list head and a list item, although lists utilizing SListItem as the head structure are restricted to LIFO operations.

SListQueue can also be used as the list head structure. This structure includes a tail pointer, and is capable of all splice and insert operations.

Supports sort functors.

See also:
SListQueue, SListRadixSort

Constructor & Destructor Documentation

SListItem (  )  [inline]

Regular Constructor.

Initializes the list as a circular loop of one.


Member Function Documentation

bool Empty ( void   )  const [inline]

Is list empty?

Checks whether the list is an empty circular loop.

Return values:
true next points to this
false The link is linked with other SListItems.

void Reinitialize ( void   )  [inline]

Reinitialize list item.

Reinitializes the ListItem as a singleton circular list.

Warning:
Use with caution - a list will become corrupt if the item is linked!

SListItem* UnlinkNext ( void   )  [inline]

Unlink and reinitialize successor.

Unlinks and reinitializes the successor of this entry in the list.

Returns:
Pointer to former successor, or NULL if empty.

SListItem* UnlinkNextOnly (  )  [inline]

Unlink successor without reinitialization.

Unlinks the successor of this entry in the list. Marginally more efficient than UnlinkNext().

Returns:
Pointer to former successor, or NULL if empty.
Warning:
The former successor will have a dangling next pointer.

void PrependItem ( SListItem item  )  [inline]

Insert a single item immediately after this element.

Links another SListItem to this SListItem's circular list, such that the new SListItem becomes this element's immediate successor. If this element is considered to be the head of a list, and item is considered to be an item, then the item is prepended to the list headed by this.

Parameters:
item SListItem to be inserted.
Warning:
Blindly overwrites pointers in item. If item is linked to another list, that list will become corrupt.

int Length (  )  const [inline]

Compute the length of a list.

Determines how many items are linked into a list, not including the ListItem it is called on.


The documentation for this class was generated from the following file:
Generated on Fri Jan 9 05:58:41 2009 for libhfp by  doxygen 1.5.4