Base module

AsyncPacketQueue

Thread-based asynchronous packet dispatch queue.

AsyncPacketQueue

#include <icy/packetqueue.h>

Inherits: AsyncQueue< IPacket >, PacketProcessor

Thread-based asynchronous packet dispatch queue.

Public Attributes

ReturnNameDescription
PacketSignalemitter

emitter

PacketSignal emitter

Public Methods

ReturnNameDescription
AsyncPacketQueue inline#### Parameters
voidclose virtual inlineFlushes remaining packets, cancels the queue, and joins the dispatch thread.
voidprocess virtual inlineClones the incoming packet and pushes it onto the async queue. 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.

AsyncPacketQueue

inline

inline AsyncPacketQueue(int maxSize)

Parameters

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

close

virtual inline

virtual inline void close()

Flushes remaining packets, cancels the queue, and joins the dispatch thread.


process

virtual inline

virtual inline void process(IPacket & packet)

Clones the incoming packet and pushes it onto the async queue. 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 async thread.
voidonStreamStateChange virtual inlineCloses the queue on [Error](icy-Error.html#error) or Closed stream state transitions.

dispatch

virtual inline

virtual inline void dispatch(T & packet)

Emits the packet to downstream processors from the async thread.

Parameters

  • packet Packet to dispatch.

onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState &)

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

Parameters

  • state New stream state.

Public Types

NameDescription
Queue
Processor

Queue

AsyncQueue< T > Queue()

Processor

PacketProcessor Processor()