00001 00042 #ifndef ABA_BSTACK_H 00043 #define ABA_BSTACK_H 00044 00045 #include "abacus/array.h" 00046 00047 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX 00048 template<class Type> 00049 class ABA_BSTACK; 00050 00051 template<class Type> 00052 ostream& operator<< (ostream& out, const ABA_BSTACK<Type> &rhs); 00053 #endif 00054 00055 00056 template <class Type> class ABA_BSTACK : public ABA_ABACUSROOT { 00057 public: 00058 00064 ABA_BSTACK(ABA_GLOBAL *glob, int size); 00065 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX 00066 00075 friend ostream& operator<< <> (ostream&, const ABA_BSTACK<Type> &); 00076 #else 00077 00086 friend ostream& operator<< (ostream& out, const ABA_BSTACK<Type> &rhs); 00087 #endif 00088 00091 int size() const; 00092 00098 int tos() const; 00099 00103 bool empty() const; 00104 00109 bool full() const; 00110 00119 void push(Type item); 00120 00129 Type top() const; 00130 00141 Type pop(); 00142 00151 void realloc (int newSize); 00152 00153 private: 00154 00157 ABA_GLOBAL *glob_; 00158 00161 ABA_ARRAY<Type> stack_; 00162 00165 int tos_; 00166 }; 00167 00168 #include "abacus/bstack.inc" 00169 00170 #endif // ABA_BSTACK_H 00171