涵盖了有关异常处理、定时器、编程工具等相关内容
更多...
|
| class | rm::Exception |
| | 该类封装了有关程序中发生的错误的所有或几乎所有必要信息。异常通常是通过 RMVL_Error 和 RMVL_Error_ 宏隐式构造和抛出的 更多...
|
|
| enum | RMVLErrorCode : int {
RMVL_StsOk = 0
, RMVL_StsBackTrace = -1
, RMVL_StsError = -2
, RMVL_StsNoMem = -3
,
RMVL_StsBadArg = -4
, RMVL_StsBadSize = -5
, RMVL_StsBadFunc = -6
, RMVL_StsNullPtr = -7
,
RMVL_StsNotaNumber = -8
, RMVL_StsDivByZero = -9
, RMVL_StsOutOfRange = -10
, RMVL_StsAssert = -11
,
RMVL_StsInvFmt = -12
, RMVL_BadDynamicType = -13
} |
| | RMVL 错误码 更多...
|
涵盖了有关异常处理、定时器、编程工具等相关内容
◆ DEBUG_ERROR_
| #define DEBUG_ERROR_ |
( |
| ... | ) |
|
◆ DEBUG_HIGHLIGHT_
| #define DEBUG_HIGHLIGHT_ |
( |
| ... | ) |
|
◆ DEBUG_INFO_
| #define DEBUG_INFO_ |
( |
| ... | ) |
|
◆ DEBUG_PASS_
| #define DEBUG_PASS_ |
( |
| ... | ) |
|
◆ DEBUG_WARNING_
| #define DEBUG_WARNING_ |
( |
| ... | ) |
|
◆ ERROR_
◆ HIGHLIGHT_
| #define HIGHLIGHT_ |
( |
| ... | ) |
|
#include <rmvl/core/util.hpp>
值: do { \
printf("\033[35minfo - \033[0m" __VA_ARGS__); \
printf("\n"); \
} while (false)
◆ INFO_
◆ PASS_
◆ RMVL_Assert
| #define RMVL_Assert |
( |
| expr | ) |
|
#include <rmvl/core/util.hpp>
值:
void error(int _code, std::string_view _err, const char *_func, const char *_file, int _line)
发出错误信号并引发异常
@ RMVL_StsAssert
断言失败 Assertion failed
定义 util.hpp:86
#define RMVL_Func
定义 rmvldef.hpp:30
在运行时检查条件,如果失败则抛出异常
- 注解
- 宏 RMVL_Assert (以及 RMVL_DbgAssert) 对指定的表达式求值。如果它是0,宏抛出一个错误。宏 RMVL_Assert 将会在 Debug 和 Release 的配置下检查条件,而 RMVL_DbgAssert 只会在 Debug 的配置下生效。
- 参见
- RMVLErrorCode
- 示例
- samples/tutorial_code/io/sample_write_corners.cpp.
◆ RMVL_DbgAssert
| #define RMVL_DbgAssert |
( |
| expr | ) |
|
#include <rmvl/core/util.hpp>
值:
#define RMVL_Assert(expr)
在运行时检查条件,如果失败则抛出异常
定义 util.hpp:222
在 Debug 条件下或启用静态分析工具的情况下,在运行时检查条件,如果失败则抛出异常
◆ RMVL_ERRHANDLE
| #define RMVL_ERRHANDLE |
( |
| ... | ) |
|
◆ RMVL_Error
| #define RMVL_Error |
( |
| code, |
|
|
| msg ) |
◆ RMVL_Error_
| #define RMVL_Error_ |
( |
| code, |
|
|
| fmt, |
|
|
| ... ) |
#include <rmvl/core/util.hpp>
值:
std::string format(const char *fmt,...)
返回使用类 printf 表达式格式化的文本字符串。
调用错误处理程序
- 注解
- 该宏可用于动态构造错误消息,以包含一些动态信息,例如
#define RMVL_Error_(code, fmt,...)
调用错误处理程序
定义 util.hpp:213
@ RMVL_StsBadArg
参数异常 Bad argument
定义 util.hpp:79
- 参数
-
| [in] | code | 一种 RMVLErrorCode 错误码 |
| [in] | fmt | 格式化字符串 |
| [in] | ... | 括号中带有类似 printf 格式的错误信息 |
◆ WARNING_
◆ hash_func [1/2]
◆ hash_func [2/2]
template<typename Tp>
| using rm::hash_traits< Tp, std::enable_if_t<!std::is_aggregate_v< Tp > > >::hash_func = std::hash<Tp> |
◆ RMVLErrorCode
#include <rmvl/core/util.hpp>
RMVL 错误码
| 枚举值 |
|---|
| RMVL_StsOk | 没有错误 No Error
|
| RMVL_StsBackTrace | 回溯 Backtrace
|
| RMVL_StsError | 未指定(未知)错误 Unspecified (Unknown) error
|
| RMVL_StsNoMem | 内存不足 Insufficient memory
|
| RMVL_StsBadArg | 参数异常 Bad argument
|
| RMVL_StsBadSize | 数组大小不正确 Incorrect size of the array
|
| RMVL_StsBadFunc | 功能不支持 Unsupported function
|
| RMVL_StsNullPtr | 空指针 Null pointer
|
| RMVL_StsNotaNumber | 非数 Not a Number (nan)
|
| RMVL_StsDivByZero | 发生了除以 0 的情况 Division by zero occurred
|
| RMVL_StsOutOfRange | 其中一个参数的值超出了范围 One of the arguments' values is out of range
|
| RMVL_StsAssert | 断言失败 Assertion failed
|
| RMVL_StsInvFmt | 无效格式 Invalid format
|
| RMVL_BadDynamicType | 动态类型转换错误 Bad dynamic_cast type,
|
◆ breakOnError()
| void rm::breakOnError |
( |
| ) |
|
|
inline |
◆ error()
| void rm::error |
( |
int | _code, |
|
|
std::string_view | _err, |
|
|
const char * | _func, |
|
|
const char * | _file, |
|
|
int | _line ) |
◆ format()
| std::string rm::format |
( |
const char * | fmt, |
|
|
| ... ) |
#include <rmvl/core/util.hpp>
返回使用类 printf 表达式格式化的文本字符串。
- 注解
- 该函数的作用类似于 sprintf,但形成并返回一个 STL 字符串。它可用于在 Exception 构造函数中形成错误消息。
- 参数
-
| [in] | fmt | 与 printf 兼容的格式化说明符。 |
| 类型 | 限定符 |
| const char* | s |
| char | c |
| float or double | f,g |
| int, long, long long | d, ld, lld |
| unsigned, unsigned long, unsigned long long | u, lu, llu |
| uint64_t \(\to\) uintmax_t, int64_t \(\to\) intmax_t | ju, jd |
| size_t | zu |
◆ getBuildInformation()
| const char * rm::getBuildInformation |
( |
| ) |
|
#include <rmvl/core/util.hpp>
返回完整的配置输出
- 返回
- 原始的 CMake 输出,包括版本控制系统修订,编译器版本,编译器标志,启用的模块和第三方库等。
- 返回值
-
◆ operator()()
template<typename Tp, typename Enable = std::enable_if_t<std::is_aggregate_v<Tp>>>
◆ processId()
| uint32_t rm::processId |
( |
| ) |
|
◆ throwError()