libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Assert Class Reference

运行时错误检查的断言工具类。 Provides assertion mechanisms for runtime error checking. More...

#include <libxr_assert.hpp>

Collaboration diagram for LibXR::Assert:
[legend]

Public Types

using Callback = LibXR::Callback<const char *, uint32_t>
 

Static Public Member Functions

static void RegisterFatalErrorCB (const Callback &cb)
 注册致命错误的回调函数。 Registers a fatal error callback.
 
template<typename T >
static void RegisterFatalErrorCB (T &&cb)
 注册致命错误的回调函数。 Registers a fatal error callback
 
template<SizeLimitMode mode>
static void SizeLimitCheck (size_t limit, size_t size)
 在非调试模式下的占位大小检查函数(无实际作用)。 Dummy size limit check for non-debug builds.
 

Static Public Attributes

static Callback libxr_fatal_error_callback_
 已注册的致命错误回调函数。 Registered fatal error callback.
 

Detailed Description

运行时错误检查的断言工具类。 Provides assertion mechanisms for runtime error checking.

Assert 类提供了注册和处理致命错误的机制,支持回调函数,并可执行 运行时的大小限制检查(仅在调试模式下启用)。 The Assert class is designed to register and handle fatal errors through callback functions and provides size limit verification.

Definition at line 39 of file libxr_assert.hpp.

Member Typedef Documentation

◆ Callback

using LibXR::Assert::Callback = LibXR::Callback<const char *, uint32_t>

Definition at line 42 of file libxr_assert.hpp.

Member Function Documentation

◆ RegisterFatalErrorCB() [1/2]

static void LibXR::Assert::RegisterFatalErrorCB ( const Callback & cb)
inlinestatic

注册致命错误的回调函数。 Registers a fatal error callback.

该回调函数会在发生致命错误时被触发,用于执行相应的错误处理逻辑。 This callback will be triggered when a fatal error occurs.

Parameters
cb要注册的回调函数。 The callback function to be registered.

Definition at line 52 of file libxr_assert.hpp.

53 {
55 }
static Callback libxr_fatal_error_callback_
已注册的致命错误回调函数。 Registered fatal error callback.

◆ RegisterFatalErrorCB() [2/2]

template<typename T >
static void LibXR::Assert::RegisterFatalErrorCB ( T && cb)
inlinestatic

注册致命错误的回调函数。 Registers a fatal error callback

Template Parameters
T回调对象类型 The type of the callback object.
Parameters
cb要注册的回调函数。The callback function to be registered.

Definition at line 66 of file libxr_assert.hpp.

67 {
68 libxr_fatal_error_callback_ = std::forward<T>(cb);
69 }

◆ SizeLimitCheck()

template<SizeLimitMode mode>
static void LibXR::Assert::SizeLimitCheck ( size_t limit,
size_t size )
inlinestatic

在非调试模式下的占位大小检查函数(无实际作用)。 Dummy size limit check for non-debug builds.

在发布模式下,该函数不会执行任何操作,以避免不必要的开销。 In release mode, this function does nothing to avoid unnecessary checks.

Template Parameters
mode大小检查模式(EQUAL, MORE, LESS)。 The size constraint mode.
Parameters
limit参考限制值。 The reference limit value.
size要检查的实际大小。 The actual size to be checked.

Definition at line 119 of file libxr_assert.hpp.

120 {
121 UNUSED(limit);
122 UNUSED(size);
123 }

Field Documentation

◆ libxr_fatal_error_callback_

Callback LibXR::Assert::libxr_fatal_error_callback_
inlinestatic

已注册的致命错误回调函数。 Registered fatal error callback.

Definition at line 131 of file libxr_assert.hpp.


The documentation for this class was generated from the following file: