CARLA
载入中...
搜索中...
未找到
LibCarla
source
carla
road
element
RoadInfoGeometry.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/Debug.h
"
10
#include "
carla/road/element/Geometry.h
"
/// 包含道路元素的几何定义
11
#include "
carla/road/element/RoadInfo.h
"
/// 包含道路信息的定义
12
13
namespace
carla
{
14
namespace
road {
15
namespace
element {
16
17
class
RoadInfoGeometry
final :
public
RoadInfo
{
// 构造函数,接受一个double类型的s参数和unique_ptr<Geometry>类型的geom参数
18
public
:
19
20
RoadInfoGeometry
(
double
s, std::unique_ptr<Geometry> &&geom)
21
:
RoadInfo
(s),
/// 调用基类RoadInfo的构造函数,传递s参数
22
_geom
(
std
::move(geom)) {
/// 使用std::move将geom参数移动到成员变量_geom
23
DEBUG_ASSERT
(
_geom
!=
nullptr
);
/// 使用DEBUG_ASSERT宏确保_geom不为nullptr,以避免空指针解引用
24
}
25
26
void
AcceptVisitor
(
RoadInfoVisitor
&v)
final
{
/// 接受访问者模式的访问
27
v.Visit(*
this
);
/// 访问者访问当前对象
28
}
29
30
const
Geometry
&
GetGeometry
()
const
{
/// 获取道路的几何信息
31
return
*
_geom
;
/// 返回_geom对象的引用
32
}
33
34
private
:
35
36
const
std::unique_ptr<const Geometry>
_geom
;
/// 存储道路几何信息的智能指针
37
};
38
39
}
// namespace element
40
}
// namespace road
41
}
// namespace carla
Debug.h
DEBUG_ASSERT
#define DEBUG_ASSERT(predicate)
Definition
Debug.h:68
Geometry.h
RoadInfo.h
carla::road::element::Geometry
Definition
Geometry.h:71
carla::road::element::RoadInfoGeometry
Definition
RoadInfoGeometry.h:17
carla::road::element::RoadInfoGeometry::RoadInfoGeometry
RoadInfoGeometry(double s, std::unique_ptr< Geometry > &&geom)
Definition
RoadInfoGeometry.h:20
carla::road::element::RoadInfoGeometry::GetGeometry
const Geometry & GetGeometry() const
Definition
RoadInfoGeometry.h:30
carla::road::element::RoadInfoGeometry::AcceptVisitor
void AcceptVisitor(RoadInfoVisitor &v) final
Definition
RoadInfoGeometry.h:26
carla::road::element::RoadInfoGeometry::_geom
const std::unique_ptr< const Geometry > _geom
Definition
RoadInfoGeometry.h:36
carla::road::element::RoadInfoVisitor
Definition
RoadInfoVisitor.h:31
carla::road::element::RoadInfo
Definition
RoadInfo.h:20
carla
CARLA模拟器的主命名空间。
Definition
Carla.cpp:139
std
Definition
CarlaRecorderCollision.h:31
制作者
1.10.0