|
libxr
1.0
Want to be the best embedded framework
|
Defines an operation with different execution modes. More...
#include <libxr_rw.hpp>
Public Types | |
| enum class | OperationType : uint8_t { CALLBACK , BLOCK , POLLING , NONE } |
| enum class | OperationPollingStatus : uint8_t { READY , RUNNING , DONE , ERROR } |
| using | Callback = LibXR::Callback<Args> |
Public Member Functions | |
| Operation () | |
| Default constructor, initializes with NONE type. | |
| Operation (Semaphore &sem, uint32_t timeout=UINT32_MAX) | |
| Constructs a blocking operation with a semaphore and timeout. | |
| Operation (Callback &callback) | |
| Constructs a callback-based operation. | |
| Operation (OperationPollingStatus &status) | |
| Constructs a polling operation. | |
| Operation (const Operation &op) | |
| Operation (Operation &&op) noexcept | |
| Operation & | operator= (const Operation &op) |
| Copy assignment operator. | |
| Operation & | operator= (Operation &&op) noexcept |
| Move assignment operator. | |
| template<typename Status > | |
| void | UpdateStatus (bool in_isr, Status &&status) |
| Updates operation status based on type. | |
| void | MarkAsRunning () |
| 标记操作为运行状态。 Marks the operation as running. | |
Data Fields | ||
| union { | ||
| Callback * callback | ||
| struct { | ||
| Semaphore * sem | ||
| uint32_t timeout | ||
| } sem_info | ||
| OperationPollingStatus * status | ||
| } | data | |
| OperationType | type | |
Defines an operation with different execution modes.
定义了一种具有不同执行模式的操作。
| Args | The parameter types for callback operations. |
| Args | 用于回调操作的参数类型。 |
Definition at line 32 of file libxr_rw.hpp.
| using LibXR::Operation< Args >::Callback = LibXR::Callback<Args> |
Definition at line 35 of file libxr_rw.hpp.
|
strong |
Polling operation status. 轮询操作的状态。
Definition at line 49 of file libxr_rw.hpp.
|
strong |
Operation types. 操作类型。
Definition at line 39 of file libxr_rw.hpp.
|
inline |
Default constructor, initializes with NONE type.
默认构造函数,初始化为NONE类型。
Definition at line 59 of file libxr_rw.hpp.
|
inline |
Constructs a blocking operation with a semaphore and timeout.
使用信号量和超时构造阻塞操作。
| sem | Semaphore reference. |
| timeout | Timeout duration (default is maximum). |
Definition at line 72 of file libxr_rw.hpp.
|
inline |
Constructs a callback-based operation.
构造基于回调的操作。
| callback | Callback function reference. |
Definition at line 81 of file libxr_rw.hpp.
|
inline |
Constructs a polling operation.
构造轮询操作。
| status | Reference to polling status. |
Definition at line 90 of file libxr_rw.hpp.
|
inline |
Definition at line 94 of file libxr_rw.hpp.
|
inlinenoexcept |
Definition at line 99 of file libxr_rw.hpp.
|
inline |
标记操作为运行状态。 Marks the operation as running.
该函数用于在操作类型为 POLLING 时,将 data.status 设置为 RUNNING, 以指示该操作正在执行中。 This function sets data.status to RUNNING when the operation type is POLLING, indicating that the operation is currently in progress.
Definition at line 208 of file libxr_rw.hpp.
|
inline |
Copy assignment operator.
复制赋值运算符。
| op | Another Operation instance. |
Definition at line 110 of file libxr_rw.hpp.
|
inlinenoexcept |
Move assignment operator.
移动赋值运算符。
| op | Another Operation instance. |
Definition at line 141 of file libxr_rw.hpp.
|
inline |
Updates operation status based on type.
根据类型更新操作状态。
| in_isr | Indicates if executed within an interrupt. |
| args | Parameters passed to the callback. |
Definition at line 173 of file libxr_rw.hpp.
| Callback* LibXR::Operation< Args >::callback |
Definition at line 220 of file libxr_rw.hpp.
| union { ... } LibXR::Operation< Args >::data |
Data storage for different operation types. 存储不同操作类型的数据。
| Semaphore* LibXR::Operation< Args >::sem |
Definition at line 223 of file libxr_rw.hpp.
| OperationPollingStatus* LibXR::Operation< Args >::status |
Definition at line 226 of file libxr_rw.hpp.
| uint32_t LibXR::Operation< Args >::timeout |
Definition at line 224 of file libxr_rw.hpp.
| OperationType LibXR::Operation< Args >::type |
Operation type. 操作类型。
Definition at line 231 of file libxr_rw.hpp.