|
libxr
1.0
Want to be the best embedded framework
|
基于共享队列,由 ReadPort + WritePort 组成的单向管道。 More...
#include <libxr_pipe.hpp>
Public Member Functions | |
| Pipe (size_t buffer_size, bool in_isr=false) | |
| 使用指定数据队列容量构造 Pipe。 | |
| ~Pipe () | |
| 析构函数。 | |
| Pipe (const Pipe &)=delete | |
| 禁止拷贝以避免重复绑定状态。 | |
| Pipe & | operator= (const Pipe &)=delete |
| 禁止拷贝赋值以避免重复绑定状态。 | |
| ReadPort & | GetReadPort () |
| 获取读取端口。 | |
| WritePort & | GetWritePort () |
| 获取写入端口。 | |
Static Private Member Functions | |
| static ErrorCode | ReadFun (ReadPort &) |
| 读端回调(占位,无具体操作)。 | |
| static ErrorCode | WriteFun (WritePort &port) |
| 写端回调:弹出一次写操作并推动读侧处理。 | |
Private Attributes | |
| ReadPort | read_port_ |
| WritePort | write_port_ |
| bool | in_isr_ |
| 回调是否运行在中断上下文中。 Whether callbacks may run in ISR. | |
基于共享队列,由 ReadPort + WritePort 组成的单向管道。
Single-direction pipe built from ReadPort + WritePort on a shared queue.
Definition at line 25 of file libxr_pipe.hpp.
|
inline |
使用指定数据队列容量构造 Pipe。
Construct a Pipe with the given shared data-queue capacity.
| buffer_size | 共享数据队列的容量(字节)。 Capacity (in bytes) of the shared data queue. |
| in_isr | 指示回调是否可能在中断上下文中运行。 Whether callbacks may run in ISR context. |
Definition at line 38 of file libxr_pipe.hpp.
|
inline |
|
delete |
禁止拷贝以避免重复绑定状态。
Non-copyable to avoid double-binding internal state.
|
inline |
|
inline |
禁止拷贝赋值以避免重复绑定状态。
Non-copy-assignable to avoid double-binding internal state.
|
inlinestaticprivate |
读端回调(占位,无具体操作)。
Read-side callback (no-op placeholder).
仅用于匹配 ReadPort 回调签名;实际读取推进通常在 ProcessPendingReads() 中进行。 Provided to match the ReadPort callback signature; reading is typically advanced in ProcessPendingReads().
ErrorCode::EMPTY,表示当前无操作。 Returns ErrorCode::EMPTY (no action). Definition at line 93 of file libxr_pipe.hpp.
|
inlinestaticprivate |
写端回调:弹出一次写操作并推动读侧处理。
Write-side callback: pop a write op and advance the reader.
从写端操作队列中弹出一个 WriteInfoBlock,并调用 ReadPort::ProcessPendingReads(), 使挂起的读请求可从共享数据队列中取出字节。 Pops a WriteInfoBlock from the write op-queue and calls ReadPort::ProcessPendingReads() so pending reads can pull bytes from the shared data queue.
| port | 触发本回调的 WritePort。 The WritePort invoking this callback. |
ErrorCode::OK;若无可处理操作返回 ErrorCode::EMPTY。 Returns ErrorCode::OK if progressed; ErrorCode::EMPTY if no op was available. Definition at line 110 of file libxr_pipe.hpp.
|
private |
回调是否运行在中断上下文中。 Whether callbacks may run in ISR.
Definition at line 131 of file libxr_pipe.hpp.
|
private |
共享写端数据队列的读端。 Read endpoint sharing the writer's data queue.
Definition at line 127 of file libxr_pipe.hpp.
|
private |
持有共享数据队列(容量为构造参数)的写端。 Write endpoint owning the shared queue.
Definition at line 129 of file libxr_pipe.hpp.