Base module

SyncPacketQueue

Synchronized packet queue for event loop integration.

SyncPacketQueue

#include <icy/packetqueue.h>

Inherits: SyncQueue< IPacket >, PacketProcessor

Synchronized packet queue for event loop integration.

Public Attributes

ReturnNameDescription
PacketSignalemitter

emitter

PacketSignal emitter

Public Methods

ReturnNameDescription
SyncPacketQueue inline#### Parameters
SyncPacketQueue inlineUses the default libuv event loop.
voidprocess virtual inlineClones the incoming packet and pushes it onto the queue for synchronized dispatch. This queue is therefore an explicit PacketStream ownership boundary. Drops the packet with a warning if the queue has been cancelled.
boolaccepts virtual inlineReturns true if the packet can be cast to type T.
PacketRetentionretention virtual const inlineReturns 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.

SyncPacketQueue

inline

inline SyncPacketQueue(uv::Loop * loop, int maxSize)

Parameters

  • loop Event loop to synchronize dispatch onto.

  • maxSize Maximum number of queued packets before oldest are dropped.


SyncPacketQueue

inline

inline SyncPacketQueue(int maxSize)

Uses the default libuv event loop.

Parameters

  • maxSize Maximum number of queued packets before oldest are dropped.

process

virtual inline

virtual inline void process(IPacket & packet)

Clones the incoming packet and pushes it onto the queue for synchronized dispatch. This queue is therefore an explicit PacketStream ownership boundary. Drops the packet with a warning if the queue has been cancelled.

Parameters

  • packet Incoming packet to enqueue.

accepts

virtual inline

virtual inline bool accepts(IPacket * packet)

Returns true if the packet can be cast to type T.

Parameters

  • packet Packet to test.

Returns

True if dynamic_cast<T*>(packet) succeeds.


retention

virtual const inline

virtual inline PacketRetention retention() 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.

Protected Methods

ReturnNameDescription
voiddispatch virtual inlineEmits the packet to downstream processors from the event loop thread.
voidonStreamStateChange virtual inlineCancels the queue on Closed or [Error](icy-Error.html#error) stream state transitions.

dispatch

virtual inline

virtual inline void dispatch(T & packet)

Emits the packet to downstream processors from the event loop thread.

Parameters

  • packet Packet to dispatch.

onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState &)

Cancels the queue on Closed or [Error](icy-Error.html#error) stream state transitions.

Parameters

  • state New stream state.

Public Types

NameDescription
Queue
Processor

Queue

SyncQueue< T > Queue()

Processor

PacketProcessor Processor()