better example
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace sp {
|
||||
|
||||
using PeerID = std::uint16_t;
|
||||
|
||||
} // namespace sp
|
||||
16
include/sp/default/DefaultPacket.h
Normal file
16
include/sp/default/DefaultPacket.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <sp/protocol/Message.h>
|
||||
#include <sp/protocol/GenericHandler.h>
|
||||
|
||||
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::Handler<PacketHandler> // add dispatch() operation
|
||||
>;
|
||||
|
||||
} // namespace sp
|
||||
9
include/sp/default/DefaultPacketHandler.h
Normal file
9
include/sp/default/DefaultPacketHandler.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <sp/protocol/GenericHandler.h>
|
||||
|
||||
// the tuple AllPackets must be defined !
|
||||
|
||||
namespace sp {
|
||||
class PacketHandler : public sp::GenericHandler<PacketMessage, AllPackets> {};
|
||||
} // namespace sp
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <sp/MessageInterfaceBuilder.h>
|
||||
#include <sp/protocol/MessageInterfaceBuilder.h>
|
||||
|
||||
namespace sp {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <sp/Message.h>
|
||||
#include <sp/Templates.h>
|
||||
#include <sp/protocol/Message.h>
|
||||
#include <sp/protocol/Templates.h>
|
||||
|
||||
namespace sp {
|
||||
namespace option {
|
||||
@@ -261,7 +261,7 @@ struct MessageImplBuilder {
|
||||
using Base5 = typename MessageImplProcessWriteFields<Base4, HasWriteImpl>::Type;
|
||||
|
||||
// Provide ValidImpl() if possible
|
||||
static const bool HasValidImpl = InterfaceOptions::HasWriteOperations && ImplOptions::HasFieldsImpl;
|
||||
static const bool HasValidImpl = InterfaceOptions::HasValid && ImplOptions::HasFieldsImpl;
|
||||
using Base6 = typename MessageImplProcessValidFields<Base5, HasValidImpl>::Type;
|
||||
|
||||
// The last BaseN must be taken as final type.
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <sp/MessageInterfaces.h>
|
||||
#include <sp/protocol/MessageInterfaces.h>
|
||||
|
||||
namespace sp {
|
||||
namespace option {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <sp/Options.h>
|
||||
#include <sp/protocol/Options.h>
|
||||
|
||||
namespace sp {
|
||||
namespace option {
|
||||
Reference in New Issue
Block a user