|
mal-packet-weaver
C++20 packet serialization/deserialization library.
|
#include <boost/preprocessor.hpp>#include <boost/preprocessor/seq.hpp>#include <boost/preprocessor/seq/for_each.hpp>Go to the source code of this file.
Macros | |
| #define | MAL_PACKET_WEAVER_DECLARE_PACKET(PacketName, Subsystem, ID, TTL) |
| Macro to declare an empty packet class with specific parameters. | |
| #define | MAL_PACKET_WEAVER_DECLARE_PAYLOAD_MEMBER(r, _, elem) BOOST_PP_TUPLE_ELEM(0, elem) BOOST_PP_TUPLE_ELEM(1, elem); |
| Internal macro to declare payload members. | |
| #define | MAL_PACKET_WEAVER_DECLARE_PAYLOAD_MEMBERS(seq) BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_DECLARE_PAYLOAD_MEMBER, _, seq) |
| Macro to declare payload members using a Boost.PP sequence. | |
| #define | MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_INHERITANCE(r, _, elem) |
| Internal macro to declare inheritance for multiple base classes. | |
| #define | MAL_PACKET_WEAVER_DECLARE_BASE_CLASSES_INHERITANCE(seq) BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_INHERITANCE, _, seq) |
| Macro to declare inheritance for multiple base classes. | |
| #define | MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_SERIALIZATION(r, _, elem) ar(CEREAL_NVP(cereal::base_class<elem>(this))); |
| Internal macro to declare serialization for multiple base classes. | |
| #define | MAL_PACKET_WEAVER_DECLARE_BASE_CLASSES_SERIALIZATION(seq) BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_SERIALIZATION, _, seq) |
| Macro to declare serialization for multiple base classes. | |
| #define | MAL_PACKET_WEAVER_SERIALIZE_MEMBER(r, ar, elem) ar(CEREAL_NVP(BOOST_PP_TUPLE_ELEM(1, elem))); |
| Internal macro to serialize payload members. | |
| #define | MAL_PACKET_WEAVER_SERIALIZE_MEMBERS(ar, seq) BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_SERIALIZE_MEMBER, ar, seq) |
| Macro to serialize payload members using a Boost.PP sequence. | |
| #define | MAL_PACKET_WEAVER_VA_ARGS_COUNT(...) |
| Macro to count the number of variadic arguments (up to 62 arguments). | |
| #define | MAL_PACKET_WEAVER_VA_ARGS_COUNT_IMPL( _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N, ...) N |
| Internal macro to implement counting of variadic arguments. | |
| #define | MAL_PACKET_WEAVER_NON_EMPTY_SIZE(...) MAL_PACKET_WEAVER_VA_ARGS_COUNT(__VA_ARGS__) |
| Macro to determine the number of non-empty variadic arguments. | |
| #define | MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITH_PAYLOAD(PacketName, Subsystem, ID, TTL, PACKET_BODY, ...) |
| #define | MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITHOUT_PAYLOAD(PacketName, Subsystem, ID, TTL, PACKET_BODY) |
| #define | MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_PAYLOAD(PacketName, Subsystem, ID, TTL, ...) MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITH_PAYLOAD(PacketName, Subsystem, ID, TTL, /* nothing */, __VA_ARGS__) |
| Macro to declare an empty request packet and a response packet with payload. | |
| #define | MAL_PACKET_WEAVER_DECLARE_PACKET_WITHOUT_PAYLOAD(PacketName, Subsystem, ID, TTL) MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITHOUT_PAYLOAD(PacketName, Subsystem, ID, TTL, /* nothing */) |
| Macro to declare an empty request packet and an empty response packet. | |
| #define | MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITH_BODY_WITHOUT_PAYLOAD(PacketName, BasePackets, Subsystem, ID, TTL, PACKET_BODY) |
| Macro to declare a derived packet class without payload but with a provided body and specific parameters. | |
| #define | MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITH_BODY_WITH_PAYLOAD(PacketName, BasePackets, Subsystem, ID, TTL, PACKET_BODY, ...) |
| Macro to declare a derived packet class without payload but with a provided body. | |
| #define | MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITH_PAYLOAD(PacketName, BasePackets, Subsystem, ID, TTL, ...) |
| Macro to declare a derived packet class with additional payload. | |
| #define | MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITHOUT_PAYLOAD(PacketName, BasePackets, Subsystem, ID, TTL) |
| Macro to declare a derived packet class without payload but with a provided body. | |
| #define | MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_RESPONSE_WITH_PAYLOAD(PacketName, Subsystem, ID1, ID2, TTL1, TTL2, ...) |
| Macro to declare an empty request packet and a response packet with specific parameters and payload. | |
| #define | MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_RESPONSE_WITHOUT_PAYLOAD(PacketName, Subsystem, ID1, ID2, TTL1, TTL2, ...) |
| Macro to declare an empty request packet and a response packet with specific parameters but without payload. | |
| #define | MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_DERIVED_RESPONSE_WITH_PAYLOAD(PacketName, BasePackets, Subsystem, ID1, ID2, TTL1, TTL2, ...) |
| Macro to declare a derived packet class without payload but with a provided body and specific parameters. | |
| #define | MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_DERIVED_RESPONSE_WITHOUT_PAYLOAD(PacketName, BasePackets, Subsystem, ID1, ID2, TTL1, TTL2, ...) |
| Macro to declare an empty request packet and a derived response packet without payload, with specific parameters. | |
| #define MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_INHERITANCE | ( | r, | |
| _, | |||
| elem ) |
Internal macro to declare inheritance for multiple base classes.
Definition at line 48 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_SERIALIZATION | ( | r, | |
| _, | |||
| elem ) ar(CEREAL_NVP(cereal::base_class<elem>(this))); |
Internal macro to declare serialization for multiple base classes.
Definition at line 63 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_BASE_CLASSES_INHERITANCE | ( | seq | ) | BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_INHERITANCE, _, seq) |
Macro to declare inheritance for multiple base classes.
Definition at line 56 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_BASE_CLASSES_SERIALIZATION | ( | seq | ) | BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_DECLARE_BASE_CLASS_SERIALIZATION, _, seq) |
Macro to declare serialization for multiple base classes.
Definition at line 70 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITH_BODY_WITH_PAYLOAD | ( | PacketName, | |
| BasePackets, | |||
| Subsystem, | |||
| ID, | |||
| TTL, | |||
| PACKET_BODY, | |||
| ... ) |
Macro to declare a derived packet class without payload but with a provided body.
| PacketName | The name of the packet class. |
| BasePackets | The tuple of base classes. |
| Subsystem | The subsystem identifier. |
| ID | The packet identifier. |
| TTL | The time-to-live value. |
| PACKET_BODY | The body of the packet(function declarations, private/public members, non-serializable once, etc.) |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 244 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITH_BODY_WITHOUT_PAYLOAD | ( | PacketName, | |
| BasePackets, | |||
| Subsystem, | |||
| ID, | |||
| TTL, | |||
| PACKET_BODY ) |
Macro to declare a derived packet class without payload but with a provided body and specific parameters.
| PacketName | The name of the packet class. |
| BasePackets | The base classes declared as tuple (BaseClass, BaseClass2, ...). |
| Subsystem | The subsystem identifier. |
| ID | The packet identifier. |
| TTL | The time-to-live value. |
| PACKET_BODY | The body of the packet(function declarations, private/public members, non-serializable once, etc.) |
Definition at line 208 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITH_PAYLOAD | ( | PacketName, | |
| BasePackets, | |||
| Subsystem, | |||
| ID, | |||
| TTL, | |||
| ... ) |
Macro to declare a derived packet class with additional payload.
| PacketName | The name of the packet class. |
| BasePackets | The base classes declared as tuple (BaseClass, BaseClass2, ...). |
| Subsystem | The subsystem identifier. |
| ID | The packet identifier. |
| TTL | The time-to-live value. |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 280 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_DERIVED_PACKET_WITHOUT_PAYLOAD | ( | PacketName, | |
| BasePackets, | |||
| Subsystem, | |||
| ID, | |||
| TTL ) |
Macro to declare a derived packet class without payload but with a provided body.
| PacketName | The name of the packet class. |
| BasePackets | The base classes declared as tuple (BaseClass, BaseClass2, ...). |
| Subsystem | The subsystem identifier. |
| ID | The packet identifier. |
| TTL | The time-to-live value. |
Definition at line 293 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_DERIVED_RESPONSE_WITH_PAYLOAD | ( | PacketName, | |
| BasePackets, | |||
| Subsystem, | |||
| ID1, | |||
| ID2, | |||
| TTL1, | |||
| TTL2, | |||
| ... ) |
Macro to declare a derived packet class without payload but with a provided body and specific parameters.
| PacketName | The name of the packet class. |
| BasePackets | The base classes declared as tuple (BaseClass, BaseClass2, ...). |
| Subsystem | The subsystem identifier. |
| ID | The packet identifier. |
| TTL | The time-to-live value. |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 345 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_DERIVED_RESPONSE_WITHOUT_PAYLOAD | ( | PacketName, | |
| BasePackets, | |||
| Subsystem, | |||
| ID1, | |||
| ID2, | |||
| TTL1, | |||
| TTL2, | |||
| ... ) |
Macro to declare an empty request packet and a derived response packet without payload, with specific parameters.
| PacketName | The base name for the request and response packets. |
| BasePackets | The base classes declared as tuple (BaseClass, BaseClass2, ...). |
| ID1 | The packet identifier for the request. |
| ID2 | The packet identifier for the response. |
| TTL1 | The time-to-live value for the request. |
| TTL2 | The time-to-live value for the response. |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 364 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_RESPONSE_WITH_PAYLOAD | ( | PacketName, | |
| Subsystem, | |||
| ID1, | |||
| ID2, | |||
| TTL1, | |||
| TTL2, | |||
| ... ) |
Macro to declare an empty request packet and a response packet with specific parameters and payload.
| PacketName | The name of the packet class. |
| Subsystem | The subsystem identifier. |
| ID1 | The packet identifier for the request. |
| ID2 | The packet identifier for the response. |
| TTL1 | The time-to-live value for the request. |
| TTL2 | The time-to-live value for the response. |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 310 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_EMPTY_REQUEST_AND_RESPONSE_WITHOUT_PAYLOAD | ( | PacketName, | |
| Subsystem, | |||
| ID1, | |||
| ID2, | |||
| TTL1, | |||
| TTL2, | |||
| ... ) |
Macro to declare an empty request packet and a response packet with specific parameters but without payload.
| PacketName | The base name for the request and response packets. |
| Subsystem | The subsystem identifier. |
| ID1 | The packet identifier for the request. |
| ID2 | The packet identifier for the response. |
| TTL1 | The time-to-live value for the request. |
| TTL2 | The time-to-live value for the response. |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 328 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PACKET | ( | PacketName, | |
| Subsystem, | |||
| ID, | |||
| TTL ) |
Macro to declare an empty packet class with specific parameters.
| PacketName | The name of the packet class. |
| Subsystem | The subsystem identifier. |
| ID | The packet identifier. |
| TTL | The time-to-live value. |
Definition at line 18 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITH_PAYLOAD | ( | PacketName, | |
| Subsystem, | |||
| ID, | |||
| TTL, | |||
| PACKET_BODY, | |||
| ... ) |
Definition at line 121 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITHOUT_PAYLOAD | ( | PacketName, | |
| Subsystem, | |||
| ID, | |||
| TTL, | |||
| PACKET_BODY ) |
Definition at line 154 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_PAYLOAD | ( | PacketName, | |
| Subsystem, | |||
| ID, | |||
| TTL, | |||
| ... ) MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITH_PAYLOAD(PacketName, Subsystem, ID, TTL, /* nothing */, __VA_ARGS__) |
Macro to declare an empty request packet and a response packet with payload.
| PacketName | The base name for the request and response packets. |
| Subsystem | The subsystem identifier. |
| ID1 | The packet identifier for the request. |
| ID2 | The packet identifier for the response. |
| TTL1 | The time-to-live value for the request. |
| TTL2 | The time-to-live value for the response. |
| ... | Payload members for the response packet. They should be defined as tuples, like this: (int, value), (typename, valuename) |
Definition at line 181 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PACKET_WITHOUT_PAYLOAD | ( | PacketName, | |
| Subsystem, | |||
| ID, | |||
| TTL ) MAL_PACKET_WEAVER_DECLARE_PACKET_WITH_BODY_WITHOUT_PAYLOAD(PacketName, Subsystem, ID, TTL, /* nothing */) |
Macro to declare an empty request packet and an empty response packet.
| PacketName | The base name for the request and response packets. |
| Subsystem | The subsystem identifier. |
| ID1 | The packet identifier for the request. |
| ID2 | The packet identifier for the response. |
| TTL1 | The time-to-live value for the request. |
| TTL2 | The time-to-live value for the response. |
Definition at line 194 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PAYLOAD_MEMBER | ( | r, | |
| _, | |||
| elem ) BOOST_PP_TUPLE_ELEM(0, elem) BOOST_PP_TUPLE_ELEM(1, elem); |
Internal macro to declare payload members.
Definition at line 35 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_DECLARE_PAYLOAD_MEMBERS | ( | seq | ) | BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_DECLARE_PAYLOAD_MEMBER, _, seq) |
Macro to declare payload members using a Boost.PP sequence.
Definition at line 41 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_NON_EMPTY_SIZE | ( | ... | ) | MAL_PACKET_WEAVER_VA_ARGS_COUNT(__VA_ARGS__) |
Macro to determine the number of non-empty variadic arguments.
Definition at line 109 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_SERIALIZE_MEMBER | ( | r, | |
| ar, | |||
| elem ) ar(CEREAL_NVP(BOOST_PP_TUPLE_ELEM(1, elem))); |
Internal macro to serialize payload members.
Definition at line 77 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_SERIALIZE_MEMBERS | ( | ar, | |
| seq ) BOOST_PP_SEQ_FOR_EACH(MAL_PACKET_WEAVER_SERIALIZE_MEMBER, ar, seq) |
Macro to serialize payload members using a Boost.PP sequence.
Definition at line 83 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_VA_ARGS_COUNT | ( | ... | ) |
Macro to count the number of variadic arguments (up to 62 arguments).
Definition at line 89 of file packet-macro.hpp.
| #define MAL_PACKET_WEAVER_VA_ARGS_COUNT_IMPL | ( | _1, | |
| _2, | |||
| _3, | |||
| _4, | |||
| _5, | |||
| _6, | |||
| _7, | |||
| _8, | |||
| _9, | |||
| _10, | |||
| _11, | |||
| _12, | |||
| _13, | |||
| _14, | |||
| _15, | |||
| _16, | |||
| _17, | |||
| _18, | |||
| _19, | |||
| _20, | |||
| _21, | |||
| _22, | |||
| _23, | |||
| _24, | |||
| _25, | |||
| _26, | |||
| _27, | |||
| _28, | |||
| _29, | |||
| _30, | |||
| _31, | |||
| _32, | |||
| _33, | |||
| _34, | |||
| _35, | |||
| _36, | |||
| _37, | |||
| _38, | |||
| _39, | |||
| _40, | |||
| _41, | |||
| _42, | |||
| _43, | |||
| _44, | |||
| _45, | |||
| _46, | |||
| _47, | |||
| _48, | |||
| _49, | |||
| _50, | |||
| _51, | |||
| _52, | |||
| _53, | |||
| _54, | |||
| _55, | |||
| _56, | |||
| _57, | |||
| _58, | |||
| _59, | |||
| _60, | |||
| _61, | |||
| _62, | |||
| _63, | |||
| N, | |||
| ... ) N |
Internal macro to implement counting of variadic arguments.
Definition at line 99 of file packet-macro.hpp.