Base module

PacketStreamAdapter

This class is a wrapper for integrating external classes with the a PacketStream's

#include <icy/packetstream.h>

class PacketStreamAdapter

Defined in src/base/include/icy/packetstream.h:44

This class is a wrapper for integrating external classes with the a PacketStream's data flow and state machine.

Public Methods

ReturnNameDescription
PacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
~PacketStreamAdapter virtual inline
voidemit virtualEmit a mutable raw buffer as a packet.
voidemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
voidemit virtualEmit a string as a packet (data is copied internally).
voidemit virtualEmit a flag-only packet carrying no payload data.
voidemit virtualEmit an existing packet directly onto the outgoing signal.
PacketSignal &getEmitterReturns a reference to the outgoing packet signal.
PacketRetentionretention 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.
voidonStreamStateChange 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.

PacketStreamAdapter

PacketStreamAdapter(PacketSignal & emitter)

Defined in src/base/include/icy/packetstream.h:49

Construct the adapter, binding it to the given packet signal.

Parameters

ParameterTypeDescription
emitterPacketSignal &The outgoing packet signal owned by the subclass.

~PacketStreamAdapter

virtual inline

virtual inline ~PacketStreamAdapter()

Defined in src/base/include/icy/packetstream.h:50


emit

virtual

virtual void emit(char * data, size_t len, unsigned flags = 0)

Defined in src/base/include/icy/packetstream.h:56

Emit a mutable raw buffer as a packet.

Parameters

ParameterTypeDescription
datachar *Pointer to the buffer (not copied; caller retains ownership).
lensize_tNumber of bytes in the buffer.
flagsunsignedOptional packet flags (see PacketFlags).

emit

virtual

virtual void emit(const char * data, size_t len, unsigned flags = 0)

Defined in src/base/include/icy/packetstream.h:62

Emit a read-only raw buffer as a packet (data is copied internally).

Parameters

ParameterTypeDescription
dataconst char *Pointer to the buffer.
lensize_tNumber of bytes in the buffer.
flagsunsignedOptional packet flags (see PacketFlags).

emit

virtual

virtual void emit(const std::string & str, unsigned flags = 0)

Defined in src/base/include/icy/packetstream.h:67

Emit a string as a packet (data is copied internally).

Parameters

ParameterTypeDescription
strconst std::string &String payload.
flagsunsignedOptional packet flags (see PacketFlags).

emit

virtual

virtual void emit(unsigned flags = 0)

Defined in src/base/include/icy/packetstream.h:71

Emit a flag-only packet carrying no payload data.

Parameters

ParameterTypeDescription
flagsunsignedPacket flags to embed in the emitted FlagPacket.

emit

virtual

virtual void emit(IPacket & packet)

Defined in src/base/include/icy/packetstream.h:75

Emit an existing packet directly onto the outgoing signal.

Reimplemented by

Parameters

ParameterTypeDescription
packetIPacket &The packet to forward; must remain valid for the duration of the call.

getEmitter

PacketSignal & getEmitter()

Defined in src/base/include/icy/packetstream.h:78

Returns a reference to the outgoing packet signal.


retention

virtual const

virtual PacketRetention retention() const

Defined in src/base/include/icy/packetstream.h:86

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.

Reimplemented by


onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState &)

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

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.

Reimplemented by

Protected Attributes

ReturnNameDescription
PacketSignal &_emitter

_emitter

PacketSignal & _emitter

Type: PacketSignal &

Defined in src/base/include/icy/packetstream.h:102

Protected Methods

ReturnNameDescription
PacketStreamAdapterNonCopyable and NonMovable.
PacketStreamAdapter &operator=Deleted assignment operator.
PacketStreamAdapterDeleted constructor.
PacketStreamAdapter &operator=Deleted assignment operator.

PacketStreamAdapter

PacketStreamAdapter(const PacketStreamAdapter &) = delete

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

NonCopyable and NonMovable.


operator=

PacketStreamAdapter & operator=(const PacketStreamAdapter &) = delete

Defined in src/base/include/icy/packetstream.h:98

Deleted assignment operator.


PacketStreamAdapter

PacketStreamAdapter(PacketStreamAdapter &&) = delete

Defined in src/base/include/icy/packetstream.h:99

Deleted constructor.


operator=

PacketStreamAdapter & operator=(PacketStreamAdapter &&) = delete

Defined in src/base/include/icy/packetstream.h:100

Deleted assignment operator.