SOURCE FILE: stack.h
// *********************************************************
// Header file stack.h for the ADT stack.
// "strange" implementation.
// *********************************************************
class stackClass
{
public:
/* ######################################## */
/* stackClass() */
/* ######################################## */
/*
This is the default constructor. It initializes the
stack to an empty state.
*/
stackClass();
/* ######################################## */
/* stackClass(copyStack) */
/* ######################################## */
/*
This is the copy constructor. It initializes a new
stack identical to "copyStack."
*/
stackClass(stackClass const & copyStack); // copy constructor
/* ######################################## */
/* StackIsEmpty */
/* ######################################## */
/*
This function returns true if the stack is empty, and
returns false otherwise.
*/
bool StackIsEmpty() const;
/* ######################################## */
/* StackIsFull */
/* ######################################## */
/*
This function returns true if the stack is full, and
returns false otherwise.
*/
bool StackIsFull() const;
/* ######################################## */
/* Push */
/* ######################################## */
/*
If the stack is not full, Push pushes NewItem onto the
stack and sets Success equal to true. If the stack is
full, Push makes no change to the stack and sets
Success equal to false.
*/
void Push(char NewItem, bool& Success);
/* ######################################## */
/* GetStackTop */
/* ######################################## */
/*
GetStackTop makes no change to the stack. If the
stack is not empty, GetStackTop sets StackTop equal to
the top item on the stack (latest item to be pushed)
and sets Success equal to true. If the stack is
empty, GetStackTop makes no change to the stack and
sets Success equal to false.
*/
void GetStackTop(char& StackTop, bool& Success) const;
/* ######################################## */
/* Pop(Success) */
/* ######################################## */
/*
If the stack is not empty, Pop(Success) removes the
top item (latest item to be pushed) from the stack and
sets Success equal to true. If the stack is empty,
Pop(Success) makes no change to the stack and sets
Success equal to false.
*/
void Pop(bool& Success);
/* ######################################## */
/* Pop(StackTop, Success) */
/* ######################################## */
/*
If the stack is not empty, Pop(StackTop, Success)
removes the top item (latest item to be pushed) from
the stack, sets StackTop equal to that item, and sets
Success equal to true. If the stack is empty,
Pop(StackTop, Success) makes no change to the stack
and sets Success equal to false.
*/
void Pop(char& StackTop, bool& Success);
/* ######################################## */
/* StackPrint */
/* ######################################## */
/*
StackPrint makes no change to the stack. If the stack
is not empty, StackPrint prints the contents of the
stack to standard output like this:
--> n
--> u
--> t
StackPrint precedes each stack element with the
string: "--> ". There is one stack element per line.
StackPrint shows the stack elements in the same order
(top first) that the Pop operation would remove them.
If the stack is empty, StackPrint writes nothing at
all.
*/
void StackPrint() const;
private:
/* ######################################## */
/* data */
/* ######################################## */
/*
Data is the single variable that has to store all
the letters in the stack.
*/
unsigned long int data ;
}; // end class
// End of header file.