#pragma once #include "cmix.pb.h" /*! * \file */ /*! * \brief The CMixProtoFunctor struct Is a functor that enables the ProtobufClient to serialize * all the types you specify below. */ struct CMixProtoFunctor { /*! * \brief proto_type Typedef that exposes the cmix proto container message. */ typedef cmix_proto::CMixMessage proto_type; /*! * \def MESSAGE_SETTER_DEF(TYPE, NAME) * Generates a message setter definition for the Protobuf type in TYPE with member name NAME. */ #define MESSAGE_SETTER_DEF(TYPE, NAME) \ proto_type operator()(cmix_proto::TYPE const& v) { \ proto_type m; \ *m.mutable_##NAME() = v; \ return m; \ } \ /*! * #MESSAGE_SETTER_DECL(Initialization, initialization) */ MESSAGE_SETTER_DEF(Initialization, initialization) /*! * #MESSAGE_SETTER_DECL(ImANode, imanode) */ MESSAGE_SETTER_DEF(ImANode, imanode) /*! * #MESSAGE_SETTER_DECL(ImAClient, imaclient) */ MESSAGE_SETTER_DEF(ImAClient, imaclient) /*! * #MESSAGE_SETTER_DECL(Bye, bye) */ MESSAGE_SETTER_DEF(Bye, bye) /*! * #MESSAGE_SETTER_DECL(KeyExchange, keyexchange) */ MESSAGE_SETTER_DEF(KeyExchange, keyexchange) /*! * #MESSAGE_SETTER_DECL(SecretKey, secretkey) */ MESSAGE_SETTER_DEF(SecretKey, secretkey) /*! * #MESSAGE_SETTER_DECL(NodeReady, nodeready) */ MESSAGE_SETTER_DEF(NodeReady, nodeready) /*! * #MESSAGE_SETTER_DECL(PrePre, prepre) */ MESSAGE_SETTER_DEF(PrePre, prepre); #undef MESSAGE_SETTER_DEF };