|
|
| | Sink () noexcept |
| | Constructs an empty Sink with zero buckets.
|
| |
| | Sink (const Sink &)=delete |
| | Copy constructor is deleted (Sink is non-copyable).
|
| |
| | Sink (Sink &&) noexcept=delete |
| | Move constructor is deleted (Sink is non-movable).
|
| |
| | ~Sink () noexcept |
| | Destructor.
|
| |
| Sink & | operator= (const Sink &)=delete |
| | Copy assignment operator is deleted (Sink is non-copyable).
|
| |
| Sink & | operator= (Sink &&) noexcept=delete |
| | Move assignment operator is deleted (Sink is non-movable).
|
| |
|
| void | Push (int key, T item) noexcept |
| | Pushes an item into the bucket specified by key.
|
| |
| void | Eof () noexcept |
| | Closes the Sink and releases writer holds on its hoppers.
|
| |
|
| Lane | To (int key) noexcept |
| | Redirect of one hopper key.
|
| |
| Sink & | operator>> (Sink &dest) noexcept |
| | Share every existing hopper with dest.
|
| |
| Sink & | operator<< (Sink &src) noexcept |
| | Same as src >> *this (all hoppers).
|
| |
| Sink & | operator<< (Lane lane) noexcept |
| | Same as lane >> *this.
|
| |
| void | Bind (Sink &consumer) |
| | Shares all existing hoppers on this Sink with the consumer Sink.
|
| |
| void | Bind (int key, Sink &consumer) |
| | Creates or retrieves the hopper for key and shares it with consumer.
|
| |
| void | Drain () noexcept |
| | Marks Sink as a terminal producer (un-wired Push calls drop instead of waiting).
|
| |
| bool | Draining () const noexcept |
| | Checks whether Drain was called.
|
| |
| void | Notify (std::condition_variable &consumer) noexcept |
| | Registers consumer condition variable to notify on all current and future hoppers.
|
| |
| void | Unnotify () noexcept |
| | Clears Notify on this Sink and on every hopper.
|
| |
|
| std::size_t | Capacity (int key) const noexcept |
| | Gets capacity ceiling of bucket key.
|
| |
| void | Capacity (int key, std::size_t capacity) noexcept |
| | Sets capacity ceiling of bucket key.
|
| |
| std::size_t | Size (int key) const noexcept |
| | Gets pending item count in bucket key.
|
| |
| bool | Full (int key) const noexcept |
| | Checks if bucket key is full.
|
| |
|
| T | Pop () noexcept |
| | Pops one item from the Sink using default round-robin order.
|
| |
| T | Pop (const Select &select) noexcept |
| | Pops one item from the Sink using a custom selection function.
|
| |
| bool | EoF () const noexcept |
| | Checks if the Sink is finished.
|
| |
| bool | Ready () const noexcept |
| | Checks whether a Pop call can return immediately (item available or EoF).
|
| |
template<Type::MoveConstructible T>
class StormByte::Buffer::Sink< T >
Set of Hopper buckets keyed by an integer.
Sink manages a collection of Hopper queues keyed by an integer (representing channels, tracks, sessions, etc.). Sink does not interpret the integer key.
Key characteristics:
- Wiring:
producer >> consumer shares every existing hopper. producer.To(key) >> consumer creates or shares one key. When this Sink already holds that hopper, dest is a co-writer: Eof on this Sink then only closes the hopper when the last writer closes. consumer << producer and consumer << producer.To(key) are the same edges. Bind remains for one or two releases and is deprecated.
- Drain: Terminal producer flag. Push to an un-wired key discards the item without waiting for a consumer.
- Pop: Retrieves items across buckets using Round-Robin or custom Select.
- EoF: Closes the Sink and CloseWriter on hoppers this Sink writes.
- Template Parameters
-
| T | Item type stored in the hoppers (must be MoveConstructible). |