CARLA
 
载入中...
搜索中...
未找到
LaneSectionMap.h
浏览该文件的文档.
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#pragma once
8
9#include "carla/NonCopyable.h"
11
12#include <map>
13#include <unordered_map>
14
15namespace carla {
16namespace road {
17
19 : private std::multimap<double, LaneSection>,
20 private MovableNonCopyable {
21 using Super = std::multimap<double, LaneSection>;
22 public:
23
24 LaneSection &Emplace(SectionId id, double s) {
25 LaneSection &result = Super::emplace(s, LaneSection{id, s})->second;
26 _by_id.emplace(result.GetId(), &result);
27 return result;
28 }
29
31 return *_by_id.at(id);
32 }
33
34 const LaneSection &GetById(SectionId id) const {
35 return *_by_id.at(id);
36 }
37
38 using Super::find;
39 using Super::upper_bound;
40 using Super::lower_bound;
41
42 using Super::begin;
43 using Super::rbegin;
44 using Super::end;
45 using Super::rend;
46
47 private:
48
49 std::unordered_map<SectionId, LaneSection *> _by_id;
50 };
51
52} // road
53} // carla
Inherit (privately) to suppress copy construction and assignment.
std::multimap< double, LaneSection > Super
const LaneSection & GetById(SectionId id) const
std::unordered_map< SectionId, LaneSection * > _by_id
LaneSection & Emplace(SectionId id, double s)
LaneSection & GetById(SectionId id)
SectionId GetId() const
uint32_t SectionId
Definition RoadTypes.h:21
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133