Abstract interface for reading data from an external or internal source.
More...
#include <StormByte/buffer/external.hxx>
|
|
| | ExternalReader () noexcept=default |
| |
| | ExternalReader (const ExternalReader &)=default |
| |
| | ExternalReader (ExternalReader &&) noexcept=default |
| |
| | ~ExternalReader () noexcept override |
| |
| ExternalReader & | operator= (const ExternalReader &)=default |
| |
| ExternalReader & | operator= (ExternalReader &&) noexcept=default |
| |
|
| virtual std::size_t | AvailableBytes () const noexcept=0 |
| | Number of bytes currently available for reading.
|
| |
| virtual bool | Empty () const noexcept=0 |
| | Whether the underlying source holds no data.
|
| |
| virtual bool | EoF () const noexcept=0 |
| | End-of-file / end-of-stream condition.
|
| |
| virtual bool | IsReadable () const noexcept=0 |
| | Whether the source can still be read.
|
| |
|
| virtual bool | Read (std::size_t count, DataType &out) const noexcept=0 |
| | Non-destructive read (advances the logical position).
|
| |
| bool | Read (DataType &out) const noexcept |
| | Convenience overload — read all available bytes.
|
| |
| virtual bool | Extract (std::size_t count, DataType &out) noexcept=0 |
| | Destructive read (consumes / erases data from the source).
|
| |
| bool | Extract (DataType &out) noexcept |
| | Convenience overload — extract all available bytes.
|
| |
| virtual bool | Peek (std::size_t count, DataType &out) const noexcept=0 |
| | Non-destructive peek (does not advance the position).
|
| |
| virtual void | ReadUntilEoF (DataType &out) const noexcept=0 |
| | Read everything until EoF (non-destructive).
|
| |
| virtual void | ExtractUntilEoF (DataType &out) noexcept=0 |
| | Extract everything until EoF (destructive).
|
| |
|
| virtual void | Seek (std::ptrdiff_t offset, Position mode) const noexcept |
| | Move the logical read position.
|
| |
| virtual void | Clean () noexcept |
| | Discard already-consumed data (from start up to the current read position).
|
| |
Abstract interface for reading data from an external or internal source.
- Overview
- Provides a buffer-agnostic reading API so that pipeline stages (and other consumers) can work uniformly against any concrete source (file, socket, Ring, LockFreeRing, FIFO, etc.).
- Design goals
- Rich enough to replace direct use of ReadOnly / Consumer inside Pipeline stages.
- Lets the Pipeline inject any concrete buffer implementation (including private ones such as LockFreeRing) without changing stage code.
- Note
- Implementations are expected to be lightweight adapters; the real storage lives elsewhere.
- See also
- ExternalBufferReader, ExternalWriter, Pipeline
◆ ExternalReader() [1/3]
| StormByte::Buffer::ExternalReader::ExternalReader |
( |
| ) |
|
|
defaultnoexcept |
◆ ExternalReader() [2/3]
| StormByte::Buffer::ExternalReader::ExternalReader |
( |
const ExternalReader & |
| ) |
|
|
default |
◆ ExternalReader() [3/3]
| StormByte::Buffer::ExternalReader::ExternalReader |
( |
ExternalReader && |
| ) |
|
|
defaultnoexcept |
◆ ~ExternalReader()
| StormByte::Buffer::ExternalReader::~ExternalReader |
( |
| ) |
|
|
overridenoexcept |
◆ AvailableBytes()
| virtual std::size_t StormByte::Buffer::ExternalReader::AvailableBytes |
( |
| ) |
const |
|
pure virtualnoexcept |
◆ Clean()
| virtual void StormByte::Buffer::ExternalReader::Clean |
( |
| ) |
|
|
virtualnoexcept |
◆ Empty()
| virtual bool StormByte::Buffer::ExternalReader::Empty |
( |
| ) |
const |
|
pure virtualnoexcept |
◆ EoF()
| virtual bool StormByte::Buffer::ExternalReader::EoF |
( |
| ) |
const |
|
pure virtualnoexcept |
◆ Extract() [1/2]
| bool StormByte::Buffer::ExternalReader::Extract |
( |
DataType & |
out | ) |
|
|
inlinenoexcept |
Convenience overload — extract all available bytes.
- Parameters
-
- Returns
true on success, false on insufficient data or error.
◆ Extract() [2/2]
| virtual bool StormByte::Buffer::ExternalReader::Extract |
( |
std::size_t |
count, |
|
|
DataType & |
out |
|
) |
| |
|
pure virtualnoexcept |
Destructive read (consumes / erases data from the source).
- Parameters
-
| count | Number of bytes requested (0 = all available). |
| out | Destination buffer (appended to). |
- Returns
true on success, false on insufficient data or error.
Implemented in StormByte::Buffer::ExternalBufferReader.
◆ ExtractUntilEoF()
| virtual void StormByte::Buffer::ExternalReader::ExtractUntilEoF |
( |
DataType & |
out | ) |
|
|
pure virtualnoexcept |
◆ IsReadable()
| virtual bool StormByte::Buffer::ExternalReader::IsReadable |
( |
| ) |
const |
|
pure virtualnoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ Peek()
| virtual bool StormByte::Buffer::ExternalReader::Peek |
( |
std::size_t |
count, |
|
|
DataType & |
out |
|
) |
| const |
|
pure virtualnoexcept |
Non-destructive peek (does not advance the position).
- Parameters
-
| count | Number of bytes requested (0 = all available). |
| out | Destination buffer (appended to). |
- Returns
true on success, false on insufficient data or error.
Implemented in StormByte::Buffer::ExternalBufferReader.
◆ Read() [1/2]
| bool StormByte::Buffer::ExternalReader::Read |
( |
DataType & |
out | ) |
const |
|
inlinenoexcept |
Convenience overload — read all available bytes.
- Parameters
-
- Returns
true on success, false on insufficient data or error.
◆ Read() [2/2]
| virtual bool StormByte::Buffer::ExternalReader::Read |
( |
std::size_t |
count, |
|
|
DataType & |
out |
|
) |
| const |
|
pure virtualnoexcept |
Non-destructive read (advances the logical position).
- Parameters
-
| count | Number of bytes requested (0 = all available). |
| out | Destination buffer (appended to). |
- Returns
true on success, false on insufficient data or error.
Implemented in StormByte::Buffer::ExternalBufferReader.
◆ ReadUntilEoF()
| virtual void StormByte::Buffer::ExternalReader::ReadUntilEoF |
( |
DataType & |
out | ) |
const |
|
pure virtualnoexcept |
◆ Seek()
| virtual void StormByte::Buffer::ExternalReader::Seek |
( |
std::ptrdiff_t |
offset, |
|
|
Position |
mode |
|
) |
| const |
|
virtualnoexcept |
Move the logical read position.
- Parameters
-
- Note
- Default implementation is a no-op. Concrete adapters that support seeking should override it.
Reimplemented in StormByte::Buffer::ExternalBufferReader.
The documentation for this class was generated from the following file: