48#include <condition_variable>
54 template<Type::MoveConstructible T>
class Sink;
75 template<Type::MoveConstructible T>
218 T
Front() const noexcept requires
std::copy_constructible<T>;
231 bool EoF() const noexcept;
287 hopper << std::move(item);
298 hopper << std::move(item);
303 friend class Sink<T>;
305 void AddWriter() noexcept;
306 void CloseWriter() noexcept;
312 class Implementation;
314 std::unique_ptr<Implementation> m_io;
318#include <StormByte/buffer/hopper.txx>
Single-producer single-consumer (SPSC) typed item queue.
Definition hopper.hxx:76
void Notify(std::condition_variable &wake) noexcept
Registers the consumer condition variable to notify on Push or Eof.
StormByte::Size Capacity() const noexcept
Gets the current capacity ceiling.
bool Empty() const noexcept
Checks whether the queue has no pending items.
T Front() const noexcept
Copy of the next item without dequeuing.
bool Ready() const noexcept
Whether Pop can return an item or production is finished.
void Eof() noexcept
Marks end of production and wakes waiters.
T Pop() noexcept
Pops one item from the bucket, or returns default-constructed T if dry.
unsigned Writers() const noexcept
Live writers attached to this hopper.
void Unnotify() noexcept
Drops the pointer set by Notify.
Hopper() noexcept
Constructs an empty unbounded Hopper.
bool EoF() const noexcept
Checks whether Eof was called by a producer.
friend Hopper & operator>>(T &&item, Hopper &hopper) noexcept
Write: rvalue item flows into hopper.
Definition hopper.hxx:297
bool Full() const noexcept
Checks whether a bounded bucket cannot accept another Push without waiting.
void Push(T item) noexcept
Enqueues one item and signals the consumer if Notify was configured.
Set of Hopper buckets keyed by an integer.
Definition sink.hxx:79
Buffer module of the StormByte suite.
Root namespace of the StormByte C++ suite.