Base module

PacketCreationStrategy

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

#include <icy/packetfactory.h>

template<class PacketT>
struct PacketCreationStrategy

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

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

ParameterTypeDescription
priorityintDispatch priority in the range 0–100.

Exceptions

ExceptionDescription
std::logic_errorif 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.

Returns

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

Reimplements

Parameters

ParameterTypeDescription
bufferconst ConstBuffer &Raw input data.
nreadsize_t &Set to the number of bytes consumed when read() succeeds.

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