The writing end of one channel of a stream. More...
#include <PhosphorChannel/Stream.h>
Public Member Functions | |
| StreamWriter (const StreamWriter &)=delete | |
| StreamWriter & | operator= (const StreamWriter &)=delete |
| std::uint32_t | id () const |
| const std::string & | codec () const |
| WriteResult | tryWrite (std::string_view frame) |
| Queues one frame without waiting. | |
| WriteResult | write (std::string_view frame, int timeoutMs) |
Waits up to timeoutMs (-1: no limit) for the window, and runs the stream meanwhile, callbacks included. | |
| std::size_t | maxFrame () const |
| The largest frame: the window less Stream::FrameCost. | |
| void | close () |
| No frame follows. The queued ones still go out. | |
The writing end of one channel of a stream.
The stream owns it. The pointer stays valid until the stream is destroyed, or until openWriter() opens its id again after the channel ended.
|
delete |
| void PhosphorChannel::StreamWriter::close | ( | ) |
No frame follows. The queued ones still go out.
|
inline |
|
inline |
| std::size_t PhosphorChannel::StreamWriter::maxFrame | ( | ) | const |
The largest frame: the window less Stream::FrameCost.
Zero before the reader granted a window.
|
delete |
| WriteResult PhosphorChannel::StreamWriter::tryWrite | ( | std::string_view | frame | ) |
Queues one frame without waiting.
WouldBlock when the frame and its cost do not fit the window that the reader has left: onWritable says when it may. Closed after close() or once the stream cannot write.
| WriteResult PhosphorChannel::StreamWriter::write | ( | std::string_view | frame, |
| int | timeoutMs ) |
Waits up to timeoutMs (-1: no limit) for the window, and runs the stream meanwhile, callbacks included.
Two ends that both wait in write() get no window unless their callbacks read what arrives. Closed once the input ended, since the window comes back through it.