Apollo 10.0
自动驾驶开放平台
sub_topo_graph.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <memory>
20#include <unordered_map>
21#include <unordered_set>
22#include <vector>
23
25
26namespace apollo {
27namespace routing {
28
30 public:
31 SubTopoGraph(const std::unordered_map<const TopoNode*,
32 std::vector<NodeSRange>>& black_map);
34
35 // edge: A -> B not sub edge
36 // 1. A has no sub node, B has no sub node
37 // return origin edge A -> B
38 // 2. A has no sub node, B has sub node
39 // return all edge A -> B'
40 // if B is black lane and no valid edge,
41 // return empty set
42 // 3. A has sub node, B has sub node
43 // return empty set
44 // 4. A has sub node, B has no sub node
45 // return empty set
46 // edge: A -> B is sub edge
47 // 1. return empty set
49 const TopoEdge* edge,
50 std::unordered_set<const TopoEdge*>* const sub_edges) const;
51
52 // edge: A -> B not sub edge
53 // 1. A has no sub node, B has no sub node
54 // return origin edge A -> B
55 // 2. A has no sub node, B has sub node
56 // return all edge A -> B'
57 // if B is black lane and no valid edge,
58 // return empty set
59 // 3. A has sub node, B has sub node
60 // return empty set
61 // 4. A has sub node, B has no sub node
62 // return empty set
63 // edge: A -> B is sub edge
64 // 1. return empty set
66 const TopoEdge* edge,
67 std::unordered_set<const TopoEdge*>* const sub_edges) const;
68
69 const TopoNode* GetSubNodeWithS(const TopoNode* topo_node, double s) const;
70
71 private:
72 void InitSubNodeByValidRange(const TopoNode* topo_node,
73 const std::vector<NodeSRange>& valid_range);
74 void InitSubEdge(const TopoNode* topo_node);
75
76 void InitInSubNodeSubEdge(
77 TopoNode* const sub_node,
78 const std::unordered_set<const TopoEdge*> origin_edge);
79 void InitOutSubNodeSubEdge(
80 TopoNode* const sub_node,
81 const std::unordered_set<const TopoEdge*> origin_edge);
82
83 bool GetSubNodes(const TopoNode* node,
84 std::unordered_set<TopoNode*>* const sub_nodes) const;
85
86 void AddPotentialEdge(const TopoNode* topo_node);
87 void AddPotentialInEdge(
88 TopoNode* const sub_node,
89 const std::unordered_set<const TopoEdge*> origin_edge);
90 void AddPotentialOutEdge(
91 TopoNode* const sub_node,
92 const std::unordered_set<const TopoEdge*> origin_edge);
93
94 private:
95 std::vector<std::shared_ptr<TopoNode>> topo_nodes_;
96 std::vector<std::shared_ptr<TopoEdge>> topo_edges_;
97 std::unordered_map<const TopoNode*, std::vector<NodeWithRange>>
98 sub_node_range_sorted_map_;
99 std::unordered_map<const TopoNode*, std::unordered_set<TopoNode*>>
100 sub_node_map_;
101};
102
103} // namespace routing
104} // namespace apollo
const TopoNode * topo_node
void GetSubInEdgesIntoSubGraph(const TopoEdge *edge, std::unordered_set< const TopoEdge * > *const sub_edges) const
const TopoNode * GetSubNodeWithS(const TopoNode *topo_node, double s) const
void GetSubOutEdgesIntoSubGraph(const TopoEdge *edge, std::unordered_set< const TopoEdge * > *const sub_edges) const
class register implement
Definition arena_queue.h:37