diff options
Diffstat (limited to 'src/network_set.h')
-rw-r--r-- | src/network_set.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/network_set.h b/src/network_set.h index cec3f39..0f72052 100644 --- a/src/network_set.h +++ b/src/network_set.h | |||
@@ -7,21 +7,29 @@ | |||
7 | #include <utility> | 7 | #include <utility> |
8 | #include <vector> | 8 | #include <vector> |
9 | 9 | ||
10 | struct NetworkNode { | ||
11 | int entry; | ||
12 | int exit; | ||
13 | bool two_way; | ||
14 | |||
15 | bool operator<(const NetworkNode& rhs) const; | ||
16 | }; | ||
17 | |||
10 | class NetworkSet { | 18 | class NetworkSet { |
11 | public: | 19 | public: |
12 | void Clear(); | 20 | void Clear(); |
13 | 21 | ||
14 | void AddLink(int id1, int id2); | 22 | void AddLink(int id1, int id2, bool two_way); |
15 | 23 | ||
16 | void AddLinkToNetwork(int network_id, int id1, int id2); | 24 | void AddLinkToNetwork(int network_id, int id1, int id2, bool two_way); |
17 | 25 | ||
18 | bool IsItemInNetwork(int id) const; | 26 | bool IsItemInNetwork(int id) const; |
19 | 27 | ||
20 | const std::set<std::pair<int, int>>& GetNetworkGraph(int id) const; | 28 | const std::set<NetworkNode>& GetNetworkGraph(int id) const; |
21 | 29 | ||
22 | private: | 30 | private: |
23 | 31 | ||
24 | std::map<int, std::set<std::pair<int, int>>> network_by_item_; | 32 | std::map<int, std::set<NetworkNode>> network_by_item_; |
25 | }; | 33 | }; |
26 | 34 | ||
27 | #endif /* end of include guard: NETWORK_SET_H_3036B8E3 */ | 35 | #endif /* end of include guard: NETWORK_SET_H_3036B8E3 */ |