|
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) | |
| 使用指定数据队列容量构造 Pipe。 | |
| ~Pipe () | |
| 析构函数。 | |
| Pipe (const Pipe &)=delete | |
| 禁止拷贝以避免重复绑定状态。 | |
| Pipe & | operator= (const Pipe &)=delete |
| 禁止拷贝赋值以避免重复绑定状态。 | |
| ReadPort & | GetReadPort () |
| 获取读取端口。 | |
| WritePort & | GetWritePort () |
| 获取写入端口。 | |
Static Private Member Functions | |
| static ErrorCode | ReadFun (ReadPort &, bool) |
| 读端回调(占位,无具体操作)。 | |
| static ErrorCode | WriteFun (WritePort &port, bool in_isr) |
| 写端回调:弹出一次写操作并推动读侧处理。 | |
Private Attributes | |
| ReadPort | read_port_ |
| WritePort | write_port_ |
基于共享队列,由 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. |
Definition at line 35 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().
| port | ReadPort 引用(未使用)。 ReadPort reference (unused). |
| in_isr | 是否在中断上下文中运行。 Whether running in ISR context. |
ErrorCode::PENDING。 Returns ErrorCode::PENDING. Definition at line 89 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. |
| in_isr | 是否在中断上下文中运行。 Whether running in ISR context. |
ErrorCode::OK;若无可处理操作返回 ErrorCode::EMPTY。 Returns ErrorCode::OK if progressed; ErrorCode::EMPTY if no op was available. Definition at line 107 of file libxr_pipe.hpp.
|
private |
共享写端数据队列的读端。 Read endpoint sharing the writer's data queue.
Definition at line 124 of file libxr_pipe.hpp.
|
private |
持有共享数据队列(容量为构造参数)的写端。 Write endpoint owning the shared queue.
Definition at line 126 of file libxr_pipe.hpp.