StormByte-Buffer 2.0.0
C++26 buffer module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Buffer::WriteOnly Class Referenceabstract

Buffer that can be written and not read. More...

#include <StormByte/buffer/generic.hxx>

Inheritance diagram for StormByte::Buffer::WriteOnly:
Collaboration diagram for StormByte::Buffer::WriteOnly:

Public Member Functions

Lifecycle
 WriteOnly () noexcept
 Default constructor.
 
 WriteOnly (const WriteOnly &other)=default
 Copy constructor.
 
 WriteOnly (WriteOnly &&other) noexcept=default
 Move constructor.
 
virtual ~WriteOnly () noexcept
 Destructor.
 
WriteOnly & operator= (const WriteOnly &other)=default
 Copy assignment.
 
WriteOnly & operator= (WriteOnly &&other) noexcept=default
 Move assignment.
 
Lifecycle of the store
virtual bool IsWritable () const noexcept=0
 Whether the buffer accepts writes.
 
virtual void Close () noexcept=0
 Stop further writes.
 
virtual void SetError () noexcept=0
 Permanent error.
 
Write
virtual bool Write (const StormByte::ByteSize &count, const BinaryData &data) noexcept=0
 Append bytes from a StormByte::BinaryData (copy).
 
virtual bool Write (const StormByte::ByteSize &count, BinaryData &&data) noexcept=0
 Append bytes from a StormByte::BinaryData (move).
 
virtual bool Write (const StormByte::ByteSize &count, const ReadOnly &data) noexcept=0
 Append bytes from a ReadOnly (copy).
 
virtual bool Write (const StormByte::ByteSize &count, ReadOnly &&data) noexcept=0
 Append bytes from a ReadOnly (extract).
 
Write (ReadOnly helpers)
bool Write (const ReadOnly &data) noexcept
 Append all available bytes from a ReadOnly (copy).
 
bool Write (ReadOnly &&data) noexcept
 Append all available bytes from a ReadOnly (extract).
 
Write (string helpers)
bool Write (std::string_view sv) noexcept
 Write a string view.
 
bool Write (const char *s) noexcept
 Write a C string.
 
bool Write (const StormByte::ByteSize &count, std::string_view sv) noexcept
 Write up to count characters of a string view.
 
bool Write (const StormByte::ByteSize &count, const char *s) noexcept
 Write up to count characters of a C string.
 
template<std::size_t N>
bool Write (const char(&s)[N]) noexcept
 Write a string literal without the trailing NUL.
 
Write (range / iterator helpers)
template<Type::ByteInputRange R>
bool Write (const R &r) noexcept
 Write all elements from an input range.
 
template<Type::ByteInputRange Rw>
bool Write (const StormByte::ByteSize &count, const Rw &r) noexcept
 Write up to count elements from an input range.
 
template<Type::ByteInputRange Rrw>
bool Write (const StormByte::ByteSize &count, Rrw &&r) noexcept
 Write up to count elements from an rvalue range.
 
template<Type::ByteInputRange Rr>
bool Write (Rr &&r) noexcept
 Write all elements from an rvalue range.
 
template<Type::ByteInputIterator I, typename S >
requires Type::SentinelFor<S, I>
bool Write (I first, S last) noexcept
 Write all elements from an iterator pair.
 
template<Type::ByteInputIterator I2, typename S2 >
requires Type::SentinelFor<S2, I2>
bool Write (const StormByte::ByteSize &count, I2 first, S2 last) noexcept
 Write up to count elements from an iterator pair.
 
- Public Member Functions inherited from StormByte::Buffer::Generic
 Generic () noexcept=default
 Default constructor.
 
 Generic (const Generic &other) noexcept=default
 Copy constructor.
 
 Generic (Generic &&other) noexcept=default
 Move constructor.
 
virtual ~Generic () noexcept=0
 Pure virtual destructor.
 
Generic & operator= (const Generic &other)=default
 Copy assignment.
 
Generic & operator= (Generic &&other) noexcept=default
 Move assignment.
 
