|
StormByte C++ Library: Buffer module 1.2.0
StormByte-Buffer is the buffer module of the StormByte C++ suite.
|
Pure interface for a buffer that can be read but not written. More...
#include <StormByte/buffer/generic.hxx>


Public Member Functions | |
Constructors / destructor / assignment | |
| ReadOnly () noexcept | |
| Default construct. | |
| ReadOnly (const ReadOnly &) noexcept=default | |
| Copy construct. | |
| ReadOnly (ReadOnly &&) noexcept=default | |
| Move construct. | |
| virtual | ~ReadOnly () noexcept |
| Virtual destructor. | |
| ReadOnly & | operator= (const ReadOnly &)=default |
| Copy assign. | |
| ReadOnly & | operator= (ReadOnly &&) noexcept=default |
| Move assign. | |
Queries | |
| virtual std::size_t | AvailableBytes () const noexcept=0 |
| Bytes available from the current read position. | |
| virtual const DataType & | Data () const noexcept=0 |
| Access a view of the internal storage (implementation-defined). | |
| virtual bool | Empty () const noexcept=0 |
| Whether the buffer holds no stored bytes. | |
| virtual bool | EoF () const noexcept=0 |
| End-of-stream condition. | |
| virtual bool | IsReadable () const noexcept=0 |
| Whether the buffer can still be read. | |
| virtual std::size_t | Size () const noexcept=0 |
| Total number of bytes stored. | |
Maintenance | |
| virtual void | Clean () noexcept=0 |
| Discard data from the start up to the current read position. | |
| virtual void | Clear () noexcept=0 |
| Clear all buffer contents and reset logical positions. | |
| virtual bool | Drop (const std::size_t &count) noexcept=0 |
Discard count unread bytes. | |
| virtual void | Seek (const std::ptrdiff_t &offset, const Position &mode) const noexcept=0 |
| Move the logical read position for non-destructive reads. | |
Extract (destructive) | |
| virtual bool | Extract (const std::size_t &count, DataType &outBuffer) noexcept=0 |
| Extract bytes into a DataType. | |
| bool | Extract (DataType &outBuffer) noexcept |
| Extract all available bytes into a DataType. | |
| virtual bool | Extract (const std::size_t &count, WriteOnly &outBuffer) noexcept=0 |
| Extract bytes into a WriteOnly. | |
| bool | Extract (WriteOnly &outBuffer) noexcept |
| Extract all available bytes into a WriteOnly. | |
| virtual void | ExtractUntilEoF (DataType &outBuffer) noexcept=0 |
| Extract until EoF into a DataType. | |
| virtual void | ExtractUntilEoF (WriteOnly &outBuffer) noexcept=0 |
| Extract until EoF into a WriteOnly. | |
Peek (non-destructive, does not advance) | |
| virtual bool | Peek (const std::size_t &count, DataType &outBuffer) const noexcept=0 |
| Peek into a DataType without advancing the read position. | |
| virtual bool | Peek (const std::size_t &count, WriteOnly &outBuffer) const noexcept=0 |
| Peek into a WriteOnly without advancing the read position. | |
Read (non-destructive, advances position) | |
| virtual bool | Read (const std::size_t &count, DataType &outBuffer) const noexcept=0 |
| Read into a DataType. | |
| bool | Read (DataType &outBuffer) const noexcept |
| Read all available bytes into a DataType. | |
| virtual bool | Read (const std::size_t &count, WriteOnly &outBuffer) const noexcept=0 |
| Read into a WriteOnly. | |
| bool | Read (WriteOnly &outBuffer) const noexcept |
| Read all available bytes into a WriteOnly. | |
| virtual void | ReadUntilEoF (DataType &outBuffer) const noexcept=0 |
| Read until EoF into a DataType. | |
| virtual void | ReadUntilEoF (WriteOnly &outBuffer) const noexcept=0 |
| Read until EoF into a WriteOnly. | |
Public Member Functions inherited from StormByte::Buffer::Generic | |
| Generic () noexcept=default | |
| Default construct. | |
| Generic (const Generic &) noexcept=default | |
| Copy construct. | |
| Generic (Generic &&) noexcept=default | |
| Move construct. | |
| virtual | ~Generic () noexcept=0 |
| Pure virtual destructor (keeps the class abstract). | |
| Generic & | operator= (const Generic &other)=default |
| Copy assign. | |
| Generic & | operator= (Generic &&) noexcept=default |
| Move assign. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from StormByte::Buffer::Generic | |
| template<Type::ByteInputRange Src> | |
| static DataType | DataConvert (const Src &src) noexcept |
| Convert an lvalue input range to DataType. | |
| template<Type::ByteInputRange Src> | |
| static DataType | DataConvert (Src &&src) noexcept |
| Convert an rvalue input range to DataType (moves when already DataType). | |
| static DataType | DataConvert (std::string_view sv) noexcept |
| Convert a string view to DataType (no trailing NUL). | |
| static DataType | DataConvert (const char *s) noexcept |
| Convert a null-terminated C string to DataType. | |
Pure interface for a buffer that can be read but not written.
All read / extract / peek / seek contracts used by concrete buffers (FIFO, Ring, Consumer, …) are declared here.
|
inlinenoexcept |
Default construct.
|
defaultnoexcept |
Copy construct.
|
defaultnoexcept |
Move construct.
|
virtualnoexcept |
Virtual destructor.
|
pure virtualnoexcept |
Bytes available from the current read position.
Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Consumer, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Discard data from the start up to the current read position.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Clear all buffer contents and reset logical positions.
Closed / error flags are implementation-defined (typically preserved).
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Access a view of the internal storage (implementation-defined).
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Discard count unread bytes.
| count | Number of bytes to drop. |
true on success, false if fewer bytes were available. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Whether the buffer holds no stored bytes.
true if empty. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
End-of-stream condition.
true when closed (or in error) and no unread bytes remain. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
inlinepure virtualnoexcept |
Extract bytes into a DataType.
| count | Bytes to extract; 0 = all available. |
| outBuffer | Destination. |
true on success, false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
inlinepure virtualnoexcept |
Extract bytes into a WriteOnly.
| count | Bytes to extract; 0 = all available. |
| outBuffer | Destination writer. |
true on success, false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
inlinenoexcept |
Extract all available bytes into a DataType.
| outBuffer | Destination. |
true on success, false on failure.
|
inlinenoexcept |
Extract all available bytes into a WriteOnly.
| outBuffer | Destination writer. |
true on success, false on failure.
|
pure virtualnoexcept |
Extract until EoF into a DataType.
| outBuffer | Destination. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Extract until EoF into a WriteOnly.
| outBuffer | Destination writer. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Whether the buffer can still be read.
false in permanent error state. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Peek into a DataType without advancing the read position.
| count | Bytes to peek; 0 = all available. |
| outBuffer | Destination. |
true on success, false if insufficient data or error.count == 0: all available bytes (fails if none).count > 0: exactly count bytes, or fail if fewer are available.Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Peek into a WriteOnly without advancing the read position.
| count | Bytes to peek; 0 = all available. |
| outBuffer | Destination writer. |
true on success, false if insufficient data or error.Same count semantics as the DataType overload.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Read into a DataType.
| count | Bytes to read; 0 = all available. |
| outBuffer | Destination. |
true on success, false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
pure virtualnoexcept |
Read into a WriteOnly.
| count | Bytes to read; 0 = all available. |
| outBuffer | Destination writer. |
true on success, false on failure. Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::FIFO.
|
inlinenoexcept |
Read all available bytes into a DataType.
| outBuffer | Destination. |
true on success, false on failure.
|
inlinenoexcept |
Read all available bytes into a WriteOnly.
| outBuffer | Destination writer. |
true on success, false on failure.
|
pure virtualnoexcept |
Read until EoF into a DataType.
| outBuffer | Destination. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Read until EoF into a WriteOnly.
| outBuffer | Destination writer. |
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.
|
pure virtualnoexcept |
Move the logical read position for non-destructive reads.
| offset | Offset value. |
| mode | Position::Absolute or Position::Relative. |
Position is clamped to [0, Size()]. Absolute + negative offset is a no-op.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.
|
pure virtualnoexcept |
Total number of bytes stored.
Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.