CARLA
载入中...
搜索中...
未找到
LibCarla
source
carla
Exception.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
#ifdef LIBCARLA_NO_EXCEPTIONS
// 如果定义了 LIBCARLA_NO_EXCEPTIONS
10
11
namespace
std
{
// 定义标准命名空间
12
13
class
exception;
// 前向声明异常类
14
15
}
// namespace std
16
17
namespace
carla
{
// 定义 carla 命名空间
18
19
/// 用户自定义的函数,类似于 Boost 的 throw_exception。
20
///
21
/// @important Boost 异常也会路由到此函数。
22
///
23
/// 当使用 LIBCARLA_NO_EXCEPTIONS 编译时,此函数在 LibCarla 中未定义,
24
/// 使用 LibCarla 的模块需要提供合适的定义。调用 throw_exception 的代码
25
/// 可以假设此函数不会返回;因此,如果用户定义的 throw_exception 返回,
26
/// 行为是未定义的。
27
[[ noreturn ]]
void
throw_exception
(
const
std::exception& e);
// 声明不返回的异常抛出函数
28
29
}
// namespace carla
30
31
#else
// 如果未定义 LIBCARLA_NO_EXCEPTIONS
32
33
namespace
carla
{
// 定义 carla 命名空间
34
35
template
<
typename
T>
36
[[ noreturn ]]
void
throw_exception
(
const
T& e) {
// 模板异常抛出函数
37
throw
e;
// 抛出异常
38
}
39
40
}
// namespace carla
41
42
#endif
// LIBCARLA_NO_EXCEPTIONS
carla
CARLA模拟器的主命名空间。
Definition
Carla.cpp:139
carla::throw_exception
void throw_exception(const std::exception &e)
Definition
Carla.cpp:142
std
Definition
CarlaRecorderCollision.h:31
制作者
1.10.0