SyncPacketQueue
SyncPacketQueue
#include <icy/packetqueue.h>Inherits:
SyncQueue< IPacket >,PacketProcessor
Synchronized packet queue for event loop integration.
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketSignal | emitter |
emitter
PacketSignal emitterPublic Methods
| Return | Name | Description |
|---|---|---|
SyncPacketQueue inline | #### Parameters | |
SyncPacketQueue inline | Uses the default libuv event loop. | |
void | process virtual inline | 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. |
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. |
SyncPacketQueue
inline
inline SyncPacketQueue(uv::Loop * loop, int maxSize)Parameters
loopEvent loop to synchronize dispatch onto.maxSizeMaximum number of queued packets before oldest are dropped.
SyncPacketQueue
inline
inline SyncPacketQueue(int maxSize)Uses the default libuv event loop.
Parameters
maxSizeMaximum 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
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 event loop thread. |
void | onStreamStateChange virtual inline | Cancels 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
packetPacket 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
stateNew stream state.
Public Types
Queue
SyncQueue< T > Queue()Processor
PacketProcessor Processor()