|
StormByte C++ Library: Buffer module 0.0.9999
StormByte-Buffer is a StormByte library module for handling buffers
|
Generic class providing a buffer that can be written to but not read from. More...
#include <generic.hxx>


Public Member Functions | |
| WriteOnly () noexcept | |
| Construct WriteOnly. | |
| WriteOnly (const DataType &data) noexcept | |
| Construct WriteOnly. | |
| WriteOnly (DataType &&data) noexcept | |
| Construct WriteOnly with initial data using move semantics. | |
| WriteOnly (const WriteOnly &)=default | |
| Copy construct deleted. | |
| WriteOnly (WriteOnly &&) noexcept=default | |
| Move construct deleted. | |
| virtual | ~WriteOnly () noexcept=default |
| Virtual destructor. | |
| WriteOnly & | operator= (const WriteOnly &)=default |
| Copy assign deleted. | |
| WriteOnly & | operator= (WriteOnly &&) noexcept=default |
| Move assign deleted. | |
| virtual bool | IsWritable () const noexcept=0 |
| Check if the buffer is writable. | |
| virtual bool | Write (const std::size_t &count, const DataType &data) noexcept=0 |
| Write bytes from a vector to the buffer. | |
| bool | Write (std::string_view sv) noexcept |
| Write from a string view (does not include terminating NUL). | |
| bool | Write (const char *s) noexcept |
Write from a C string pointer (null-terminated). Uses std::string_view. | |
| bool | Write (const std::size_t &count, std::string_view sv) noexcept |
Write up-to count bytes from a string view (0 => all available). | |
| bool | Write (const std::size_t &count, const char *s) noexcept |
Write up-to count bytes from a C string pointer (null-terminated). | |
| template<std::size_t N> | |
| bool | Write (const char(&s)[N]) noexcept |
| Write from a string literal (array) and avoid copying the trailing NUL. | |
| template<std::ranges::input_range R> requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<R>>>) && requires(std::ranges::range_value_t<R> v) { static_cast<std::byte>(v); } | |
| bool | Write (const R &r) noexcept |
| Write all elements from an input range to the buffer. | |
| template<std::ranges::input_range Rw> requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Rw>>>) && requires(std::ranges::range_value_t<Rw> v) { static_cast<std::byte>(v); } | |
| bool | Write (const std::size_t &count, const Rw &r) noexcept |
Write up-to count elements from an input range. | |
| template<std::ranges::input_range Rrw> requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Rrw>>>) && requires(std::ranges::range_value_t<Rrw> v) { static_cast<std::byte>(v); } | |
| bool | Write (const std::size_t &count, Rrw &&r) noexcept |
Write up-to count elements from an rvalue range. | |
| template<std::ranges::input_range Rr> requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Rr>>>) && requires(std::ranges::range_value_t<Rr> v) { static_cast<std::byte>(v); } | |
| bool | Write (Rr &&r) noexcept |
| Write from an rvalue input range. | |
| template<std::input_iterator I, std::sentinel_for< I > S> requires (!std::is_class_v<std::remove_cv_t<std::iter_value_t<I>>>) && requires(std::iter_value_t<I> v) { static_cast<std::byte>(v); } | |
| bool | Write (I first, S last) noexcept |
Write from iterator pair whose value_type is convertible to std::byte. | |
| template<std::input_iterator I2, std::sentinel_for< I2 > S2> requires (!std::is_class_v<std::remove_cv_t<std::iter_value_t<I2>>>) && requires(std::iter_value_t<I2> v) { static_cast<std::byte>(v); } | |
| bool | Write (const std::size_t &count, I2 first, S2 last) noexcept |
Write up-to count bytes from an iterator pair (0 => all available). | |
| virtual bool | Write (const std::size_t &count, DataType &&data) noexcept=0 |
| Move bytes from a vector to the buffer. | |
| virtual bool | Write (const std::size_t &count, const ReadOnly &data) noexcept=0 |
| Write bytes from a vector to the buffer. | |
| bool | Write (const ReadOnly &data) noexcept |
| Write bytes from a vector to the buffer. | |
| virtual bool | Write (const std::size_t &count, ReadOnly &&data) noexcept=0 |
| Move bytes from a vector to the buffer. | |
| bool | Write (ReadOnly &&data) noexcept |
| Move bytes from a vector to the buffer. | |
Public Member Functions inherited from StormByte::Buffer::Generic | |
| Generic () noexcept=default | |
| Construct Generic. | |
| Generic (const DataType &data) noexcept | |
| Construct Generic. | |
| Generic (DataType &&data) noexcept | |
| Construct Generic with initial data using move semantics. | |
| Generic (const Generic &) noexcept=default | |
| Copy construct deleted. | |
| Generic (Generic &&) noexcept=default | |
| Move construct deleted. | |
| virtual | ~Generic () noexcept=0 |
| Virtual destructor. | |
| Generic & | operator= (const Generic &other)=default |
| Copy assign deleted. | |
| Generic & | operator= (Generic &&) noexcept=default |
| Move assign deleted. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from StormByte::Buffer::Generic | |
| template<std::ranges::input_range Src> requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Src>>>) && requires(std::ranges::range_value_t<Src> v) { static_cast<std::byte>(v); } | |
| static DataType | DataConvert (const Src &src) noexcept |
Convert various source types into the library DataType. | |
|
template<std::ranges::input_range Src> requires (!std::is_class_v<std::remove_cv_t<std::ranges::range_value_t<Src>>>) && requires(std::ranges::range_value_t<Src> v) { static_cast<std::byte>(v); } | |
| static DataType | DataConvert (Src &&src) noexcept |
| static DataType | DataConvert (std::string_view sv) noexcept |
Convert a std::string_view to DataType. | |
| static DataType | DataConvert (const char *s) noexcept |
Convert a null-terminated C string to DataType. | |
Protected Attributes inherited from StormByte::Buffer::Generic | |
| DataType | m_buffer |
| Internal buffer storage. | |
Generic class providing a buffer that can be written to but not read from.
|
inlinenoexcept |
|
inlinenoexcept |
|
pure virtualnoexcept |
Check if the buffer is writable.
Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, and StormByte::Buffer::SharedFIFO.
|
inlinenoexcept |
Write all elements from an input range to the buffer.
| R | An input range whose element type is convertible to std::byte. |
| r | The input range to write from. Elements are converted element-wise using static_cast<std::byte>. |
The entire range is converted into a DataType (the library's std::vector<std::byte>) and then forwarded to the canonical Write(count, DataType) entry point.
|
inlinenoexcept |
Write bytes from a vector to the buffer.
| data | Byte vector to append to the WriteOnly. |
Appends data to the buffer, growing capacity automatically if needed. Handles wrap-around efficiently. Ignores writes if buffer is closed.
|
pure virtualnoexcept |
Write bytes from a vector to the buffer.
| count | Number of bytes to write. |
| data | Byte vector to append to the WriteOnly. |
Appends data to the buffer, growing capacity automatically if needed. Handles wrap-around efficiently. Ignores writes if buffer is closed.
Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::FIFO, and StormByte::Buffer::Producer.
|
pure virtualnoexcept |
Write bytes from a vector to the buffer.
| count | Number of bytes to write. |
| data | Byte vector to append to the WriteOnly. |
Appends data to the buffer, growing capacity automatically if needed. Handles wrap-around efficiently. Ignores writes if buffer is closed.
Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::FIFO, and StormByte::Buffer::Producer.
|
inlinenoexcept |
Write up-to count elements from an input range.
| Rw | An input range whose value_type is convertible to std::byte. |
| count | Maximum number of elements to write; pass 0 to write the entire range. |
| r | The input range to read from. |
count if the range is shorter).Elements are copied and converted into an internal DataType buffer before invoking the canonical Write(count, DataType).
|
pure virtualnoexcept |
Move bytes from a vector to the buffer.
| count | Number of bytes to write. |
| data | Byte vector to append to the WriteOnly. |
Appends data to the buffer, growing capacity automatically if needed. Handles wrap-around efficiently. Ignores writes if buffer is closed.
Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::FIFO, and StormByte::Buffer::Producer.
|
inlinenoexcept |
Write up-to count bytes from an iterator pair (0 => all available).
Write up-to count elements from an iterator pair.
| I2 | Input iterator type whose value_type is convertible to std::byte. |
| S2 | Corresponding sentinel type for I2. |
| count | Maximum number of elements to write; pass 0 to write all. |
| first | Iterator to the beginning of the sequence. |
| last | Sentinel/iterator marking the end of the sequence. |
Iterates until count elements are consumed or first == last.
|
pure virtualnoexcept |
Move bytes from a vector to the buffer.
| count | Number of bytes to write. |
| data | Byte vector to append to the WriteOnly. |
Appends data to the buffer, growing capacity automatically if needed. Handles wrap-around efficiently. Ignores writes if buffer is closed.
Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::FIFO, and StormByte::Buffer::Producer.
|
inlinenoexcept |
Write up-to count elements from an rvalue range.
| Rrw | An input range type that may be an rvalue DataType. |
| count | Maximum number of elements to write; pass 0 to write the entire range. |
| r | The rvalue range to consume. If r is a DataType rvalue the implementation will move it into the write fast-path and trim it to count if necessary. Otherwise elements are converted and copied into a temporary DataType. |
|
inlinenoexcept |
Write from iterator pair whose value_type is convertible to std::byte.
Write all elements from an iterator pair.
| I | Input iterator type whose value_type is convertible to std::byte. |
| S | Corresponding sentinel type for I. |
| first | Iterator to the beginning of the sequence. |
| last | Sentinel/iterator marking the end of the sequence. |
Elements are converted via static_cast<std::byte> into an internal DataType buffer which is then forwarded to the canonical Write(count, DataType).
|
inlinenoexcept |
Move bytes from a vector to the buffer.
| data | Byte vector to append to the WriteOnly. |
Appends data to the buffer, growing capacity automatically if needed. Handles wrap-around efficiently. Ignores writes if buffer is closed.
|
inlinenoexcept |
Write from an rvalue input range.
| Rr | Input range type; this overload prefers moving when the range type is the library DataType (i.e. std::vector<std::byte>). |
| r | The rvalue range to write from. If r is a DataType rvalue it will be forwarded into the move-write fast-path; otherwise elements are converted and copied into a temporary DataType. |
|
inlinenoexcept |
Write from a string view (does not include terminating NUL).
These non-template overloads exist to ensure std::string / C-string inputs bind to a stable, well-defined implementation instead of the generic input-range template above. Without these entries, calls like Write("abc") or Write(std::string{}) may select the range template which can lead to surprising template instantiation differences and SFINAE interactions. The overloads also avoid copying the trailing NUL for string-literal arrays by explicitly constructing a std::string_view of size N-1.