-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdomain.h
50 lines (41 loc) · 984 Bytes
/
domain.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
#pragma once
#include <vector>
#include <string>
#include <memory>
#include <set>
#include "geo.h"
//Bus Stop structure
struct Stop {
std::string name;
tg::detail::Coordinates coordinates;
};
//Bus structure
struct Bus {
std::string name;
std::vector<const Stop*> stops;
bool isCircle;
};
struct BusStatistics {
int stops = 0;
int unique_stops = 0;
int route_length = 0;
double curvature = 1.0;
};
struct BusComparator {
bool operator()(std::shared_ptr<Bus> lhs,
std::shared_ptr<Bus> rhs) const {
return lexicographical_compare(
lhs->name.begin(), lhs->name.end(),
rhs->name.begin(), rhs->name.end());
}
};
struct StopComparator {
bool operator()(std::shared_ptr<Stop> lhs,
std::shared_ptr<Stop> rhs) const {
return lexicographical_compare(
lhs->name.begin(), lhs->name.end(),
rhs->name.begin(), rhs->name.end());
}
};
using Buses = std::set<std::shared_ptr<Bus>, BusComparator>;
using Stops = std::set<std::shared_ptr<Stop>, StopComparator>;