NAME
ACE_Unbounded_Stack -
Implement a generic LIFO abstract data type.
SYNOPSIS
#include <ace/Stack.h>
template<class T>
class ACE_Unbounded_Stack
{
public:
ACE_Unbounded_Stack (void);
ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s);
void operator= (const ACE_Unbounded_Stack<T> &s);
~ACE_Unbounded_Stack (void);
void push (const T &new_item);
void pop (T &item);
void top (T &item) const;
int is_empty (void) const;
int is_full (void) const;
static void delete_free_list (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
void delete_all_nodes (void);
void copy_all_nodes (const ACE_Unbounded_Stack<T> &s);
ACE_Stack_Node<T> *head_;
ACE_Stack_Node<T> *last_resort_;
};
DESCRIPTION
This implementation of an unbounded Stack uses a linked list.
Initialization, assignemnt, and termination methods.
ACE_Unbounded_Stack (void);
Initialize a new stack so that it is empty.
ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s);
The copy constructor (performs initialization).
void operator= (const ACE_Unbounded_Stack<T> &s);
Assignment operator (performs assignment).
~ACE_Unbounded_Stack (void);
Perform actions needed when stack goes out of scope.
Classic Stack operations.
void push (const T &new_item);
Place a new item on top of the stack. Does not check if the
stack is full.
void pop (T &item);
Remove and return the top stack item. Does not check if stack
is full.
void top (T &item) const;
Return top stack item without removing it. Does not check if
stack is empty.
Check boundary conditions for Stack operations.
int is_empty (void) const;
Returns 1 if the stack is empty, otherwise returns 0.
int is_full (void) const;
Returns 1 if the stack is full, otherwise returns 0.
static void delete_free_list (void);
Returns all dynamic memory on the free list to the free store.
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
AUTHOR
Doug Schmidt
LIBRARY
ace