aboutsummaryrefslogtreecommitdiff
path: root/libcmix-common
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-common')
-rw-r--r--libcmix-common/cmixprotofunctor.hpp35
-rw-r--r--libcmix-common/receiver.hpp11
-rw-r--r--libcmix-common/sender.hpp14
-rw-r--r--libcmix-common/senderreceiver.hpp18
4 files changed, 77 insertions, 1 deletions
diff --git a/libcmix-common/cmixprotofunctor.hpp b/libcmix-common/cmixprotofunctor.hpp
index c15f218..c3f6fe9 100644
--- a/libcmix-common/cmixprotofunctor.hpp
+++ b/libcmix-common/cmixprotofunctor.hpp
@@ -2,17 +2,52 @@
#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_DECL(TYPE)
+ * Generates a message setter declaration for the Protobuf type in TYPE.
+ */
#define MESSAGE_SETTER_DECL(TYPE) \
proto_type operator()(cmix_proto::TYPE const& v)
+ /*!
+ * #MESSAGE_SETTER_DECL(Initialization)
+ */
MESSAGE_SETTER_DECL(Initialization);
+
+ /*!
+ * #MESSAGE_SETTER_DECL(ImANode)
+ */
MESSAGE_SETTER_DECL(ImANode);
+
+ /*!
+ * #MESSAGE_SETTER_DECL(ImAClient)
+ */
MESSAGE_SETTER_DECL(ImAClient);
+
+ /*!
+ * #MESSAGE_SETTER_DECL(Bye)
+ */
MESSAGE_SETTER_DECL(Bye);
+
+ /*!
+ * #MESSAGE_SETTER_DECL(KeyExchange)
+ */
MESSAGE_SETTER_DECL(KeyExchange);
#undef MESSAGE_SETTER
diff --git a/libcmix-common/receiver.hpp b/libcmix-common/receiver.hpp
index a70cde0..2b05790 100644
--- a/libcmix-common/receiver.hpp
+++ b/libcmix-common/receiver.hpp
@@ -4,10 +4,21 @@
#include "protobufclient.hpp"
+/*!
+ * \file
+ */
+
struct SenderReceiver;
+/*!
+ * \brief The Receiver struct is a shim around ProtobufClient and only exposes things needed
+ * for receiving messages.
+ */
struct Receiver : private ProtobufClient<CMixProtoFunctor>
{
+ /*!
+ * \brief friend decleration allowing Receivers to be upgraded to SenderReceivers.
+ */
friend SenderReceiver;
using ProtobufClient::ProtobufClient;
diff --git a/libcmix-common/sender.hpp b/libcmix-common/sender.hpp
index 72f0b3d..ea16a81 100644
--- a/libcmix-common/sender.hpp
+++ b/libcmix-common/sender.hpp
@@ -4,10 +4,24 @@
#include "protobufclient.hpp"
+/*!
+ * \file
+ */
+
+/*!
+ * \brief forward declaration for SenderReceiver to allow for the friend declaration.
+ */
struct SenderReceiver;
+/*!
+ * \brief The Sender struct is a shim around ProtobufClient and only exposes things needed
+ * for sending messages.
+ */
struct Sender : private ProtobufClient<CMixProtoFunctor>
{
+ /*!
+ * The friend declaration that allows for the Sender to be upgraded to a SenderReceiver.
+ */
friend SenderReceiver;
using ProtobufClient::ProtobufClient;
diff --git a/libcmix-common/senderreceiver.hpp b/libcmix-common/senderreceiver.hpp
index 9a07f78..c7fed3a 100644
--- a/libcmix-common/senderreceiver.hpp
+++ b/libcmix-common/senderreceiver.hpp
@@ -6,12 +6,28 @@
#include "protobufclient.hpp"
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The SenderReciever struct is a shim around ProtobufClient and only exposes things needed
+ * for Sending and Receiving messages.
+ */
struct SenderReceiver : private ProtobufClient<CMixProtoFunctor>
{
+ /*!
+ * \brief SenderReceiver Explicit conversion to SenderReceiver
+ * \param r The Receiver to upgrade
+ */
explicit SenderReceiver(Receiver&& r);
+ /*!
+ * \brief SenderReceiver Explicit conversion to SenderReceiver
+ * \param s The Sender to upgrade
+ */
explicit SenderReceiver(Sender&& s);
-
+
using ProtobufClient::ProtobufClient;
using ProtobufClient::async_receive;