quick start:g++ [flags ...] file ... #include <Stack.h> Stack(); boolean assign(const Stack<TObject>& copy_stack); boolean push(TObject* item); TObject* pop(TObject* item = (TObject*)NULL); const TObject* peek() const; boolean pop(Stack<TObject>& item_stack, long num_items); boolean clear();
// declare a character stack and push two characters into it
//
Stack<Char> stack;
Char item0(L'a');
Char item1(L'b');
stack.push(&item0);
stack.push(&item1);
// pop the top item from the stack
//
Char* item2 = new Char();
stack.pop(item2);
if(!item2->eq(item1)) {
  // error
}
 
description:
static const String CLASS_NAME = L"Stack";
static const String DEF_PARAM = L"values";
static const long POP_ALL = -1;
static const long POP_TO_MARK = -2;
static const long ERR = 40500;
static const long ERR_EMPTY = 40501
DoubleLinkedList<TObject> stack_d;
ALLOCATION alloc_d;
static Integral::DEBUG debug_level_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
static boolean setDebug(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Stack();
Stack(ALLOCATION alloc = DEF_ALLOCATION);
Stack(const Stack<TObject>& copy_stack);
boolean assign(const Stack<TObject>& copy_stack);
Stack<TObject>& operator=(const Stack<TObject>& arg);
boolean eq(const Stack<TObject>& compare_stack) const;
long sofSize() const;
boolean read(Sof& sof_a, long tag_a);
boolean write(Sof& sof_a, long tag_a) const;
boolean read(Sof& sof_a, long tag_a, const String& name_a);
boolean write(Sof& sof_a, long tag_a, const String& name_a) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);
boolean ne(const Stack<TObject>& compare_stack) const;
boolean push(TObject* item);
boolean push(Stack<TObject>& item_stack);
boolean push(TObject** items, long num_items);
const TObject* peek() const;
TObject* peek();
TObject* pop(TObject* item = (TObject*)NULL);
long pop(Stack& items, long num_items); 
boolean popAll(Stack<TObject>& item_stack);
boolean popToMark(Stack<TObject>& item_stack);
boolean setMark();
boolean clearMark();
boolean markIsSet() const;
const TObject* getMark() const;
TObject* getMark();
boolean isMarkedElement() const;
boolean isEmpty() const;
long length() const;
boolean find(TObject* value);
boolean contains(TObject* value) const;
boolean apply(boolean (TObject::*method)());
boolean apply(boolean (TObject::*method)(), Stack<TObject>& arg);
boolean sort(Integral::ORDER sort_order = Integral::ASCENDING, SORT_ALGO sort_algo = DEF_SORT_ALGO);
boolean reverse();
ALLOCATION getAllocationMode() const;
boolean setAllocationMode(ALLOCATION alloc);
#include <Char.h>
#include <Stack.h>
int main () {
  // local variables
  //
  Stack<Long> s;
  Long j;
  // add 10 items to the stack
  //       
  for (long i = 0; i < 10; i++) {
    j = i * 3;
    s.push(&j);
  }
  // see what is on the stack
  //       
  s.debug(L"after push");
  // pull things off the stack and print them in order
  //       
  while (s.pop(&j) != (Long*)NULL) {
    j.debug(L"pulled off stack");
  }
       
  // exit gracefully
  //
  Integral::exit();
}       
       
  
#include <Char.h>
#include <Stack.h>
int main () {
  // local variables (note that the stack is set to reference mode)
  //
  Stack<Long> s(USER);
  Long* j;
  // add 10 items to the stack
  //       
  for (long i = 0; i < 10; i++) {
    j = new Long(i * 3);
    s.push(j);
  }
  // see what is on the stack
  //       
  s.debug(L"after add");
  // pull things off the stack and print them in order
  //       
  while ((j = s.pop()) != (Long*)NULL) {
    j->debug(L"pulled off stack");
    delete j;
  }
       
  // exit gracefully
  //
  Integral::exit();
}       
       
  
#include <Char.h>
#include <Stack.h>
int main () {
  // prepare items for the stack
  //
  Char** items = new Char*[5];
  for (long i = 0; i < 5; i++) {
     items[i] = new Char((unichar)((long)(L'a') + i));
  }
  // declare a stack and push items into it
  //
  Stack<Char> char_stack;
  char_stack.push(items, 5);
  // copy the stack
  //
  Stack<Char> copy_char_stack(char_stack);
  // see if these Stacks are equivalent
  //
  if(!char_stack.eq(copy_char_stack)) {
       
    // exit with error
    //
    Integral::exit();
    
  }
       
  // clean up the memory used
  //
  for (long i = 0; i < 5; i++) {
    delete items[i]; 
  }
  delete [] items; 
  
  // exit gracefully
  //
  Integral::exit();
}