diff options
Diffstat (limited to 'include/salticidae/msg.h')
-rw-r--r-- | include/salticidae/msg.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/salticidae/msg.h b/include/salticidae/msg.h index 8a63a50..3a1eebf 100644 --- a/include/salticidae/msg.h +++ b/include/salticidae/msg.h @@ -56,6 +56,15 @@ class MsgBase { public: MsgBase(): magic(0x0), no_payload(true) {} + template<typename MsgType, + typename = typename std::enable_if< + !std::is_same<MsgType, MsgBase>::value && + !std::is_same<MsgType, uint8_t *>::value>::type> + MsgBase(const MsgType &msg): magic(0x0) { + set_opcode(MsgType::opcode); + set_payload(std::move(msg.serialized)); + } + MsgBase(const MsgBase &other): magic(other.magic), opcode(other.opcode), |