aboutsummaryrefslogtreecommitdiff
path: root/libcmix-common/cmixprotofunctor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-common/cmixprotofunctor.cpp')
-rw-r--r--libcmix-common/cmixprotofunctor.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libcmix-common/cmixprotofunctor.cpp b/libcmix-common/cmixprotofunctor.cpp
new file mode 100644
index 0000000..a026628
--- /dev/null
+++ b/libcmix-common/cmixprotofunctor.cpp
@@ -0,0 +1,16 @@
+#include "cmixprotofunctor.hpp"
+
+#define MESSAGE_SETTER_DEF(TYPE, NAME) \
+ CMixProtoFunctor::proto_type CMixProtoFunctor::operator()(cmix_proto::TYPE const& v) { \
+ proto_type m; \
+ *m.mutable_##NAME() = v; \
+ return m; \
+ } \
+
+MESSAGE_SETTER_DEF(Initialization, initialization)
+MESSAGE_SETTER_DEF(ImANode, imanode)
+MESSAGE_SETTER_DEF(ImAClient, imaclient)
+MESSAGE_SETTER_DEF(Bye, bye)
+MESSAGE_SETTER_DEF(KeyExchange, keyexchange)
+
+#undef MESSAGE_SETTER_DEF \ No newline at end of file