Home
Base module

PacketCreationStrategy

This template class implements an adapter that sits between an SignalBase and an object receiving notifications from it.

PacketCreationStrategy

#include <icy/packetfactory.h>
template<class PacketT>
struct PacketCreationStrategy

Defined in src/base/include/icy/packetfactory.h:55

Inherits: IPacketCreationStrategy

This template class implements an adapter that sits between an SignalBase and an object receiving notifications from it.

List of all members

NameKindOwner
PacketCreationStrategyfunctionDeclared here
createfunctionDeclared here
priorityfunctionDeclared here
_priorityvariableDeclared here
IPacketCreationStrategyfunctionInherited from IPacketCreationStrategy
~IPacketCreationStrategyfunctionInherited from IPacketCreationStrategy
createfunctionInherited from IPacketCreationStrategy
priorityfunctionInherited from IPacketCreationStrategy

Inherited from IPacketCreationStrategy

KindNameDescription
functionIPacketCreationStrategyDefaulted constructor.
function~IPacketCreationStrategy virtualDefaulted destructor.
functioncreate virtual constAttempts to create a typed packet from the given buffer.
functionpriority virtual constReturns the dispatch priority of this strategy (0–100; higher runs first).

Public Methods

ReturnNameDescription
PacketCreationStrategy inline
IPacket *create virtual const inline overrideAttempts to default-construct a PacketT, calling its read() method.
intpriority virtual const inline override

PacketCreationStrategy

inline

inline PacketCreationStrategy(int priority = 0)

Defined in src/base/include/icy/packetfactory.h:59

Parameters

  • priority Dispatch priority in the range 0–100.

Exceptions

  • std::logic_error if priority exceeds 100.

create

virtual const inline override

virtual inline IPacket * create(const ConstBuffer & buffer, size_t & nread) const override

Defined in src/base/include/icy/packetfactory.h:70

Attempts to default-construct a PacketT, calling its read() method.

Parameters

  • buffer Raw input data.

  • nread Set to the number of bytes consumed when read() succeeds.

Returns

Newly allocated PacketT on success, nullptr if read() returns 0.

Reimplements

priority

virtual const inline override

virtual inline int priority() const override

Defined in src/base/include/icy/packetfactory.h:79

Returns

The priority value assigned at construction.

Reimplements

Protected Attributes

ReturnNameDescription
int_priority

_priority

int _priority

Defined in src/base/include/icy/packetfactory.h:85