// file: $isip/doc/examples/class/dstr/dstr_example_00/example.cc
// version: $Id: example.cc 5947 2000-12-17 17:53:55Z hamaker $
//

// isip include files
//
#include <String.h>
#include <DoubleLinkedList.h>

// main program starts here:
//  this example produces a linked list of randomly generated nonsense strings
//  note that the linked list has two modes - USER and SYSTEM.
//  we use the default mode (SYSTEM) here so that we do not have to deal
//  with memory allocation and deallocation
//
int main() {
  
  // declare a DoubleLinkedList in SYSTEM mode
  //
  DoubleLinkedList<String> list_string;
  
  // add 10 randomly generated strings, all with lengths on the range [5,20],
  // to the linked list
  //
  for (long i = 0; i < 10; i++) {
    
    // generate the random string
    // 
    String tmp_str;
    tmp_str.rand(5,20);
    
    // add the random string to the list. this inserts at the current location
    // and changes the current location to be this item.
    // 
    list_string.insert(&tmp_str);
  }
  
  // display the contents of the list
  // 
  list_string.debug(L"list of random strings");
  
  // exit gracefully
  //
  Integral::exit();
} 
