Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Fixed_Stack Class Template Reference

Implement a generic LIFO abstract data type. More...

#include <Containers_T.h>

Collaboration diagram for ACE_Fixed_Stack:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Fixed_Stack (void)
 Initialize an empty stack. More...

 ACE_Fixed_Stack (const ACE_Fixed_Stack< T, ACE_SIZE > &s)
 Initialize the stack and copy the provided stack into the current stack. More...

void operator= (const ACE_Fixed_Stack< T, ACE_SIZE > &s)
 Perform a deep copy of the provided stack. More...

 ~ACE_Fixed_Stack (void)
 Destroy the stack. More...

int push (const T &new_item)
 Place a new item on top of the stack. More...

int pop (T &item)
 Remove and return the top stack item. More...

int top (T &item) const
 Return top stack item without removing it. More...

int is_empty (void) const
 Performs constant time check to see if stack is empty. More...

int is_full (void) const
 Performs constant time check to see if stack is full. More...

size_t size (void) const
 Constant time access to the current size of the stack. More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

size_t size_
 Size of the allocated data. More...

size_t top_
 Keeps track of the current top of stack. More...

stack_ [ACE_SIZE]
 Holds the stack's contents. More...


Detailed Description

template<class T, size_t ACE_SIZE>
class ACE_Fixed_Stack< T, ACE_SIZE >

Implement a generic LIFO abstract data type.

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

Requirements and Performance Characteristics


Constructor & Destructor Documentation

template<class T, size_t ACE_SIZE>
ACE_Fixed_Stack< T, ACE_SIZE >::ACE_Fixed_Stack void   
 

Initialize an empty stack.

template<class T, size_t ACE_SIZE>
ACE_Fixed_Stack< T, ACE_SIZE >::ACE_Fixed_Stack const ACE_Fixed_Stack< T, ACE_SIZE > &    s
 

Initialize the stack and copy the provided stack into the current stack.

template<class T, size_t ACE_SIZE>
ACE_Fixed_Stack< T, ACE_SIZE >::~ACE_Fixed_Stack void   
 

Destroy the stack.


Member Function Documentation

template<class T, size_t ACE_SIZE>
void ACE_Fixed_Stack< T, ACE_SIZE >::dump void    const
 

Dump the state of an object.

template<class T, size_t ACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T, ACE_SIZE >::is_empty void    const
 

Performs constant time check to see if stack is empty.

template<class T, size_t ACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T, ACE_SIZE >::is_full void    const
 

Performs constant time check to see if stack is full.

template<class T, size_t ACE_SIZE>
void ACE_Fixed_Stack< T, ACE_SIZE >::operator= const ACE_Fixed_Stack< T, ACE_SIZE > &    s
 

Perform a deep copy of the provided stack.

template<class T, size_t ACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T, ACE_SIZE >::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.

template<class T, size_t ACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T, ACE_SIZE >::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.

template<class T, size_t ACE_SIZE>
ACE_INLINE size_t ACE_Fixed_Stack< T, ACE_SIZE >::size void    const
 

Constant time access to the current size of the stack.

template<class T, size_t ACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T, ACE_SIZE >::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.


Member Data Documentation

template<class T, size_t ACE_SIZE>
ACE_Fixed_Stack::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

template<class T, size_t ACE_SIZE>
size_t ACE_Fixed_Stack::size_ [private]
 

Size of the allocated data.

template<class T, size_t ACE_SIZE>
T ACE_Fixed_Stack::stack_[ACE_SIZE] [private]
 

Holds the stack's contents.

template<class T, size_t ACE_SIZE>
size_t ACE_Fixed_Stack::top_ [private]
 

Keeps track of the current top of stack.


The documentation for this class was generated from the following files:
Generated on Tue Aug 20 15:22:10 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001