17class PacketRegistrar {
19 using PacketFactory = std::function<std::unique_ptr<Packet>()>;
22 LLNDAPI
static PacketRegistrar& getInstance();
24 LLAPI
bool registerPacket(std::string_view name, PacketRuntimeId
id, PacketFactory factory);
25 LLAPI
bool registerPacket(std::string_view name, PacketRuntimeId
id, PacketFactory factory, PacketHandler handler);
26 LLAPI
bool registerHandler(std::string_view name, PacketRuntimeId
id, PacketHandler handler);
28 LLNDAPI std::unique_ptr<Packet> createPacket(PacketRuntimeId runtimeId);
29 LLNDAPI PacketHandler getHandler(PacketRuntimeId runtimeId);
32 PacketRegistrar() =
default;
34 ConcurrentDenseMap<PacketRuntimeId, PacketFactory> mPackets;
35 ConcurrentDenseMap<PacketRuntimeId, PacketHandler> mHandlers;