Apollo 10.0
自动驾驶开放平台
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 <string>
21#include <unordered_map>
22#include <unordered_set>
23#include <vector>
24
25#include "cyber/common/log.h"
27
28namespace apollo {
29namespace routing {
30
31class TopoGraph {
32 public:
33 TopoGraph() = default;
34 ~TopoGraph() = default;
35
36 bool LoadGraph(const Graph& filename);
37
38 const std::string& MapVersion() const;
39 const std::string& MapDistrict() const;
40 const TopoNode* GetNode(const std::string& id) const;
42 const std::string& road_id,
43 std::unordered_set<const TopoNode*>* const node_in_road) const;
44
45 private:
46 void Clear();
47 bool LoadNodes(const Graph& graph);
48 bool LoadEdges(const Graph& graph);
49
50 private:
51 std::string map_version_;
52 std::string map_district_;
53 std::vector<std::shared_ptr<TopoNode>> topo_nodes_;
54 std::vector<std::shared_ptr<TopoEdge>> topo_edges_;
55 std::unordered_map<std::string, int> node_index_map_;
56 std::unordered_map<std::string, std::unordered_set<const TopoNode*>>
57 road_node_map_;
58};
59
60} // namespace routing
61} // namespace apollo
const std::string & MapVersion() const
Definition topo_graph.cc:87
void GetNodesByRoadId(const std::string &road_id, std::unordered_set< const TopoNode * > *const node_in_road) const
Definition topo_graph.cc:99
const std::string & MapDistrict() const
Definition topo_graph.cc:89
bool LoadGraph(const Graph &filename)
Definition topo_graph.cc:69
const TopoNode * GetNode(const std::string &id) const
Definition topo_graph.cc:91
class register implement
Definition arena_queue.h:37