-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaxiDispatch.h
57 lines (50 loc) · 1.33 KB
/
TaxiDispatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Benjy Berkowicz - 336182589
// Advanced Programming 2016-2017 Bar Ilan
//
#ifndef ADVANCED_EX2_TAXIDISPATCH_H
#define ADVANCED_EX2_TAXIDISPATCH_H
class Driver;
class DriverTaxiContainer;
#include "DriverTaxiContainer.h"
#include <map>
#include <vector>
#include <deque>
#include "Driver.h"
#include "Taxi.h"
#include "TripInfo.h"
#include "DriverLocationListener.h"
#include "GridMap.h"
#include "findPath.h"
#include "Clock.h"
#include "Socket.h"
#include "Tcp.h"
/**
* The TaxiDispatcher holds all trip orders as well as taxis, drivers
* and their positions. It keeps track of the locations via listeners
*/
typedef std::map<int, DriverTaxiContainer *>::iterator taxi_driver_iterator;
class TaxiDispatch {
private:
std::map<int, DriverTaxiContainer *> database;
std::deque<TripInfo *> trips;
std::vector<DriverLocationListener *> listeners;
GridMap * gridMap;
findPath router;
Clock clock;
Tcp *tcp;
public:
TaxiDispatch(GridMap *, Clock);
void addTaxi(Taxi *);
void addDriver(Driver *, int);
void closingOperations();
void addTrip(TripInfo *);
// Moves all assigned taxis along their way
void moveOneStep();
Point * getDriverLocation(int id);
void sendTaxi(int id);
void sendTrip();
void assignSocket(Tcp *tcp);
~TaxiDispatch();
};
#endif //ADVANCED_EX2_TAXIDISPATCH_H