Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

ArrayStack Class Reference

#include <ArrayStack.hpp>

List of all members.

Public Methods

 ArrayStack ()
 ArrayStack (unsigned long sz)
virtual ~ArrayStack ()
void clear ()
void push (const Elem item)
Elem pop ()
Elem topValue () const
BOOL isEmpty () const
BOOL isFilled () const

Private Attributes

unsigned long size
unsigned long top
Elemlistarray


Constructor & Destructor Documentation

ArrayStack::ArrayStack   [inline]
 

Definition at line 11 of file ArrayStack.hpp.

00012     : size( LIST_SIZE ), top( 0 ) 
00013   {
00014     listarray = new Elem[ LIST_SIZE ];
00015   }

ArrayStack::ArrayStack unsigned long    sz [inline]
 

Definition at line 17 of file ArrayStack.hpp.

00018     : size( LIST_SIZE ), top( 0 ) 
00019   {
00020     listarray = new Elem[sz];
00021   }

virtual ArrayStack::~ArrayStack   [inline, virtual]
 

Definition at line 23 of file ArrayStack.hpp.

00023                                                           : delete the array
00024   {
00025     delete [] listarray;
00026   }


Member Function Documentation

void ArrayStack::clear   [inline]
 

Definition at line 28 of file ArrayStack.hpp.

00029   {
00030     top = 0;
00031     memset( listarray, 0, ( sizeof( Elem ) * LIST_SIZE ) );
00032   }

BOOL ArrayStack::isEmpty   const [inline]
 

Definition at line 54 of file ArrayStack.hpp.

00055   {
00056     return (top == 0);
00057   }

BOOL ArrayStack::isFilled   const [inline]
 

Definition at line 59 of file ArrayStack.hpp.

00060   {
00061     return (top != 0);
00062   }

Elem ArrayStack::pop   [inline]
 

Definition at line 41 of file ArrayStack.hpp.

00042   {
00043     assert( !isEmpty() );
00044     --top;
00045     return listarray[ top ];
00046   }

void ArrayStack::push const Elem    item [inline]
 

Definition at line 34 of file ArrayStack.hpp.

00035   {
00036     assert(top < size);
00037     listarray[top] = item;
00038     top++;
00039   }

Elem ArrayStack::topValue   const [inline]
 

Definition at line 48 of file ArrayStack.hpp.

00049   {
00050     assert( !isEmpty() );
00051     return listarray[ top-1 ];
00052   }


Member Data Documentation

Elem* ArrayStack::listarray [private]
 

Definition at line 67 of file ArrayStack.hpp.

unsigned long ArrayStack::size [private]
 

Definition at line 65 of file ArrayStack.hpp.

unsigned long ArrayStack::top [private]
 

Definition at line 66 of file ArrayStack.hpp.


The documentation for this class was generated from the following file:
Generated on Sun Oct 14 18:48:24 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001