//  class ThingList	--  a list of Things
//
//	Version 1.0	--  2/25/91
//
//	Michael Kelly	--  Author
//
//	See class Thing ( Thing.hpp )
//
#if !defined(TH_LIST_HPP)
#define TH_LIST_HPP

#include "thing.hpp"

class ThingList  {

  struct thing_node  {
    thing_node  *next;
    Thing  	*this_thing;
  };

  thing_node  	*head,
		*rover;

  unsigned	nodes;

  public:

    ThingList()
    {
	head = rover = NULL;
	nodes = 0;
    }
    ThingList( Thing &some_thing )
    {
	if( head = new thing_node )  {
	    head->this_thing = &some_thing;
	    head->next = NULL;
	    nodes = 1;
	}
	else  {
	    head = rover = NULL;
	    nodes = 0;
	}
    }

    ~ThingList();

    int 	add( Thing &some_thing );
    unsigned    iterate( void ( Thing::*funcptr )() );
    unsigned	iterate( int  ( Thing::*funcptr )() );
    Thing *operator[]( unsigned index );
    unsigned list_nodes() { return nodes; }
};

#endif
