CARLA
MapData.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #include "carla/road/MapData.h"
8 #include "carla/road/Lane.h"
9 
10 namespace carla {
11 namespace road {
12 
13  std::unordered_map<RoadId, Road> &MapData::GetRoads() {
14  return _roads;
15  }
16 
17  std::unordered_map<JuncId, Junction> &MapData::GetJunctions() {
18  return _junctions;
19  }
20 
22  return _roads.at(id);
23  }
24 
25  const Road &MapData::GetRoad(const RoadId id) const {
26  return const_cast<MapData *>(this)->GetRoad(id);
27  }
28 
30  const auto search = _junctions.find(id);
31  if (search != _junctions.end()) {
32  return &search->second;
33  }
34  return nullptr;
35  }
36 
38  const auto search = _junctions.find(id);
39  if (search != _junctions.end()) {
40  return &search->second;
41  }
42  return nullptr;
43  }
44 } // namespace road
45 } // namespace carla
uint32_t RoadId
Definition: RoadTypes.h:15
std::unordered_map< JuncId, Junction > & GetJunctions()
Definition: MapData.cpp:17
Junction * GetJunction(JuncId id)
Definition: MapData.cpp:29
std::unordered_map< RoadId, Road > & GetRoads()
Definition: MapData.cpp:13
Road & GetRoad(const RoadId id)
Definition: MapData.cpp:21
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
int32_t JuncId
Definition: RoadTypes.h:17
std::unordered_map< JuncId, Junction > _junctions
Definition: MapData.h:96
std::unordered_map< RoadId, Road > _roads
Definition: MapData.h:94