fix alignment + refactor
Reviewed-on: #1 Co-authored-by: Persson-dev <sim16.prib@gmail.com> Co-committed-by: Persson-dev <sim16.prib@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -6,22 +6,25 @@
|
||||
namespace sp {
|
||||
class PacketHandler;
|
||||
|
||||
using PacketMessage = Message<option::MsgIdType<std::uint8_t>, // add id() operation
|
||||
option::ReadOperations, // add read() operation
|
||||
option::WriteOperations, // add write() operation
|
||||
option::WriteId, // write id before data
|
||||
option::Handler<PacketHandler> // add dispatch() operation
|
||||
>;
|
||||
using PacketMessage = Message<
|
||||
option::MsgIdType<std::uint8_t>, // add id() operation
|
||||
option::ReadOperations, // add read() operation
|
||||
option::WriteOperations, // add write() operation
|
||||
option::WriteId, // write id before data
|
||||
option::Handler<PacketHandler> // add dispatch() operation
|
||||
>;
|
||||
|
||||
#define PacketConstructor(packetName) \
|
||||
packetName##Packet() {} \
|
||||
template <typename... Args> \
|
||||
packetName##Packet(Args... args) { \
|
||||
Construct(args...); \
|
||||
}
|
||||
|
||||
#define DeclarePacket(packetName) \
|
||||
class packetName##Packet : public sp::MessageBase<sp::PacketMessage, sp::option::StaticNumIdImpl<packetName>, \
|
||||
sp::option::DispatchImpl<packetName##Packet>, sp::option::FieldsImpl<packetName##Fields>> { \
|
||||
public: \
|
||||
packetName##Packet() {} \
|
||||
template <typename... Args> \
|
||||
packetName##Packet(Args... args) { \
|
||||
Construct(args...); \
|
||||
} \
|
||||
}
|
||||
sp::option::DispatchImpl<packetName##Packet>, sp::option::FieldsImpl<packetName##Fields>>
|
||||
|
||||
|
||||
|
||||
} // namespace sp
|
||||
|
||||
Reference in New Issue
Block a user