SListQueue Class Reference
[Embedded Linked List Package]

Queue head for SListItem elements supporting FIFO operations. More...

#include <list.h>

Collaboration diagram for SListQueue:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SListQueue (void)
 Default constructor.
 ~SListQueue (void)
 Default destructor -- asserts that queue is empty.
bool Empty (void) const
 Is queue empty?
void Reinitialize (void)
 Reinitialize queue head.
void PrependItem (SListItem &item)
 Insert a single item at the front of the queue.
void AppendItem (SListItem &item)
 Insert a single item at the back of the queue.
void SpliceAfter (SListItem &before_first, SListItem &last)
 Insert a sublist at the head of the queue.
void SpliceBefore (SListItem &before_first, SListItem &last)
 Insert a sublist at the tail of the queue.
void PrependItemsFrom (SListQueue &source)
 Prepends all elements of a list into this.
void AppendItemsFrom (SListQueue &source)
 Appends all elements of a list into this.
SListItemUnlinkNext (void)
 Unlink and reinitialize successor.
SListItemUnlinkNextOnly (void)
 Unlink successor without reinitialization.
void Push (SListItem &item)
 Alias for PrependItem().
SListItemPop (void)
 Alias for UnlinkNext().
void Enqueue (SListItem &item)
 Alias for AppendItem().
SListItemDequeue (void)
 Alias for UnlinkNext().


Detailed Description

Queue head for SListItem elements supporting FIFO operations.

Offers the efficiency tradeoff of having a double-pointer list head, but single-pointer elements. This can be used as a memory- saving alternative to ListItem for cases where the following functionality is not needed:


Member Function Documentation

bool Empty ( void   )  const [inline]

Is queue empty?

Checks whether the queue is an empty circular loop.

Return values:
true next points to this and prev points to this
false The list is linked with other ListItems.

void Reinitialize ( void   )  [inline]

Reinitialize queue head.

Reinitializes the SListQueue as a singleton circular list.

Warning:
Use with caution - any elements linked into the queue at the time this method is called will be improperly unlinked, and the list pointers of such will certainly become corrupt.

void PrependItem ( SListItem item  )  [inline]

Insert a single item at the front of the queue.

Links an SListItem to this SListQueue's circular list, such that item becomes the first item on the queue, or the immediate successor of the queue head element.

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

void AppendItem ( SListItem item  )  [inline]

Insert a single item at the back of the queue.

Links an SListItem to this SListQueue's circular list, such that item becomes the last item on the queue, or the immediate predecessor of the queue head element.

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

void SpliceAfter ( SListItem before_first,
SListItem last 
) [inline]

Insert a sublist at the head of the queue.

Unlinks a chain of SListItem structures from whatever list they might be linked onto, and prepends them to the beginning of the queue.

Parameters:
before_first SListItem on the source list immediately preceding the starting SListItem of the chain to splice.
last Final SListItem on the source list of the chain to splice.

void SpliceBefore ( SListItem before_first,
SListItem last 
) [inline]

Insert a sublist at the tail of the queue.

Unlinks a chain of SListItem structures from whatever list they might be linked onto, and appends them to the end of the queue.

Parameters:
before_first SListItem on the source list immediately preceding the starting SListItem of the chain to splice.
last Final SListItem on the source list of the chain to splice.

void PrependItemsFrom ( SListQueue source  )  [inline]

Prepends all elements of a list into this.

Splices all items of source onto the beginning of the subject queue. The parameter source is reinitialized as part of the operation. Upon return, source will be empty.

Parameters:
source List from which items should be transferred.

void AppendItemsFrom ( SListQueue source  )  [inline]

Appends all elements of a list into this.

Splices all items of source onto the end of the subject queue. The parameter source is reinitialized as part of this operation. Upon return, source will be empty.

Parameters:
source List from which items should be transferred.

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 ( void   )  [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.


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