add write id
This commit is contained in:
@@ -14,6 +14,7 @@ struct MessageInterfaceParsedOptions<> {
|
||||
static const bool HasLittleEndian = false;
|
||||
static const bool HasReadOperations = false;
|
||||
static const bool HasWriteOperations = false;
|
||||
static const bool HasWriteId = false;
|
||||
static const bool HasHandler = false;
|
||||
static const bool HasValid = false;
|
||||
};
|
||||
@@ -43,6 +44,11 @@ struct MessageInterfaceParsedOptions<option::WriteOperations, TOptions...> : pub
|
||||
static const bool HasWriteOperations = true;
|
||||
};
|
||||
|
||||
template <typename... TOptions>
|
||||
struct MessageInterfaceParsedOptions<option::WriteId, TOptions...> : public MessageInterfaceParsedOptions<TOptions...> {
|
||||
static const bool HasWriteId = true;
|
||||
};
|
||||
|
||||
template <typename T, typename... TOptions>
|
||||
struct MessageInterfaceParsedOptions<option::Handler<T>, TOptions...> : public MessageInterfaceParsedOptions<TOptions...> {
|
||||
static const bool HasHandler = true;
|
||||
@@ -118,7 +124,7 @@ template <typename TBase>
|
||||
class MessageInterfaceWriteBase : public TBase {
|
||||
public:
|
||||
void Write(DataBuffer& buffer) {
|
||||
return WriteImpl(buffer);
|
||||
WriteImpl(buffer);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -151,7 +157,15 @@ class MessageInterfaceValidityBase : public TBase {
|
||||
virtual bool ValidImpl() const = 0;
|
||||
};
|
||||
|
||||
|
||||
// Writing id functionality chunk
|
||||
template <typename TBase>
|
||||
class MessageInterfaceWriteIdBase : public TBase {
|
||||
public:
|
||||
void Write(DataBuffer& buffer) {
|
||||
this->WriteData(this->GetId(), buffer);
|
||||
this->WriteImpl(buffer);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -239,5 +253,19 @@ template <typename TBase>
|
||||
struct MessageInterfaceProcessValid<TBase, false> {
|
||||
using Type = TBase;
|
||||
};
|
||||
|
||||
// Build id writing
|
||||
template <typename TBase, bool THasValid>
|
||||
struct MessageInterfaceProcessWriteId;
|
||||
|
||||
template <typename TBase>
|
||||
struct MessageInterfaceProcessWriteId<TBase, true> {
|
||||
using Type = MessageInterfaceWriteIdBase<TBase>;
|
||||
};
|
||||
|
||||
template <typename TBase>
|
||||
struct MessageInterfaceProcessWriteId<TBase, false> {
|
||||
using Type = TBase;
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace sp
|
||||
|
||||
Reference in New Issue
Block a user