ACE 8.0.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
ACE_Fixed_Stack< T, ACE_SIZE > Class Template Reference

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

#include <Containers_T.h>

Public Member Functions

 ACE_Fixed_Stack ()
 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 ()
 Perform actions needed when stack goes out of scope.
 
int push (const T &new_item)
 Constant time placement of element on top of stack.
 
int pop (T &item)
 Constant time removal of top of stack.
 
int top (T &item) const
 Constant time examination of top of stack.
 
int is_empty () const
 Returns 1 if the container is empty, otherwise returns 0.
 
int is_full () const
 Returns 1 if the container is full, otherwise returns 0.
 
size_t size () const
 The number of items in the stack.
 
void dump () 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>
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

◆ ACE_Fixed_Stack() [1/2]

template<class T , size_t ACE_SIZE>
ACE_Fixed_Stack< T, ACE_SIZE >::ACE_Fixed_Stack ( )

Initialize a new stack so that it is empty.

Initialize an empty stack.

◆ ACE_Fixed_Stack() [2/2]

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

The copy constructor (performs initialization).

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

◆ ~ACE_Fixed_Stack()

template<class T , size_t ACE_SIZE>
ACE_Fixed_Stack< T, ACE_SIZE >::~ACE_Fixed_Stack ( )

Perform actions needed when stack goes out of scope.

Destroy the stack.

Member Function Documentation

◆ dump()

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

Dump the state of an object.

◆ is_empty()

template<class T , size_t ACE_SIZE>
int ACE_Fixed_Stack< T, ACE_SIZE >::is_empty ( ) const
inline

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

Performs constant time check to see if stack is empty.

◆ is_full()

template<class T , size_t ACE_SIZE>
int ACE_Fixed_Stack< T, ACE_SIZE >::is_full ( ) const
inline

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

Performs constant time check to see if stack is full.

◆ operator=()

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

Assignment operator (performs assignment).

Perform a deep copy of the provided stack.

◆ pop()

template<class T , size_t ACE_SIZE>
int ACE_Fixed_Stack< T, ACE_SIZE >::pop ( T & item)
inline

Constant time removal of top of stack.

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.

◆ push()

template<class T , size_t ACE_SIZE>
int ACE_Fixed_Stack< T, ACE_SIZE >::push ( const T & new_item)
inline

Constant time placement of element on top of stack.

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.

◆ size()

template<class T , size_t ACE_SIZE>
size_t ACE_Fixed_Stack< T, ACE_SIZE >::size ( ) const
inline

The number of items in the stack.

Constant time access to the current size of the stack.

◆ top()

template<class T , size_t ACE_SIZE>
int ACE_Fixed_Stack< T, ACE_SIZE >::top ( T & item) const
inline

Constant time examination of top of stack.

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

◆ ACE_ALLOC_HOOK_DECLARE

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

Declare the dynamic allocation hooks.

◆ size_

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

Size of the allocated data.

◆ stack_

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

Holds the stack's contents.

◆ top_

template<class T , size_t ACE_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: