ACE
6.3.3
|
Implement a generic LIFO abstract data type. More...
#include <Containers_T.h>
Public Member Functions | |
ACE_Fixed_Stack (void) | |
Initialize a new stack so that it is empty. More... | |
ACE_Fixed_Stack (const ACE_Fixed_Stack< T, ACE_SIZE > &s) | |
The copy constructor (performs initialization). More... | |
void | operator= (const ACE_Fixed_Stack< T, ACE_SIZE > &s) |
Assignment operator (performs assignment). More... | |
~ACE_Fixed_Stack (void) | |
Perform actions needed when stack goes out of scope. More... | |
int | push (const T &new_item) |
Constant time placement of element on top of stack. More... | |
int | pop (T &item) |
Constant time removal of top of stack. More... | |
int | top (T &item) const |
Constant time examination of top of stack. More... | |
int | is_empty (void) const |
Returns 1 if the container is empty, otherwise returns 0. More... | |
int | is_full (void) const |
Returns 1 if the container is full, otherwise returns 0. More... | |
size_t | size (void) const |
The number of items in 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... | |
T | stack_ [ACE_SIZE] |
Holds the stack's contents. More... | |
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
ACE_Fixed_Stack< T, ACE_SIZE >::ACE_Fixed_Stack | ( | void | ) |
Initialize a new stack so that it is empty.
Initialize an empty stack.
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< T, ACE_SIZE >::~ACE_Fixed_Stack | ( | void | ) |
Perform actions needed when stack goes out of scope.
Destroy the stack.
void ACE_Fixed_Stack< T, ACE_SIZE >::dump | ( | void | ) | const |
Dump the state of an object.
|
inline |
Returns 1 if the container is empty, otherwise returns 0.
Performs constant time check to see if stack is empty.
|
inline |
Returns 1 if the container is full, otherwise returns 0.
Performs constant time check to see if stack is full.
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.
|
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.
|
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.
|
inline |
The number of items in the stack.
Constant time access to the current size of the stack.
|
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.
ACE_Fixed_Stack< T, ACE_SIZE >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
|
private |
Size of the allocated data.
|
private |
Holds the stack's contents.
|
private |
Keeps track of the current top of stack.