Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorChannel::StreamWriter Class Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ StreamWriter()

PhosphorChannel::StreamWriter::StreamWriter ( const StreamWriter & )
delete

Member Function Documentation

◆ close()

void PhosphorChannel::StreamWriter::close ( )

No frame follows. The queued ones still go out.

◆ codec()

const std::string & PhosphorChannel::StreamWriter::codec ( ) const
inline

◆ id()

std::uint32_t PhosphorChannel::StreamWriter::id ( ) const
inline

◆ maxFrame()

std::size_t PhosphorChannel::StreamWriter::maxFrame ( ) const

The largest frame: the window less Stream::FrameCost.

Zero before the reader granted a window.

◆ operator=()

StreamWriter & PhosphorChannel::StreamWriter::operator= ( const StreamWriter & )
delete

◆ tryWrite()

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.

◆ 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.


The documentation for this class was generated from the following file:
  • phosphor-channel/include/PhosphorChannel/Stream.h