|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
接收队列的短期写入接口 / Short-lived producer interface for the RX queue. More...
#include <read_port.hpp>
Public Member Functions | |
| ReadQueue (const ReadQueue &)=delete | |
| ReadQueue & | operator= (const ReadQueue &)=delete |
| ReadQueue (ReadQueue &&)=delete | |
| ReadQueue & | operator= (ReadQueue &&)=delete |
| ~ReadQueue () | |
| 开发期检查是否已 Publish / Check for Publish in development builds. | |
| ErrorCode | PushBatch (const uint8_t *data, size_t size) |
| 批量复制字节到接收队列 / Copy a batch of bytes into the RX queue. | |
| template<typename Writer > | |
| size_t | PushWithWriter (size_t limit, Writer &&writer) |
| 通过回调直接写入接收队列 / Fill the RX queue through a writer callback. | |
| size_t | EmptySize () const |
| 获取接收队列当前空闲空间 / Get current RX queue free space. | |
| size_t | Capacity () const |
| 获取接收队列容量 / Get the RX queue capacity. | |
| void | Publish () |
| 结束本次写入并通知挂起读 / End production and notify a pending read. | |
Friends | |
| class | ReadPort |
接收队列的短期写入接口 / Short-lived producer interface for the RX queue.
一次使用可多次调用同一种入队方法,最后显式调用一次 Publish,包括未写入数据的情况。 不可复制或移动;析构不会自动发布通知。 Use one production method repeatedly, then call Publish exactly once, even if no bytes were written. This object is noncopyable and nonmovable. Destruction does not publish notifications.
Definition at line 107 of file read_port.hpp.
| ReadPort::ReadQueue::~ReadQueue | ( | ) |
开发期检查是否已 Publish / Check for Publish in development builds.
Definition at line 20 of file read_port.cpp.
|
nodiscard |
获取接收队列容量 / Get the RX queue capacity.
Definition at line 40 of file read_port.cpp.
|
nodiscard |
获取接收队列当前空闲空间 / Get current RX queue free space.
Definition at line 38 of file read_port.cpp.
| void ReadPort::ReadQueue::Publish | ( | ) |
结束本次写入并通知挂起读 / End production and notify a pending read.
Definition at line 42 of file read_port.cpp.
|
nodiscard |
批量复制字节到接收队列 / Copy a batch of bytes into the RX queue.
| data | 数据源;正长度时不可为空 / Source, non-null for a positive size. |
| size | 字节数 / Number of bytes. |
Definition at line 22 of file read_port.cpp.
|
inlinenodiscard |
通过回调直接写入接收队列 / Fill the RX queue through a writer callback.
| Writer | 写入器类型 / Writer callback type. |
| limit | 最多提供的字节数 / Maximum number of bytes to offer. |
| writer | 签名为 size_t(uint8_t*, size_t, uint8_t*, size_t),接收按 FIFO 顺序排列的最多两段空间,返回已写入的连续前缀长度。 Callable as size_t(uint8_t*, size_t, uint8_t*, size_t); receives up to two FIFO-ordered spans and returns the length of the written prefix. |
Definition at line 145 of file read_port.hpp.
|
friend |
Definition at line 186 of file read_port.hpp.