23#include <StormByte/type_traits.hxx>
25#include <condition_variable>
103 template<StormByte::Type::ByteInputRange R>
104 requires (!StormByte::Type::SameAs<R, DataType>)
112 template<StormByte::Type::ByteInputRange Rr>
196 inline
bool operator!=(const
SharedFIFO& other) const noexcept {
197 return !(*
this == other);
218 virtual const
DataType& Data() const noexcept override;
227 virtual
bool Empty() const noexcept override;
233 virtual
bool EoF() const noexcept override;
239 bool HasError() const noexcept;
246 virtual
bool IsReadable() const noexcept override;
253 virtual
bool IsWritable() const noexcept override;
260 virtual std::
size_t Size() const noexcept override;
273 void Clean() noexcept override;
280 virtual
void Clear() noexcept override;
288 virtual
void Close() noexcept override;
297 virtual
bool Drop(const std::
size_t& count) noexcept override;
306 virtual
void Seek(const std::ptrdiff_t& offset, const
Position& mode) const noexcept override;
313 virtual
void SetError() noexcept override;
329 virtual std::
string HexDump(const std::
size_t& columns = 0,
330 const std::
size_t& byte_limit = 0) const noexcept override;
339 mutable std::mutex m_mutex;
340 mutable std::condition_variable_any m_cv;
346 std::ostringstream HexDumpHeader() const noexcept override;
355 virtual
bool ReadInternal(const std::
size_t& count,
DataType& outBuffer,
356 const
Operation& flag) noexcept override;
365 virtual
bool ReadInternal(const std::
size_t& count,
WriteOnly& outBuffer,
366 const
Operation& flag) noexcept override;
376 void Wait(const std::
size_t& n, std::unique_lock<std::mutex>& lock) const;
384 virtual
bool WriteInternal(const std::
size_t& count, const
DataType& src) noexcept override;
392 virtual
bool WriteInternal(const std::
size_t& count,
DataType&& src) noexcept override;
Byte-oriented FIFO buffer with grow-on-demand and close/error support.
Definition fifo.hxx:58
Operation
Kind of internal read operation.
Definition fifo.hxx:454
Thread-safe FIFO built on top of FIFO.
Definition shared_fifo.hxx:73
SharedFIFO(FIFO &&other) noexcept
Construct by moving a plain FIFO.
Definition shared_fifo.hxx:137
virtual std::size_t AvailableBytes() const noexcept override
Bytes available from the current read position (thread-safe).
SharedFIFO(SharedFIFO &&)=delete
Move constructor (deleted – mutex / condition_variable are not movable).
SharedFIFO(DataType &&data) noexcept
Construct with initial data (move).
Definition shared_fifo.hxx:96
SharedFIFO(const char *s) noexcept
Construct from a null-terminated C string.
Definition shared_fifo.hxx:125
SharedFIFO(const FIFO &other)
Construct by copying a plain FIFO.
Definition shared_fifo.hxx:131
SharedFIFO(const R &r) noexcept
Construct from an input range (copy / convert).
Definition shared_fifo.hxx:105
virtual ~SharedFIFO() noexcept
Virtual destructor.
SharedFIFO(std::string_view sv) noexcept
Construct from a string view (no trailing NUL).
Definition shared_fifo.hxx:119
SharedFIFO(Rr &&r) noexcept
Construct from an rvalue range.
Definition shared_fifo.hxx:113
SharedFIFO(const SharedFIFO &)=delete
Copy constructor (deleted – synchronization primitives are not copyable).
SharedFIFO() noexcept=default
Default construct an empty SharedFIFO.
Pure interface for a buffer that can be written but not read.
Definition generic.hxx:420
Buffer module of the StormByte suite.
std::vector< std::byte > DataType
Primary byte storage type used throughout the buffer API.
Definition typedefs.hxx:62
Position
Forward declaration of the WriteOnly interface.
Definition typedefs.hxx:50
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:28