libxr 1.0
Want to be the best embedded framework
|
提供一个通用的回调包装,支持动态参数传递。 Provides a generic callback wrapper, supporting dynamic argument passing. More...
#include <libxr_cb.hpp>
Public Member Functions | |
Callback () | |
默认构造函数,创建空回调对象。 Default constructor, creating an empty callback instance. | |
Callback (const Callback &)=default | |
Callback & | operator= (const Callback &)=default |
Callback (Callback &&other) noexcept | |
移动构造函数,转移回调对象的所有权。 Move constructor, transferring ownership of the callback object. | |
Callback & | operator= (Callback &&other) noexcept |
移动赋值运算符,转移回调对象的所有权。 Move assignment operator, transferring ownership of the callback object. | |
template<typename... PassArgs> | |
void | Run (bool in_isr, PassArgs &&...args) const |
执行回调函数,并传递参数。 Executes the callback function, passing the arguments. | |
Static Public Member Functions | |
template<typename FunType , typename ArgType > | |
static Callback | Create (FunType fun, ArgType arg) |
创建一个新的回调对象,并绑定回调函数和参数。 Creates a new callback instance, binding a function and an argument. | |
Private Member Functions | |
Callback (void *cb_block, void(*cb_fun)(bool, void *, Args...)) | |
私有构造函数,仅用于内部创建回调实例。 Private constructor, used internally for creating callback instances. | |
Private Attributes | |
void * | cb_block_ |
存储回调块的指针。 Pointer to the callback block. | |
void(* | cb_fun_ )(bool, void *, Args...) |
存储回调执行的函数指针。 Pointer to the callback execution function. | |
提供一个通用的回调包装,支持动态参数传递。 Provides a generic callback wrapper, supporting dynamic argument passing.
Args | 额外的参数类型列表。 Additional argument types. |
Definition at line 123 of file libxr_cb.hpp.
|
inline |
默认构造函数,创建空回调对象。 Default constructor, creating an empty callback instance.
Definition at line 160 of file libxr_cb.hpp.
|
inlinenoexcept |
移动构造函数,转移回调对象的所有权。 Move constructor, transferring ownership of the callback object.
Definition at line 172 of file libxr_cb.hpp.
|
inlineprivate |
私有构造函数,仅用于内部创建回调实例。 Private constructor, used internally for creating callback instances.
cb_block | 绑定的回调块对象。 The bound callback block object. |
cb_fun | 处理回调调用的函数指针。 Function pointer for handling callback invocation. |
Definition at line 225 of file libxr_cb.hpp.
|
inlinestatic |
创建一个新的回调对象,并绑定回调函数和参数。 Creates a new callback instance, binding a function and an argument.
FunType | 回调函数类型。 Type of the callback function. |
ArgType | 绑定的参数类型。 Type of the bound argument. |
fun | 需要绑定的回调函数。 The callback function to bind. |
arg | 绑定的参数值。 The bound argument value. |
Definition at line 142 of file libxr_cb.hpp.
|
inlinenoexcept |
移动赋值运算符,转移回调对象的所有权。 Move assignment operator, transferring ownership of the callback object.
Definition at line 187 of file libxr_cb.hpp.
|
inline |
执行回调函数,并传递参数。 Executes the callback function, passing the arguments.
in_isr | 指示是否在中断上下文中执行。 Indicates whether the call is executed within an ISR context. |
args | 额外传递的参数。 Additional arguments to pass. |
Definition at line 207 of file libxr_cb.hpp.
|
private |
存储回调块的指针。 Pointer to the callback block.
Definition at line 230 of file libxr_cb.hpp.
|
private |
存储回调执行的函数指针。 Pointer to the callback execution function.
Definition at line 231 of file libxr_cb.hpp.