aboutsummaryrefslogtreecommitdiff
path: root/include/salticidae/msg.h
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2018-07-21 17:23:35 -0400
committerDeterminant <tederminant@gmail.com>2018-07-21 17:23:35 -0400
commit10b23b5b90197566c187c89a64ebfefa31115783 (patch)
tree397e15b166b4032a322e3ea71e5347d4a0f77d96 /include/salticidae/msg.h
parent0465243c710ede74a78885077140d8673efbc647 (diff)
...
Diffstat (limited to 'include/salticidae/msg.h')
-rw-r--r--include/salticidae/msg.h9
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),