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

C:/temp/src/j2k/DataType/Parenth.Frd/Stack.hpp

Go to the documentation of this file.
00001 // Stack.hpp - Class interface for a stack using
00002 // using single link nodes with a freelist to store the stack
00003 // and a DBase object to store the information of the stack
00004 
00005 #ifndef __STACK_HPP__
00006 #define __STACK_HPP__           // To avoid multiple declaration of a class
00007 
00008 #include "../Const.hpp"            // All the constants
00009 #include "DBase.hpp"            // Data holding class
00010 #include "Link.hpp"           // Single-sided Link class
00011 
00012 class Stack {
00013 
00014 public:
00015     Stack();                            // Default Constructor
00016     Stack( DBase* item );            // First Item Constructor
00017 
00018     Stack( const Stack& stk  );         // Copy Constructor
00019                               // Create a new stack with
00020                                // a new copy of each elements
00021 
00022     void    push( DBase* item );    // Insert an item at the top
00023     DBase*  pop();                      // Remove an item from the top
00024     DBase&  topValue() const;           // What's the top Value ?
00025    void    clear();                    // Clear the stack
00026    void    display()  const;        // Display a debugging stack output
00027 
00028 
00029 // Inline optimization to make the class run faster
00030 // *** DO NOT MODIFY THIS SCRIPT !!! ***
00031 
00032 virtual ~Stack() {                  // Destructor
00033    clear();
00034 }
00035 
00036 inline int getSize() const {
00037     return size;
00038 }
00039 
00040 inline bool isEmpty() const {       // The Stack is empty ?
00041     return ( top == NULL ) || ( size < 1 );
00042 }
00043 
00044 inline bool isNotEmpty() const {    // The Stack is not empty ?
00045     return ( top != NULL ) && ( size > 0 );
00046 }
00047 
00048 
00049 private:
00050     Link* top;                          // Pointer to the top item
00051     int   size;                         // Size of the stack
00052 };
00053 
00054 #endif  // __STACK_HPP__

Generated on Sun Oct 14 18:46:18 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001