00001 00014 #ifndef __DATA_STACK_H__ 00015 #define __DATA_STACK_H__ 00016 00017 #include <data_holder.h> 00018 00024 template <class ItemType> class DataStack : protected DataHolder<ItemType> { 00025 public: 00030 DataStack(unsigned long size) throw (NotEnoughMemoryException) 00031 : DataHolder<ItemType>(size) { 00032 } 00033 00039 inline ItemType get() { 00040 assert (!isEmpty()); 00041 00042 --last; 00043 return pool[last]; 00044 } 00045 00050 inline bool isEmpty() { 00051 return last == 0; 00052 } 00053 00059 inline bool isFull() { 00060 return last == (getSize() - 1); 00061 } 00062 00063 }; 00064 00065 #endif // ! __DATA_STACK_H__