|
libxr
1.0
Want to be the best embedded framework
|
Defines an operation with different execution modes. More...
#include <operation.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 23 of file operation.hpp.
| using LibXR::Operation< Args >::Callback = LibXR::Callback<Args> |
Definition at line 26 of file operation.hpp.
|
strong |
Polling operation status. 轮询操作的状态。
Definition at line 40 of file operation.hpp.
|
strong |
Operation types. 操作类型。
Definition at line 30 of file operation.hpp.
|
inline |
Default constructor, initializes with NONE type.
默认构造函数,初始化为NONE类型。
Definition at line 50 of file operation.hpp.
|
inline |
Constructs a blocking operation with a semaphore and timeout.
使用信号量和超时构造阻塞操作。
| sem | Semaphore reference. |
| timeout | Timeout duration (default is maximum). |
Definition at line 63 of file operation.hpp.
|
inline |
Constructs a callback-based operation.
构造基于回调的操作。
| callback | Callback function reference. |
Definition at line 72 of file operation.hpp.
|
inline |
Constructs a polling operation.
构造轮询操作。
| status | Reference to polling status. |
Definition at line 81 of file operation.hpp.
|
inline |
Definition at line 85 of file operation.hpp.
|
inlinenoexcept |
Definition at line 90 of file operation.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 199 of file operation.hpp.
|
inline |
Copy assignment operator.
复制赋值运算符。
| op | Another Operation instance. |
Definition at line 101 of file operation.hpp.
|
inlinenoexcept |
Move assignment operator.
移动赋值运算符。
| op | Another Operation instance. |
Definition at line 132 of file operation.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 164 of file operation.hpp.
| Callback* LibXR::Operation< Args >::callback |
Definition at line 211 of file operation.hpp.
| union { ... } LibXR::Operation< Args >::data |
Data storage for different operation types. 存储不同操作类型的数据。
| Semaphore* LibXR::Operation< Args >::sem |
Definition at line 214 of file operation.hpp.
| OperationPollingStatus* LibXR::Operation< Args >::status |
Definition at line 217 of file operation.hpp.
| uint32_t LibXR::Operation< Args >::timeout |
Definition at line 215 of file operation.hpp.
| OperationType LibXR::Operation< Args >::type |
Operation type. 操作类型。
Definition at line 222 of file operation.hpp.