#include <OTC/collctn/stack.hh> template<class T> class OTC_Stack {
public:
static os_typespec* get_os_typespec();
inline ~OTC_Stack();
OTC_Stack();
OTC_Stack(OTC_Stack<T> const& theStack);
OTC_Stack<T>& operator=(OTC_Stack<T> const& theStack);
inline OTC_Boolean isEmpty() const;
inline u_int count() const;
inline T& top();
inline T const& top() const;
void push(T const& theItem);
T pop();
inline void clear();
void discard(u_int theCount);
};
OTC_Stack
implements a LIFO or stack. Note, that it is the
user's responsibility to deal with deletion of objects held in the
stack, when it is parameterised over a pointer type; ie., this
class works independently of the OTC_BaseActions
class.
OTC_Stack();
OTC_Stack(OTC_Stack<T> const& theStack);
theStack
. If the stack holds pointers,
only the value of the pointers is copied,
not what the pointer points at.
OTC_Stack<T>& operator=(OTC_Stack<T> const& theStack);
theStack
. If the stack holds pointers,
only the value of the pointers is copied,
not what the pointer points at.
inline OTC_Boolean isEmpty() const;
OTCLIB_TRUE
if the stack is
empty.
inline u_int count() const;
inline T& top();
inline T const& top() const;
void push(T const& theItem);
theItem
onto the top of
the stack.
T pop();
inline void clear();
void discard(u_int theCount);
theCount
items on the
stack. If there are not that many items on
the stack, an exception is raised.
OTC_BoundedStack
may
be more appropriate.
OTC_BoundedStack