virtual StormByte::ByteSize Size () const noexcept=0
 Total number of bytes stored.
 

Additional Inherited Members

- Static Protected Member Functions inherited from StormByte::Buffer::Generic
template<Type::ByteInputRange Src>
static BinaryData DataConvert (const Src &src) noexcept
 Convert an lvalue input range to StormByte::BinaryData.
 
template<Type::ByteInputRange Src>
static BinaryData DataConvert (Src &&src) noexcept
 Convert an rvalue input range to StormByte::BinaryData.
 
static BinaryData DataConvert (std::string_view sv) noexcept
 Convert a string view to StormByte::BinaryData.
 
static BinaryData DataConvert (const char *s) noexcept
 Convert a C string to StormByte::BinaryData.
 

Detailed Description

Buffer that can be written and not read.

Close, error and Write. Occupancy is Generic::Size.

See also
ReadOnly, ReadWrite, Generic

Constructor & Destructor Documentation

◆ WriteOnly() [1/3]

StormByte::Buffer::WriteOnly::WriteOnly ( )
inlinenoexcept

Default constructor.

◆ WriteOnly() [2/3]

StormByte::Buffer::WriteOnly::WriteOnly ( const WriteOnly &  other)
default

Copy constructor.

Parameters
otherInstance to copy.

◆ WriteOnly() [3/3]

StormByte::Buffer::WriteOnly::WriteOnly ( WriteOnly &&  other)
defaultnoexcept

Move constructor.

Parameters
otherInstance to take from.

◆ ~WriteOnly()

virtual StormByte::Buffer::WriteOnly::~WriteOnly ( )
virtualnoexcept

Destructor.

Member Function Documentation

◆ Close()

virtual void StormByte::Buffer::WriteOnly::Close ( )
pure virtualnoexcept

Stop further writes.

Readers may still drain the store.

Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.

◆ IsWritable()

virtual bool StormByte::Buffer::WriteOnly::IsWritable ( ) const
pure virtualnoexcept

Whether the buffer accepts writes.

Returns
false if closed or in error.

Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.

◆ operator=() [1/2]

WriteOnly & StormByte::Buffer::WriteOnly::operator= ( const WriteOnly &  other)
default

Copy assignment.

Parameters
otherInstance to copy.
Returns
*this.

◆ operator=() [2/2]

WriteOnly & StormByte::Buffer::WriteOnly::operator= ( WriteOnly &&  other)
defaultnoexcept

Move assignment.

Parameters
otherInstance to take from.
Returns
*this.

◆ SetError()

virtual void StormByte::Buffer::WriteOnly::SetError ( )
pure virtualnoexcept

◆ Write() [1/17]

bool StormByte::Buffer::WriteOnly::Write ( const char *  s)
inlinenoexcept

Write a C string.

Parameters
sSource. Null is an empty write.
Returns
false if closed or in error.

◆ Write() [2/17]

template<std::size_t N>
bool StormByte::Buffer::WriteOnly::Write ( const char(&)  s[N])
inlinenoexcept

Write a string literal without the trailing NUL.

Template Parameters
NArray extent (includes the NUL of a literal).
Parameters
sLiteral.
Returns
false if closed or in error.

◆ Write() [3/17]

template<Type::ByteInputRange R>
bool StormByte::Buffer::WriteOnly::Write ( const R &  r)
inlinenoexcept

Write all elements from an input range.

Template Parameters
RRange whose value_type converts to std::byte.
Parameters
rSource range.
Returns
false if closed or in error.

◆ Write() [4/17]

bool StormByte::Buffer::WriteOnly::Write ( const ReadOnly &  data)
inlinenoexcept

Append all available bytes from a ReadOnly (copy).

Parameters
dataSource buffer.
Returns
false if closed or in error.

◆ Write() [5/17]

virtual bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
BinaryData &&  data 
)
pure virtualnoexcept

Append bytes from a StormByte::BinaryData (move).

Parameters
countBytes to write.
dataSource.
Returns
false if closed or in error.
See also
IsWritable()

Implemented in StormByte::Buffer::Producer, StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.

