My Project
bus.h
Go to the documentation of this file.
1 
6 #ifndef SRC_BUS_H_
7 #define SRC_BUS_H_
8 
9 #include <iostream>
10 #include <list>
11 #include <string>
12 
13 #include "src/passenger.h"
14 #include "src/route.h"
15 #include "src/stop.h"
16 #include "src/data_structs.h"
17 
18 class PassengerUnloader;
19 class PassengerLoader;
20 class Route;
21 class Stop;
22 
28 class Bus {
29  public:
40  Bus(std::string name, Route * out, Route * in, int capacity = 60,
41  double speed = 1);
42 
43  bool LoadPassenger(Passenger *);
51  bool Move();
59  void Update();
60  void Report(std::ostream &out);
65  bool IsTripComplete();
70  int UnloadPassengers(Stop * stop);
75  void UpdateBusData();
85  std::string GetName() const;
89  Stop * GetNextStop();
98  size_t GetNumPassengers();
102  int GetCapacity();
103 
104  private:
105  std::list<Passenger *> passengers_;
106  int passenger_max_capacity_;
107  std::string name_;
108  double speed_; // could also be called "distance travelled in one time step"
109  Route * outgoing_route_;
110  Route * incoming_route_;
111  double distance_remaining_; // when negative?, unload/load procedure occurs
112  // AND next stop set
113  BusData bus_data_;
114  // double revenue_; // revenue collected from passengers, doesn't include
115  // passengers who pay on deboard
116  // double fuel_; // may not be necessary for our simulation
117  // double max_fuel_;
118 };
119 #endif // SRC_BUS_H_
BusData
Structure for bus data used for visualization simulation.
Definition: data_structs.h:26
Bus::UpdateBusData
void UpdateBusData()
Method to update bus data.
Definition: bus.cc:98
Stop
The main class to define stop.
Definition: stop.h:22
stop.h
Bus::GetNumPassengers
size_t GetNumPassengers()
Getter of number of passengers on bus.
Definition: bus.cc:135
Bus::Move
bool Move()
Method to decide if the bus is moving.
Definition: bus.cc:48
Bus::IsTripComplete
bool IsTripComplete()
Method to indicate if the bus complete all routes.
Definition: bus.cc:44
Bus
The main class to define bus.
Definition: bus.h:28
route.h
Bus::Update
void Update()
Method to update the status of bus.
Definition: bus.cc:59
Bus::GetName
std::string GetName() const
Getter of bus name.
Definition: bus.cc:114
Bus::UnloadPassengers
int UnloadPassengers(Stop *stop)
Method to unload passenger to a stop.
Definition: bus.cc:31
Bus::GetPreviousStop
Stop * GetPreviousStop()
Getter of pointer to previous stop.
Definition: bus.cc:127
Bus::GetBusData
BusData GetBusData()
Getter of bus data.
Definition: bus.cc:110
Bus::Bus
Bus(std::string name, Route *out, Route *in, int capacity=60, double speed=1)
Constructs a bus with a standard name, two route pointers, passenger capacity and speed.
Definition: bus.cc:8
Route
The main class to define route.
Definition: route.h:25
Passenger
The main class to define passenger.
Definition: passenger.h:17
passenger.h
Bus::GetCapacity
int GetCapacity()
Getter of pointer to bus capacity.
Definition: bus.cc:138
Bus::GetNextStop
Stop * GetNextStop()
Getter of pointer to next stop.
Definition: bus.cc:118