CISC 2200 Project 4
Classes | Typedefs | Functions
proj4.cc File Reference
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <queue>
Include dependency graph for proj4.cc:

Classes

struct  Event
 This holds the information needed for an arrival or departure event. More...
 
struct  EventList
 holds arrival and departure events that haven't yet arrived at the bank More...
 

Typedefs

using EventPQType = priority_queue< Event >
 Shorthand for how we implement the EventList.
 
using BankQType = queue< Event >
 Shorthand for how we represent the customers who have queued up at the bank. More...
 

Functions

bool operator< (const Event &e0, const Event &e1)
 Less-than operator for Events. More...
 
istream & operator>> (istream &is, Event &e)
 Input stream extraction operator for Events. More...
 
void processArrival (const Event &e, EventPQType &epq, BankQType &bq, bool &tellerAvailable)
 process an arrival event More...
 
int processDeparture (const Event &e, EventPQType &epq, BankQType &bq, bool &tellerAvailable)
 process a departure event More...
 
int main (int argc, char **argv)
 the usual main function
 

Typedef Documentation

using BankQType = queue<Event>

Shorthand for how we represent the customers who have queued up at the bank.

Function Documentation

bool operator< ( const Event e0,
const Event e1 
)

Less-than operator for Events.

This is somewhat counter-intuitive, since the first element of a priority_queue is the greatest element, rather than the smallest element.

Parameters
e0an event
e1an event
Returns
true iff the arrival time for e0 is later than that of e1
istream& operator>> ( istream &  is,
Event e 
)

Input stream extraction operator for Events.

Parameters
isthe input stream
ethe Event to be extracted from is
Returns
the "new" is
void processArrival ( const Event e,
EventPQType epq,
BankQType bq,
bool &  tellerAvailable 
)

process an arrival event

Parameters
ethe event
epqthe event list
bqthe queue of customers who are actually in line
tellerAvailableis a teller available?
int processDeparture ( const Event e,
EventPQType epq,
BankQType bq,
bool &  tellerAvailable 
)

process a departure event

Parameters
ethe event
epqthe event list
bqthe queue of customers who are actually in line
tellerAvailableis a teller available?
Returns
the waiting time for this departure Event