◆ Write() [6/17]

virtual bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
const BinaryData &  data 
)
pure virtualnoexcept

Append bytes from a StormByte::BinaryData (copy).

Parameters
countBytes to write.
dataSource.
Returns
false if closed or in error.
See also
IsWritable()

Implemented in StormByte::Buffer::Producer, StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, StormByte::Buffer::FIFO, and StormByte::Buffer::Ring.

◆ Write() [7/17]

bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
const char *  s 
)
inlinenoexcept

Write up to count characters of a C string.

Parameters
countMaximum characters. 0 = entire string.
sSource. May be null.
Returns
false if closed or in error.

◆ Write() [8/17]

virtual bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
const ReadOnly &  data 
)
pure virtualnoexcept

Append bytes from a ReadOnly (copy).

Parameters
countBytes to write.
dataSource buffer.
Returns
false if closed or in error.
See also
IsWritable()

Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, StormByte::Buffer::FIFO, StormByte::Buffer::Producer, and StormByte::Buffer::Ring.

◆ Write() [9/17]

template<Type::ByteInputRange Rw>
bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
const Rw &  r 
)
inlinenoexcept

Write up to count elements from an input range.

Template Parameters
RwRange type.
Parameters
countMaximum elements. 0 = entire range.
rSource range.
Returns
false if closed or in error.

◆ Write() [10/17]

template<Type::ByteInputIterator I2, typename S2 >
requires Type::SentinelFor<S2, I2>
bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
I2  first,
S2  last 
)
inlinenoexcept

Write up to count elements from an iterator pair.

Template Parameters
I2Input iterator.
S2Sentinel for I2.
Parameters
countMaximum elements. 0 = all.
firstBegin.
lastEnd.
Returns
false if closed or in error.

◆ Write() [11/17]

virtual bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
ReadOnly &&  data 
)
pure virtualnoexcept

Append bytes from a ReadOnly (extract).

Parameters
countBytes to write.
dataSource buffer.
Returns
false if closed or in error.
See also
IsWritable()

Implemented in StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, StormByte::Buffer::FIFO, StormByte::Buffer::Producer, and StormByte::Buffer::Ring.

◆ Write() [12/17]

template<Type::ByteInputRange Rrw>
bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
Rrw &&  r 
)
inlinenoexcept

Write up to count elements from an rvalue range.

Template Parameters
RrwRange type. Moved when StormByte::BinaryData.
Parameters
countMaximum elements. 0 = entire range.
rSource range.
Returns
false if closed or in error.

◆ Write() [13/17]

bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize &  count,
std::string_view  sv 
)
inlinenoexcept

Write up to count characters of a string view.

Parameters
countMaximum characters. 0 = entire view.
svSource.
Returns
false if closed or in error.

◆ Write() [14/17]

template<Type::ByteInputIterator I, typename S >
requires Type::SentinelFor<S, I>
bool StormByte::Buffer::WriteOnly::Write ( I  first,
S  last 
)
inlinenoexcept

Write all elements from an iterator pair.

Template Parameters
IInput iterator.
SSentinel for I.
Parameters
firstBegin.
lastEnd.
Returns
false if closed or in error.

◆ Write() [15/17]

bool StormByte::Buffer::WriteOnly::Write ( ReadOnly &&  data)
inlinenoexcept

Append all available bytes from a ReadOnly (extract).

Parameters
dataSource buffer.
Returns
false if closed or in error.

◆ Write() [16/17]

template<Type::ByteInputRange Rr>
bool StormByte::Buffer::WriteOnly::Write ( Rr &&  r)
inlinenoexcept

Write all elements from an rvalue range.

Template Parameters
RrRange type. Moved when StormByte::BinaryData.
Parameters
rSource.
Returns
false if closed or in error.

◆ Write() [17/17]

bool StormByte::Buffer::WriteOnly::Write ( std::string_view  sv)
inlinenoexcept

Write a string view.

No trailing NUL.

Parameters
svSource.
Returns
false if closed or in error.

The documentation for this class was generated from the following file: