|
libxr
1.0
Want to be the best embedded framework
|
通用回调包装,支持动态参数传递 / Generic callback wrapper supporting dynamic argument passing More...
#include <libxr_cb.hpp>
Public Member Functions | |
| Callback () | |
| 默认构造函数,创建空回调对象 / Default constructor creating an empty callback | |
| Callback (const Callback &)=default | |
| Callback & | operator= (const Callback &)=default |
| Callback (Callback &&other) noexcept | |
| 移动构造函数,转移回调对象的所有权 / Move constructor transferring callback ownership | |
| Callback & | operator= (Callback &&other) noexcept |
| 移动赋值运算符,转移回调对象的所有权 / Move assignment operator transferring callback ownership | |
| template<typename... PassArgs> | |
| void | Run (bool in_isr, PassArgs &&... args) const |
| 执行回调函数并传递参数 / Execute the callback with arguments | |
| bool | Empty () const |
| 检查回调是否为空 / Check whether the callback is empty | |
Static Public Member Functions | |
| template<typename FunType , typename ArgType > | |
| static Callback | Create (FunType fun, ArgType arg) |
| 创建回调对象并绑定回调函数与参数 / Create a callback instance with bound function and argument | |
Private Member Functions | |
| Callback (void *cb_block, void(*cb_fun)(bool, void *, Args...)) | |
| 私有构造函数,仅用于内部创建回调实例 / Private constructor used internally to create callback instances | |
Static Private Member Functions | |
| static void | FunctionDefault (bool, void *, Args...) |
Private Attributes | |
| void * | cb_block_ = nullptr |
| 回调块指针 / Pointer to the callback block | |
| void(* | cb_fun_ )(bool, void *, Args...) |
| 回调执行函数指针 / Callback invocation function pointer | |
通用回调包装,支持动态参数传递 / Generic callback wrapper supporting dynamic argument passing
| Args | 额外的参数类型列表 / Additional argument types |
Definition at line 149 of file libxr_cb.hpp.
|
inline |
默认构造函数,创建空回调对象 / Default constructor creating an empty callback
Definition at line 184 of file libxr_cb.hpp.
|
inlinenoexcept |
移动构造函数,转移回调对象的所有权 / Move constructor transferring callback ownership
Definition at line 195 of file libxr_cb.hpp.
|
inlineprivate |
私有构造函数,仅用于内部创建回调实例 / Private constructor used internally to create callback instances
| cb_block | 回调块对象指针 / Pointer to the callback block |
| cb_fun | 回调执行函数指针 / Callback invocation function pointer |
Definition at line 246 of file libxr_cb.hpp.
|
inlinestaticnodiscard |
创建回调对象并绑定回调函数与参数 / Create a callback instance with bound function and argument
| FunType | 回调函数类型 / Callback function type |
| ArgType | 绑定参数类型 / Bound argument type |
| fun | 需要绑定的回调函数 / Callback function to bind |
| arg | 绑定的参数值 / Bound argument value |
Definition at line 167 of file libxr_cb.hpp.
|
inline |
|
inlinestaticprivate |
Definition at line 151 of file libxr_cb.hpp.
|
inlinenoexcept |
移动赋值运算符,转移回调对象的所有权 / Move assignment operator transferring callback ownership
Definition at line 208 of file libxr_cb.hpp.
|
inline |
执行回调函数并传递参数 / Execute the callback with arguments
| in_isr | 是否在中断上下文中执行 / Whether executed in ISR context |
| args | 额外传递的参数 / Additional arguments to pass |
Definition at line 225 of file libxr_cb.hpp.
|
private |
回调块指针 / Pointer to the callback block
Definition at line 251 of file libxr_cb.hpp.
|
private |
回调执行函数指针 / Callback invocation function pointer
Definition at line 252 of file libxr_cb.hpp.