## NAME

ACE_Fixed_Stack - Implement a generic LIFO abstract data type.

## SYNOPSIS

    #include <ace/Containers.h>

    template<class T, size_t ACE_SIZE>
    class ACE_Fixed_Stack
    {
      public:
        ACE_Fixed_Stack (void);
        ACE_Fixed_Stack (const ACE_Fixed_Stack<T, ACE_SIZE> &s);
        void operator= (const ACE_Fixed_Stack<T, ACE_SIZE> &s);
        ~ACE_Fixed_Stack (void);
        int push (const T &new_item);
        int pop (T &item);
        int top (T &item) const;
        int is_empty (void) const;
        int is_full (void) const;
        size_t size (void) const;
        void dump (void) const;
        ACE_ALLOC_HOOK_DECLARE;
      private:
        size_t size_;
        size_t top_;
        T stack_[ACE_SIZE];
    };

## DESCRIPTION

This implementation of a Stack uses a fixed array with the size fixed at instantiation time.

## Initialization, assignemnt, and termination methods.

    ACE_Fixed_Stack (void);

Initialize a new stack so that it is empty.

    ACE_Fixed_Stack (const ACE_Fixed_Stack<T, ACE_SIZE> &s);

The copy constructor (performs initialization).

    void operator= (const ACE_Fixed_Stack<T, ACE_SIZE> &s);

Assignment operator (performs assignment).

    ~ACE_Fixed_Stack (void);

Perform actions needed when stack goes out of scope.

## Classic Stack operations.

    int push (const T &new_item);

Place a new item on top of the stack. Returns -1 if the stack is already full, 0 if the stack is not already full, and -1 if failure occurs.

    int pop (T &item);

Remove and return the top stack item. Returns -1 if the stack is already empty, 0 if the stack is not already empty, and -1 if failure occurs.

    int top (T &item) const;

Return top stack item without removing it. Returns -1 if the stack is already empty, 0 if the stack is not already empty, and -1 if failure occurs.

## Check boundary conditions.

    int is_empty (void) const;

Returns 1 if the container is empty, otherwise returns 0.

    int is_full (void) const;

Returns 1 if the container is full, otherwise returns 0.

    size_t size (void) const;

The number of items in the stack.

    void dump (void) const;

Dump the state of an object.

    ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace