00001
00002
00003
00004
00005 #ifndef __STACK_HPP__
00006 #define __STACK_HPP__ // To avoid multiple declaration of a class
00007
00008 #include "../Const.hpp"
00009 #include "DBase.hpp"
00010 #include "Link.hpp"
00011
00012 class Stack {
00013
00014 public:
00015 Stack();
00016 Stack( DBase* item );
00017
00018 Stack( const Stack& stk );
00019
00020
00021
00022 void push( DBase* item );
00023 DBase* pop();
00024 DBase& topValue() const;
00025 void clear();
00026 void display() const;
00027
00028
00029
00030
00031
00032 virtual ~Stack() {
00033 clear();
00034 }
00035
00036 inline int getSize() const {
00037 return size;
00038 }
00039
00040 inline bool isEmpty() const {
00041 return ( top == NULL ) || ( size < 1 );
00042 }
00043
00044 inline bool isNotEmpty() const {
00045 return ( top != NULL ) && ( size > 0 );
00046 }
00047
00048
00049 private:
00050 Link* top;
00051 int size;
00052 };
00053
00054 #endif // __STACK_HPP__