next up previous contents
Next: Testing the delete Operator Up: Using Various SLLIST Objects: Previous: Using Various SLLIST Objects:

Testing INT_SLLIST Instantiation:

We instantiate an int list object Qaitlin, fill the list with the build_list agent, delete an element from the list and output the list Qaitlin via the overloaded output operator.

#include "simulation.h"

int main(void)
{
  {
  int input[10] = {2,2,3};

  cout << "Instantiating List Qaitlin" << endl;
  INT_SLLIST Qaitlin("intQa1");

  cout << endl << "Building Qaitlin List" << endl;
  Qaitlin.build_list(input,3);
  cout << "Qaitlin has " << Qaitlin.get_number_elements() << " elements";
  cout << endl;
  cout << endl << "Qaitlin = " << endl << Qaitlin << endl;

  cout << endl << "Delete the element 2 " << endl;
  Qaitlin.delete_element(2);
  cout << endl << "Qaitlin = " << endl << Qaitlin << endl;
  cout << "Qaitlin has " << Qaitlin.get_number_elements() << " elements";
  }

The corresponding output is:

Instantiating List Qaitlin
In default SLLIST<intQa1> constructor.
Exit default SLLIST<intQa1> constructor.

Building Qaitlin List
In SLLIST<intQa1> build_list.
Exit SLLIST<intQa1> build_list.
Qaitlin has 3 elements

Qaitlin = 
2-->2-->3.

Delete the element 2 

Qaitlin = 
3.

Qaitlin has 1 elements
Entering SLLIST<intQa1> destructor.
     Removing SL_CELL -1
Leaving SLLIST destructor.



Jim Peterson
1999-04-22