/*****************************************************************************
* 	Project 	: Network Based Message Queue System		    **
*	Course		: CIS 650 - Software Engineering		    **
*	Location 	: /research/paraducks3/courses/cis650/proj/rt	    **
*	File		: lconn.h					    **
*	Description 	: ListOfConnections of connections (sockets)			    **
*****************************************************************************/

class ListOfConnectionsItem                  /* an item on the list of socket descriptors*/
{                          
public:  int sockFD;            /* socket descriptor */
         ListOfConnectionsItem* next;        /* pointer to the next element on the list */
         ListOfConnectionsItem(int sfd) ;    /* constructor with socketdescriptor as arg */
         ListOfConnectionsItem() ;           /* constructor with no args */ 
	 
};

class ListOfConnections                      /* list class for socket descriptors */
{
private:                       
        ListOfConnectionsItem* first;        /* head of the list */
	ListOfConnectionsItem* last;         /* tail of the list */
	ListOfConnectionsItem* counter;      /* present position of the counter */
	                        /* for iterating thru the list */
        int cardinality;        /* number of elements on list */
public:          
	ListOfConnections();                 /* constructor of list with no arguments */
	~ListOfConnections();                /* destructor */

	void add_item(int sockID);  /* add an item to the list */
	void delete_item(int sockID); /* delete an item from the list  */
	int is_empty();               /* is the list empty ? */
	int next();                   /* output the next list element */
	int max();                    /* the maximum socket descriptor */
        void reset();                /* reset the counetr to the head of list*/
        int number_of_elements();    /* number of elements on the list */
};
 


