VLCB SDK
An opinionated SDK for VLCB protocol
Loading...
Searching...
No Matches
serialization.h
Go to the documentation of this file.
1#pragma once
2
3#define _DEFINE_PACKET_EXPAND(x) x
4#define _DEFINE_PACKET_CONCAT3(a, b, c) a##b##c
5#define _DEFINE_PACKET_CONCAT4(a, b, c, d) a##b##c##d
6
7#define _DEFINE_PACKET_NAME(sock, name) \
8 _DEFINE_PACKET_CONCAT3(VlcbNet, sock, name)
9
10#define _DEFINE_PACKET_METHOD(ns, name, suffix) \
11 _DEFINE_PACKET_CONCAT4(ns, _, name, suffix)
12
13#define DEFINE_PACKET_DATA(ns, sock, pktT, name, ...) \
14 typedef struct { \
15 __VA_ARGS__ \
16 } _DEFINE_PACKET_NAME(sock, name); \
17 void _DEFINE_PACKET_METHOD(ns, name, _Serialize)( \
18 pktT *const packet, _DEFINE_PACKET_NAME(sock, name) data); \
19 _DEFINE_PACKET_NAME(sock, name) \
20 _DEFINE_PACKET_METHOD(ns, name, _Deserialize)(const pktT *const packet);
21
22#define DEFINE_PACKET_WO_DATA(ns, sock, pktT, name) \
23 inline void _DEFINE_PACKET_METHOD(ns, name, _Serialize)(pktT *const packet);