//----------------------------------------------------------------------
//  SPECIFICATION FILE (ustack.h)
//  This module exports an ADT for a stack of integer values.
//  The maximum stack depth is MAX_DEPTH, an unspecified value.
//  Stacks are defined as sequences where the front of the sequence
//  is the top of the stack.
//----------------------------------------------------------------------
#include "bool.h"

// DOMAIN: An IntStack instance is a collection of integer values

struct NodeType;   // Complete declaration hidden in
                   // implementation file

class IntStack {
public:
    Boolean IsEmpty() const;
        // POST: FCTVAL == (Length(stack) == 0)

    Boolean IsFull() const;
        // POST: FCTVAL == (Length(stack) == MAX_DEPTH)

    void Push( /* in */ int newItem );
        // PRE:  Length(stack) < MAX_DEPTH  &&  Assigned(newItem)
        // POST: stack == AppendFront(stack<entry>,newItem)

    int Top() const;
        // PRE:  Length(stack) >= 1
        // POST: FCTVAL == Front(stack)

    void Pop();
        // PRE:  Length(stack) >= 1
        // POST: stack == RemoveFront(stack<entry>)

    IntStack();
        // Constructor
        // POST: Created(stack)  &&  stack == <>

    IntStack( const IntStack& otherStk );
        // Copy-constructor
        // POST: Created(stack)  &&  stack == otherStk

    ~IntStack();
        // Destructor
        // POST: NOT Created(stack)
private:
    NodeType* top;
};

