Home
Base module

ThreadedStreamReader

Threaded stream reader class.

ThreadedStreamReader

#include <icy/packetio.h>
class ThreadedStreamReader

Defined 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

NameKindOwner
emittervariableDeclared here
ThreadedStreamReaderfunctionDeclared here
~ThreadedStreamReaderfunctionDeclared here
startfunctionDeclared here
stopfunctionDeclared here
streamfunctionDeclared here
streamfunctionDeclared here
_runnervariableDeclared here
_istreamvariableDeclared here
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
~PacketStreamAdapterfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
getEmitterfunctionInherited from PacketStreamAdapter
retentionfunctionInherited from PacketStreamAdapter
onStreamStateChangefunctionInherited from PacketStreamAdapter
_emittervariableInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
startfunctionInherited from Startable
stopfunctionInherited from Startable

Inherited from PacketStreamAdapter

KindNameDescription
functionPacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
function~PacketStreamAdapter virtual inline
functionemit virtualEmit a mutable raw buffer as a packet.
functionemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
functionemit virtualEmit a string as a packet (data is copied internally).
functionemit virtualEmit a flag-only packet carrying no payload data.
functionemit virtualEmit an existing packet directly onto the outgoing signal.
functiongetEmitterReturns a reference to the outgoing packet signal.
functionretention virtual constReturns 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.
functiononStreamStateChange virtual inlineCalled 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
functionPacketStreamAdapterNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionPacketStreamAdapterDeleted constructor.
functionoperator=Deleted assignment operator.

Inherited from Startable

KindNameDescription
functionstart virtualStarts the object (e.g. begins processing or listening).
functionstop virtualStops the object (e.g. halts processing or closes resources).

Public Attributes

ReturnNameDescription
PacketSignalemitter

emitter

PacketSignal emitter

Defined in src/base/include/icy/packetio.h:93

Public Methods

ReturnNameDescription
ThreadedStreamReader inline
~ThreadedStreamReader inlineStops the reader thread and deletes the owned stream.
voidstart virtual inline overrideStarts the reader thread; emits one line per iteration as a RawPacket. Emits a FlagPacket with [PacketFlags::Final](webrtcsupport.html#namespaceicy_1a3d1e0d9028d45b9ec824bf4306047f18abeae421a14a34f831c113f61323d1ab3) on EOF.
voidstop virtual inline overrideCancels the reader thread.
StreamT &stream inlineReturns 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

  • is Input 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() override

Defined 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() override

Defined 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

  • StreamT Target stream type derived from std::istream.

Returns

Reference to the cast stream.

Exceptions

  • std::runtime_error if 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

ReturnNameDescription
Thread_runner
std::istream *_istream

_runner

Thread _runner

Defined in src/base/include/icy/packetio.h:96


_istream

std::istream * _istream

Defined in src/base/include/icy/packetio.h:97