My Project
route.h
Go to the documentation of this file.
1 
7 #ifndef SRC_ROUTE_H_
8 #define SRC_ROUTE_H_
9 
10 #include <list>
11 #include <iostream>
12 #include <string>
13 
14 #include "./passenger_generator.h"
15 #include "./stop.h"
16 #include "./data_structs.h"
17 
18 class PassengerGenerator;
19 class Stop;
25 class Route {
26  public:
36  Route(std::string name, Stop ** stops, double * distances, int num_stops,
41  Route * Clone();
42  void Update();
43  void Report(std::ostream&);
47  bool IsAtEnd() const;
51  void NextStop(); // Change destination_stop_ to next stop
52 
57  Stop * GetDestinationStop() const; // Get pointer to next stop
58  // double GetTotalRoteDistance() const;
63  double GetNextStopDistance();
68  Stop * GetNextStop();
78  std::string GetName();
83  std::list<Stop *> GetStops();
87  void UpdateRouteData();
92 
93  private:
94  int GenerateNewPassengers(); // generates passengers on its route
95  PassengerGenerator * generator_;
96  std::list<Stop *> stops_;
97  std::list<double> distances_between_; // length = num_stops_ - 1
98  std::string name_;
99  int num_stops_;
100  RouteData route_data_;
101  int destination_stop_index_; // always starts at zero, no init needed
102  Stop * destination_stop_;
103  Stop * previous_stop_;
104  // double trip_time_; // derived data - total distance travelled on route
105 };
106 #endif // SRC_ROUTE_H_
Route::GetStops
std::list< Stop * > GetStops()
list of stops
Definition: route.cc:105
Stop
The main class to define stop.
Definition: stop.h:22
PassengerGenerator
Virtual class for the generation of passengers.
Definition: passenger_generator.h:19
Route::Clone
Route * Clone()
Copy a route.
Definition: route.cc:28
stop.h
Route::GetDestinationStop
Stop * GetDestinationStop() const
Get pointer to next stop.
Definition: route.cc:83
RouteData
Structure for route data used for visualization simulation.
Definition: data_structs.h:47
Route::NextStop
void NextStop()
Change destination_stop_ to next stop.
Definition: route.cc:50
Route::GetNextStop
Stop * GetNextStop()
Get pointer to next stop.
Definition: route.cc:58
Route::UpdateRouteData
void UpdateRouteData()
Update route data.
Definition: route.cc:109
Route::GetRouteData
RouteData GetRouteData()
Getter of route data.
Definition: route.cc:127
Route::GetName
std::string GetName()
Get name of the route.
Definition: route.cc:101
passenger_generator.h
Route::Route
Route(std::string name, Stop **stops, double *distances, int num_stops, PassengerGenerator *)
Constructs a route.
Definition: route.cc:8
Route::GetPreviousStop
Stop * GetPreviousStop()
Get pointer to previous stop.
Definition: route.cc:62
Route
The main class to define route.
Definition: route.h:25
Route::GetNextStopDistance
double GetNextStopDistance()
Get distance to next stop.
Definition: route.cc:72
Route::IsAtEnd
bool IsAtEnd() const
Decide if a route is finished.
Definition: route.cc:46