Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

PointeredStack Class Reference

#include <Stack.h>

Inheritance diagram for PointeredStack:

ContainingStack< PointeredStackItem > List of all members.

Detailed Description

A PointeredStack contains a variable number of items, that are stacked on top of each other and are only accessable one by one from the top end of the stack.

The chaining makes enqueueing and dequeueing fast.

Note:
PointeredStacks contain PointeredStackItems, that are a little less performant, but may be added twice to the same stack, and be added to two different stacks. If do not require this, use the ContainingStack and ContainingStackItem. To use PointeredStacks, store your data in the data field of the PointeredStackItem.
See also:
ContainingStack

ContainingStackItem

Author:
Thomas Jacob

Definition at line 203 of file Stack.h.

Public Member Functions

bool Delete ()
 Deletes the top item from the stack.

void DeleteAll ()
 Deletes all items from the stack.

long GetCount () const
 Returns the number of items in the stack.

bool IsEmpty () const
 Returns, if there are no items in the stack.

PointeredStackItemPeek () const
 Returns the top item of the stack.

 PointeredStack ()
 Creates a new PointeredStack.

PointeredStackItemPop ()
 Removes the top item of the stack.

void PopAll ()
 Removes all items from the stack without freeing them or returning them.

void Push (PointeredStackItem *NewItem)
 Puts an item on the top of the stack.

virtual ~PointeredStack ()
 Destroys the PointeredStack.


Constructor & Destructor Documentation

PointeredStack  ) 
 

Creates a new PointeredStack.

virtual ~PointeredStack  )  [virtual]
 

Destroys the PointeredStack.

When deleting the stack, all contained items are also freed. Since the data is only pointered to and not held in the items, this has no effect to the data in the items.


Member Function Documentation

bool Delete  )  [inherited]
 

Deletes the top item from the stack.

The item is removed from the stack and freed.

Returns:
If the deletion was successful.

void DeleteAll  )  [inherited]
 

Deletes all items from the stack.

All items are removed from the stack and freed.

long GetCount  )  const [inline, inherited]
 

Returns the number of items in the stack.

Returns:
The number of items in the stack.

bool IsEmpty  )  const [inline, inherited]
 

Returns, if there are no items in the stack.

PointeredStackItem * Peek  )  const [inline, inherited]
 

Returns the top item of the stack.

Returns:
The top item of the stack.

PointeredStackItem * Pop  )  [inherited]
 

Removes the top item of the stack.

The item is not freed, but returned.

Returns:
The item.

void PopAll  )  [inherited]
 

Removes all items from the stack without freeing them or returning them.

Warning:
No item is freed, so you have to have a pointer to the objects, or the memory is lost.

void Push PointeredStackItem NewItem  )  [inherited]
 

Puts an item on the top of the stack.

Parameters:
Item The item to be put on top.


The documentation for this class was generated from the following file:
Generated on Tue Oct 3 00:23:40 2006 for ToolBox by doxygen 1.3.6