|
libxr
1.0
Want to be the best embedded framework
|
提供一个回调函数的封装,实现参数绑定和回调执行。 Provides a wrapper for callback functions, enabling argument binding and invocation. More...
#include <libxr_cb.hpp>
Public Types | |
| using | FunctionType = void (*)(bool, ArgType, Args...) |
| 定义回调函数类型。 Defines the type of the callback function. | |
Public Member Functions | |
| template<typename FunType , typename ArgT > | |
| CallbackBlock (FunType &&fun, ArgT &&arg) | |
| 构造回调块,绑定回调函数和参数。 Constructs a callback block, binding a function and an argument. | |
| void | Call (bool in_isr, Args &&...args) |
| 调用回调函数,并传递额外参数。 Calls the callback function, passing additional arguments. | |
| CallbackBlock (const CallbackBlock &other)=delete | |
| CallbackBlock & | operator= (const CallbackBlock &other)=delete |
| CallbackBlock (CallbackBlock &&other) noexcept | |
| 移动构造函数,转移回调函数与参数。 Move constructor, transferring the callback function and argument. | |
| CallbackBlock & | operator= (CallbackBlock &&other) noexcept |
| 移动赋值运算符,转移回调函数与参数。 Move assignment operator, transferring the callback function and argument. | |
Private Attributes | |
| void(* | fun_ )(bool, ArgType, Args...) |
| 绑定的回调函数。 The bound callback function. | |
| ArgType | arg_ |
| 绑定的参数。 The bound argument. | |
| bool | in_isr_ = false |
提供一个回调函数的封装,实现参数绑定和回调执行。 Provides a wrapper for callback functions, enabling argument binding and invocation.
| ArgType | 绑定的第一个参数类型。 The type of the first bound argument. |
| Args | 额外的参数类型列表。 Additional argument types. |
Definition at line 21 of file libxr_cb.hpp.
| using LibXR::CallbackBlock< ArgType, Args >::FunctionType = void (*)(bool, ArgType, Args...) |
定义回调函数类型。 Defines the type of the callback function.
Definition at line 29 of file libxr_cb.hpp.
|
inline |
构造回调块,绑定回调函数和参数。 Constructs a callback block, binding a function and an argument.
| FunType | 函数类型。 The type of the function. |
| ArgT | 绑定的参数类型。 The type of the bound argument. |
| fun | 需要调用的回调函数。 The callback function to be invoked. |
| arg | 绑定的参数值。 The bound argument value. |
Definition at line 45 of file libxr_cb.hpp.
|
inlinenoexcept |
移动构造函数,转移回调函数与参数。 Move constructor, transferring the callback function and argument.
| other | 另一个 CallbackBlock 实例。 Another instance of CallbackBlock. |
Definition at line 80 of file libxr_cb.hpp.
|
inline |
调用回调函数,并传递额外参数。 Calls the callback function, passing additional arguments.
| in_isr | 指示是否在中断上下文中执行。 Indicates whether the call is executed within an interrupt context. |
| args | 额外的参数。 Additional arguments. |
Definition at line 59 of file libxr_cb.hpp.
|
inlinenoexcept |
移动赋值运算符,转移回调函数与参数。 Move assignment operator, transferring the callback function and argument.
| other | 另一个 CallbackBlock 实例。 Another instance of CallbackBlock. |
Definition at line 96 of file libxr_cb.hpp.
|
private |
绑定的参数。 The bound argument.
Definition at line 109 of file libxr_cb.hpp.
|
private |
绑定的回调函数。 The bound callback function.
Definition at line 107 of file libxr_cb.hpp.
|
private |
指示是否在中断上下文中执行。 Indicates whether the function is executed in an ISR context.
Definition at line 110 of file libxr_cb.hpp.