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>

List of all members.

Public 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.

int push (const T &new_item)
int pop (T &item)
int top (T &item) const
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.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

size_t size_
 Size of the allocated data.

size_t top_
 Keeps track of the current top of stack.

stack_ [ACE_SIZE]
 Holds the stack's contents.


Detailed Description

template<class T, size_t ACE_SIZE> template class ACE_Fixed_Stack

Implement a generic LIFO abstract data type.

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


Constructor & Destructor Documentation

template<classT, size_tACE_SIZE>
ACE_Fixed_Stack<T, ACE_SIZE>::ACE_Fixed_Stack<T, ACE_SIZE> ( void )
 

Initialize a new stack so that it is empty.

template<classT, size_tACE_SIZE>
ACE_Fixed_Stack<T, ACE_SIZE>::ACE_Fixed_Stack<T, ACE_SIZE> ( const ACE_Fixed_Stack< T,ACE_SIZE >& s )
 

The copy constructor (performs initialization).

template<classT, size_tACE_SIZE>
ACE_Fixed_Stack<T, ACE_SIZE>::~ACE_Fixed_Stack<T, ACE_SIZE> ( void )
 

Perform actions needed when stack goes out of scope.


Member Function Documentation

template<classT, size_tACE_SIZE>
void ACE_Fixed_Stack<T, ACE_SIZE>::dump ( void ) const
 

Dump the state of an object.

template<classT, size_tACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T,ACE_SIZE >::is_empty ( void ) const
 

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

template<classT, size_tACE_SIZE>
ACE_INLINE int ACE_Fixed_Stack< T,ACE_SIZE >::is_full ( void ) const
 

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

template<classT, size_tACE_SIZE>
void ACE_Fixed_Stack<T, ACE_SIZE>::operator= ( const ACE_Fixed_Stack< T,ACE_SIZE >& s )
 

Assignment operator(performs assignment).

template<classT, size_tACE_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<classT, size_tACE_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<classT, size_tACE_SIZE>
ACE_INLINE size_t ACE_Fixed_Stack< T,ACE_SIZE >::size ( void ) const
 

The number of items in the stack.

template<classT, size_tACE_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<classT, size_tACE_SIZE>
ACE_Fixed_Stack<T, ACE_SIZE>::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

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

Size of the allocated data.

template<classT, size_tACE_SIZE>
T ACE_Fixed_Stack<T, ACE_SIZE>::stack_[ACE_SIZE] [private]
 

Holds the stack's contents.

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

Keeps track of the current top of stack.


The documentation for this class was generated from the following files:
Generated at Fri Oct 5 07:02:05 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000