home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Samples / Collections / Source / Collect.cpp next >
C/C++ Source or Header  |  1996-08-12  |  1KB  |  64 lines

  1. #define INCL_BASE
  2. #define __OCL_RESOLVE_TEMPLATES__
  3.  
  4. #include <ocl.hpp>
  5. #include <OString.hpp>
  6. #include <OStack.hpp>
  7. #include <OQueue.hpp>
  8.  
  9. #if defined(__EMX__)
  10.   template class OStack<OString>;
  11.   template class OQueue<OString>;
  12. #endif
  13.  
  14.  
  15. void main(void)
  16. {
  17.  OStack<OString> strStack;
  18.  OQueue<OString> strQueue;
  19.  OString         a("First");
  20.  OString         b("Second");
  21.  OString         c("Third");
  22.  OString         d("Fourth");
  23.  pOString        temp = NULL;
  24.  
  25.  cout << "Sample Collect"
  26.       << endl
  27.       << (PSZ) OCL::Version()
  28.       << endl;
  29.  
  30.  strQueue.put(a);
  31.  strQueue.put(b);
  32.  strQueue.put(c);
  33.  strQueue.put(d);
  34.  
  35.  cout << strQueue.numberOfElements();
  36.  cout << " elements in queue.";
  37.  cout << endl;
  38.  
  39.  while((temp = strQueue.get()) != NULL)
  40.   {
  41.    cout << temp->getText();
  42.    cout << endl; 
  43.    strStack.push(temp);
  44.   }
  45.  
  46.  cout << strStack.numberOfElements();
  47.  cout << " elements on stack.";
  48.  cout << endl;
  49.  
  50.  while((temp = strStack.pop()) != NULL)
  51.   {
  52.    cout << temp->getText();
  53.    cout << endl; 
  54.   }
  55.  
  56.  cout << strStack.numberOfElements();
  57.  cout << " elements on stack.";
  58.  cout << endl;
  59.  cout << strQueue.numberOfElements();
  60.  cout << " elements in queue.";
  61.  cout << endl;
  62.  
  63.  _exit(0);