-
Notifications
You must be signed in to change notification settings - Fork 1
/
transport_router.h
56 lines (45 loc) · 1.42 KB
/
transport_router.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
#pragma once
#include "router.h"
#include "transport_catalogue.h"
struct Routing_settings {
int bus_wait_time{};
double bus_velocity{};
};
struct Route_Element {
std::string type;
std::string stop_name;
std::string bus_name;
double time{};
int span_count{};
};
struct Route_Stat {
int id{};
double total_time{};
std::deque<Route_Element> items;
double bus_wait_time{};
};
struct Edge_props {
const Bus* bus;
int span_count{};
int distance{};
double travel_time{};
std::string_view stop_from;
};
class Transport_router {
public:
Transport_router(graph::DirectedWeightedGraph<double> &routes_graph,
const tc::TransportCatalogue &transport_catalogue, const Routing_settings &routing_settings)
: routes_graph_(routes_graph)
, transport_catalogue_(transport_catalogue)
, routing_settings_(routing_settings) {
}
void CreateGraph();
const Edge_props& GetEdgeProps(graph::EdgeId) const;
const Routing_settings& GetRouterSettings() const;
private:
graph::DirectedWeightedGraph<double>& routes_graph_; // will be modified
const tc::TransportCatalogue& transport_catalogue_;
const Routing_settings& routing_settings_;
std::unordered_map<graph::EdgeId, Edge_props> edgeID_to_edge_props_;
std::unordered_map<std::pair<graph::VertexId, graph::VertexId>, int, tc::StopsDistanceHash> pair_idx_to_distance_;
};