#ifndef _HH_STACK_ #define _HH_STACK_ /* ================================================================================ hhStack: List based stack ================================================================================ */ template< class type > class hhStack : public idList { public: hhStack(int newgranularity = 16); ~hhStack(); type Top(void); type Pop(void); void Push(type& object); bool Empty(void); void Clear(void); }; template< class type > hhStack::hhStack(int newgranularity) { SetGranularity(newgranularity); } template< class type > hhStack::~hhStack(void) { } template< class type > ID_INLINE type hhStack::Top(void) { assert(Num() > 0); return list[Num() - 1]; } template< class type > ID_INLINE type hhStack::Pop(void) { assert(Num() > 0); type obj = Top(); SetNum(Num() - 1, false); return obj; } template< class type > ID_INLINE void hhStack::Push(type& object) { Append(object); } template< class type > ID_INLINE bool hhStack::Empty(void) { return Num() == 0; } template< class type > ID_INLINE void hhStack::Clear(void) { idList::Clear(); } #endif