// custqueue.h: the CustQueue class, representing one lineup of customers
// at the a cashier. (modified from car queue) now there are many queues

#ifndef _CUSTQUEUE_H
#define _CUSTQUEUE_H

#include "cust.h"

class Cashier;

class CustQueue {
private:

   // QueueItem: the type for objects stored in the customer queue.
   struct QueueItem {
      // A customer queue is a linked list, so each item contains a data field
      // and a "next item" field.
      Cust *data;
      QueueItem *next;
   };

   QueueItem *firstWaitingCust;
   QueueItem *lastWaitingCust;
   int queueSize;
   double totalEmptyQueueTime;

public:

   // Constructor.
   // The list of "name (value)" pairs after the colon and before the
   // constructor body provides initial values for those data members.
   CustQueue () :
     firstWaitingCust (0), lastWaitingCust (0), queueSize (0),
     totalEmptyQueueTime (0) {}

   // getEmptyTime: return the total time this customer queue has been empty.
   double getEmptyTime ();

   // getQueueSize: return the number of customers in this queue.
   int getQueueSize () { return queueSize; }

   // insert: put a newly-arrived cust into the cust queue.
   void insert (Cust *newestCust);

   // takeFirstCust: remove first cust from queue and return it.
   Cust *takeFirstCust ();
};

#endif
