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 } |
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< Args... > &callback) | |
Constructs a callback-based operation. | |
Operation (OperationPollingStatus &status) | |
Constructs a polling operation. | |
Operation & | operator= (const Operation &op) |
Copy assignment operator. | |
Operation & | operator= (Operation &&op) noexcept |
Move assignment operator. | |
Operation (const Operation &op) | |
Operation (Operation &&op) noexcept | |
构造一个新的 Operation 对象(移动构造函数)。 Constructs a new Operation object (move constructor). | |
void | UpdateStatus (bool in_isr, Args &&...args) |
Updates operation status based on type. | |
void | MarkAsRunning () |
标记操作为运行状态。 Marks the operation as running. | |
Data Fields | ||
union { | ||
Callback< Args... > * 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 28 of file libxr_rw.hpp.
|
strong |
Polling operation status. 轮询操作的状态。
Definition at line 43 of file libxr_rw.hpp.
|
strong |
Operation types. 操作类型。
Definition at line 33 of file libxr_rw.hpp.
|
inline |
Default constructor, initializes with NONE type.
默认构造函数,初始化为NONE类型。
Definition at line 52 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 60 of file libxr_rw.hpp.
|
inline |
Constructs a callback-based operation.
构造基于回调的操作。
callback | Callback function reference. |
Definition at line 71 of file libxr_rw.hpp.
|
inline |
Constructs a polling operation.
构造轮询操作。
status | Reference to polling status. |
Definition at line 81 of file libxr_rw.hpp.
|
inline |
Definition at line 146 of file libxr_rw.hpp.
|
inlinenoexcept |
构造一个新的 Operation 对象(移动构造函数)。 Constructs a new Operation object (move constructor).
该构造函数用于移动另一个 Operation 对象,并接管其内部数据。 This constructor moves another Operation object and takes ownership of its internal data.
Definition at line 180 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.
OperationType::POLLING
类型的操作,其他类型不会受到影响。 This method only applies to operations of type OperationType::POLLING
, and other types remain unaffected. Definition at line 236 of file libxr_rw.hpp.
|
inline |
Copy assignment operator.
复制赋值运算符。
op | Another Operation instance. |
Definition at line 92 of file libxr_rw.hpp.
|
inlinenoexcept |
Move assignment operator.
移动赋值运算符。
op | Another Operation instance. |
Definition at line 122 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 205 of file libxr_rw.hpp.
Callback<Args...>* LibXR::Operation< Args >::callback |
Definition at line 248 of file libxr_rw.hpp.
union { ... } LibXR::Operation< Args >::data |
Data storage for different operation types. 存储不同操作类型的数据。
Semaphore* LibXR::Operation< Args >::sem |
Definition at line 251 of file libxr_rw.hpp.
OperationPollingStatus* LibXR::Operation< Args >::status |
Definition at line 254 of file libxr_rw.hpp.
uint32_t LibXR::Operation< Args >::timeout |
Definition at line 252 of file libxr_rw.hpp.
OperationType LibXR::Operation< Args >::type |
Operation type. 操作类型。
Definition at line 259 of file libxr_rw.hpp.