ThreadedStreamReader
ThreadedStreamReader
#include <icy/packetio.h>class ThreadedStreamReaderDefined in src/base/include/icy/packetio.h:31
Inherits:
PacketStreamAdapter,Startable
Threaded stream reader class.
This class can be connected to a [PacketStream](icy-PacketStream.html#packetstream) to read input from any class that derives from std::istream. It's most regularly used for reading input files.
List of all members
| Name | Kind | Owner |
|---|---|---|
emitter | variable | Declared here |
ThreadedStreamReader | function | Declared here |
~ThreadedStreamReader | function | Declared here |
start | function | Declared here |
stop | function | Declared here |
stream | function | Declared here |
stream | function | Declared here |
_runner | variable | Declared here |
_istream | variable | Declared here |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
~PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
getEmitter | function | Inherited from PacketStreamAdapter |
retention | function | Inherited from PacketStreamAdapter |
onStreamStateChange | function | Inherited from PacketStreamAdapter |
_emitter | variable | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
start | function | Inherited from Startable |
stop | function | Inherited from Startable |
Inherited from PacketStreamAdapter
| Kind | Name | Description |
|---|---|---|
function | PacketStreamAdapter | Construct the adapter, binding it to the given packet signal. |
function | ~PacketStreamAdapter virtual inline | |
function | emit virtual | Emit a mutable raw buffer as a packet. |
function | emit virtual | Emit a read-only raw buffer as a packet (data is copied internally). |
function | emit virtual | Emit a string as a packet (data is copied internally). |
function | emit virtual | Emit a flag-only packet carrying no payload data. |
function | emit virtual | Emit an existing packet directly onto the outgoing signal. |
function | getEmitter | Returns a reference to the outgoing packet signal. |
function | retention virtual const | Returns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph. |
function | onStreamStateChange virtual inline | Called by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios. |
variable | _emitter | |
function | PacketStreamAdapter | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | PacketStreamAdapter | Deleted constructor. |
function | operator= | Deleted assignment operator. |
Inherited from Startable
| Kind | Name | Description |
|---|---|---|
function | start virtual | Starts the object (e.g. begins processing or listening). |
function | stop virtual | Stops the object (e.g. halts processing or closes resources). |
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketSignal | emitter |
emitter
PacketSignal emitterDefined in src/base/include/icy/packetio.h:93
Public Methods
| Return | Name | Description |
|---|---|---|
ThreadedStreamReader inline | ||
~ThreadedStreamReader inline | Stops the reader thread and deletes the owned stream. | |
void | start virtual inline override | Starts the reader thread; emits one line per iteration as a RawPacket. Emits a FlagPacket with [PacketFlags::Final](webrtcsupport.html#namespaceicy_1a3d1e0d9028d45b9ec824bf4306047f18abeae421a14a34f831c113f61323d1ab3) on EOF. |
void | stop virtual inline override | Cancels the reader thread. |
StreamT & | stream inline | Returns the internal stream cast to StreamT. |
std::istream & | stream inline |
ThreadedStreamReader
inline
inline ThreadedStreamReader(std::istream * is)Defined in src/base/include/icy/packetio.h:36
Parameters
isInput stream to read from; takes ownership.
~ThreadedStreamReader
inline
inline ~ThreadedStreamReader()Defined in src/base/include/icy/packetio.h:44
Stops the reader thread and deletes the owned stream.
start
virtual inline override
virtual inline void start() overrideDefined in src/base/include/icy/packetio.h:55
Starts the reader thread; emits one line per iteration as a RawPacket. Emits a FlagPacket with [PacketFlags::Final](webrtcsupport.html#namespaceicy_1a3d1e0d9028d45b9ec824bf4306047f18abeae421a14a34f831c113f61323d1ab3) on EOF.
Reimplements
stop
virtual inline override
virtual inline void stop() overrideDefined in src/base/include/icy/packetio.h:71
Cancels the reader thread.
Reimplements
stream
inline
template<class StreamT> inline StreamT & stream()Defined in src/base/include/icy/packetio.h:81
Returns the internal stream cast to StreamT.
Parameters
StreamTTarget stream type derived fromstd::istream.
Returns
Reference to the cast stream.
Exceptions
std::runtime_errorif the cast fails.
stream
inline
inline std::istream & stream()Defined in src/base/include/icy/packetio.h:91
Returns
Reference to the underlying input stream.
Protected Attributes
_runner
Thread _runnerDefined in src/base/include/icy/packetio.h:96
_istream
std::istream * _istream