|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
由读写端口组成的单向管道 / Unidirectional pipe connecting read and write ports. More...
#include <libxr_pipe.hpp>
Public Member Functions | |
| Pipe (size_t buffer_size) | |
| 构造管道并绑定共享队列 / Construct a pipe and bind its shared queue. | |
| ~Pipe ()=default | |
| 析构管道 / Destroy the pipe. | |
| Pipe (const Pipe &)=delete | |
| 端口状态与共享队列不可复制 / Endpoint state and the shared queue cannot be copied. | |
| Pipe & | operator= (const Pipe &)=delete |
| ReadPort & | GetReadPort () |
| 获取读端口 / Get the read endpoint. | |
| WritePort & | GetWritePort () |
| 获取写端口 / Get the write endpoint. | |
由读写端口组成的单向管道 / Unidirectional pipe connecting read and write ports.
写端分配一条 SPSC 字节队列,读端借用该队列,两端之间无需再次复制数据。 写操作在数据入队并通知读端后完成,无需等待读端消费全部数据。 The writer allocates one SPSC byte queue shared with the reader, without another copy between endpoints. Writes complete after admission and reader notification, without waiting for all bytes to be read.
Definition at line 29 of file libxr_pipe.hpp.
|
inlineexplicit |
构造管道并绑定共享队列 / Construct a pipe and bind its shared queue.
| buffer_size | 共享队列容量,单位为字节,必须大于零。 Shared queue capacity in bytes, which must be positive. |
Definition at line 38 of file libxr_pipe.hpp.
|
default |
析构管道 / Destroy the pipe.
|
inline |
获取读端口 / Get the read endpoint.
Definition at line 61 of file libxr_pipe.hpp.
|
inline |
获取写端口 / Get the write endpoint.
Definition at line 67 of file libxr_pipe.hpp.