AsyncPacketQueue
AsyncPacketQueue
#include <icy/packetqueue.h>Inherits:
AsyncQueue< IPacket >,PacketProcessor
Thread-based asynchronous packet dispatch queue.
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketSignal | emitter |
emitter
PacketSignal emitterPublic Methods
| Return | Name | Description |
|---|---|---|
AsyncPacketQueue inline | #### Parameters | |
void | close virtual inline | Flushes remaining packets, cancels the queue, and joins the dispatch thread. |
void | process virtual inline | 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. |
bool | accepts virtual inline | Returns true if the packet can be cast to type T. |
PacketRetention | retention virtual const inline | 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. |
AsyncPacketQueue
inline
inline AsyncPacketQueue(int maxSize)Parameters
maxSizeMaximum 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
packetIncoming packet to enqueue.
accepts
virtual inline
virtual inline bool accepts(IPacket * packet)Returns true if the packet can be cast to type T.
Parameters
packetPacket to test.
Returns
True if dynamic_cast<T*>(packet) succeeds.
retention
virtual const inline
virtual inline PacketRetention retention() 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.
Protected Methods
| Return | Name | Description |
|---|---|---|
void | dispatch virtual inline | Emits the packet to downstream processors from the async thread. |
void | onStreamStateChange virtual inline | Closes 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
packetPacket 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
stateNew stream state.
Public Types
Queue
AsyncQueue< T > Queue()Processor
PacketProcessor Processor()