/* ** $Id: stack.h 739 2008-02-09 00:58:20Z phf $ ** ** Interface for a simple stack of integers. Note that ** we don't have error returns in the interface, we do ** assume the client makes all the necessary checks. ** ** Note how we document what is *required* for the call ** to succeed, this is also called a "precondition". */ #ifndef _STACK_H #define _STACK_H /* ** Push a new integer on top of the stack. ** Requires: size() < capacity() */ void push(int); /* ** Pop the top integer off the stack. ** Requires: size() > 0 */ void pop(void); /* ** Return the top integer on the stack. ** Requires: size() > 0 */ int top(void); /* ** Return the number of integers on the stack. */ int size(void); /* ** Return the maximum size of the stack. */ int capacity(void); #endif /* _STACK_H */