Caller-owned callback that builds a packet from opcode and payload. More...
#include <StormByte/network/typedefs.hxx>
Public Types | |
| using | OpcodeType = Transport::Packet::OpcodeType |
| Wire opcode type. | |
| using | InvokeFunction = PacketPointer (*)(void*, OpcodeType, Buffer::Consumer, StormByte::Safe::Shared<Logger::Log>) |
| Invocation trampoline taking context, opcode, payload, and logger. | |
| using | CloneFunction = void* (*)(const void*) |
| Caller-allocator clone trampoline taking source context storage. | |
| using | DestroyFunction = void (*)(void*) noexcept |
| Caller-allocator destroy trampoline taking context storage. | |
Public Member Functions | |
| DeserializePacketFunction () noexcept=default | |
| Construct an empty callback. | |
| template<typename Callable> requires (!StormByte::Type::SameAs<std::decay_t<Callable>, DeserializePacketFunction> && StormByte::Type::CopyConstructible<std::decay_t<Callable>>) | |
| STORMBYTE_FORCE_INLINE | DeserializePacketFunction (Callable &&callable) |
| Own a caller-allocated callback target. | |
| DeserializePacketFunction (const DeserializePacketFunction &other) | |
| Clone using the caller's target allocator trampoline. | |
| DeserializePacketFunction (DeserializePacketFunction &&other) noexcept | |
| Transfer callback ownership without touching its target. | |
| ~DeserializePacketFunction () noexcept | |
| Destroy through the caller's destruction trampoline. | |
| DeserializePacketFunction & | operator= (const DeserializePacketFunction &other) |
| Clone-assign using the caller's target allocator trampoline. | |
| DeserializePacketFunction & | operator= (DeserializePacketFunction &&other) noexcept |
| Transfer-assign callback ownership. | |
| PacketPointer | operator() (OpcodeType opcode, Buffer::Consumer payload, StormByte::Safe::Shared< Logger::Log > logger) const |
| Invoke the packet decoder. | |
| operator bool () const noexcept | |
| Test whether a callable target is present. | |
Caller-owned callback that builds a packet from opcode and payload.
The context is allocated, cloned, invoked, and destroyed by function pointers instantiated in the caller's translation unit. The Network DLL stores only the context pointer and those trampolines; it never allocates or frees the callback target across the CRT boundary.
| using StormByte::Network::DeserializePacketFunction::CloneFunction = void* (*)(const void*) |
Caller-allocator clone trampoline taking source context storage.
| using StormByte::Network::DeserializePacketFunction::DestroyFunction = void (*)(void*) noexcept |
Caller-allocator destroy trampoline taking context storage.
| using StormByte::Network::DeserializePacketFunction::InvokeFunction = PacketPointer (*)(void*, OpcodeType, Buffer::Consumer, StormByte::Safe::Shared<Logger::Log>) |
Invocation trampoline taking context, opcode, payload, and logger.
Wire opcode type.
|
defaultnoexcept |
Construct an empty callback.
|
inline |
Own a caller-allocated callback target.
| Callable | Copy-constructible callback type. |
| callable | Callback taking opcode, payload Consumer, and Shared logger. |
| StormByte::Network::DeserializePacketFunction::DeserializePacketFunction | ( | const DeserializePacketFunction & | other | ) |
Clone using the caller's target allocator trampoline.
| other | Source callback. |
|
noexcept |
Transfer callback ownership without touching its target.
| other | Source callback. |
|
noexcept |
Destroy through the caller's destruction trampoline.
|
inlineexplicitnoexcept |
Test whether a callable target is present.
| PacketPointer StormByte::Network::DeserializePacketFunction::operator() | ( | OpcodeType | opcode, |
| Buffer::Consumer | payload, | ||
| StormByte::Safe::Shared< Logger::Log > | logger ) const |
Invoke the packet decoder.
| opcode | Packet opcode. |
| payload | Payload consumer. |
| logger | Shared diagnostic logger. |
| DeserializePacketFunction & StormByte::Network::DeserializePacketFunction::operator= | ( | const DeserializePacketFunction & | other | ) |
Clone-assign using the caller's target allocator trampoline.
| other | Source callback. |
|
noexcept |
Transfer-assign callback ownership.
| other | Source callback. |