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. | |
| using | CloneFunction = void *(*)(const void *) |
| Caller-allocator clone trampoline. | |
| using | DestroyFunction = void(*)(void *) noexcept |
| Caller-allocator destroy trampoline. | |
Public Member Functions | |
| DeserializePacketFunction () noexcept=default | |
| Empty callback. | |
| template<typename Callable > requires (!StormByte::Type::SameAs<std::decay_t<Callable>, DeserializePacketFunction> && StormByte::Type::CopyConstructible<std::decay_t<Callable>>) | |
| 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 | |
| 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.
| using StormByte::Network::DeserializePacketFunction::DestroyFunction = void (*)(void*) noexcept |
Caller-allocator destroy trampoline.
| using StormByte::Network::DeserializePacketFunction::InvokeFunction = PacketPointer (*)(void*, OpcodeType, Buffer::Consumer, StormByte::Safe::Shared<Logger::Log>) |
Invocation trampoline.
Wire opcode type.
|
defaultnoexcept |
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 |
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. |