aboutsummaryrefslogtreecommitdiff
path: root/libcmix-common/receiver.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-common/receiver.hpp')
-rw-r--r--libcmix-common/receiver.hpp58
1 files changed, 23 insertions, 35 deletions
diff --git a/libcmix-common/receiver.hpp b/libcmix-common/receiver.hpp
index efd3753..ddb2826 100644
--- a/libcmix-common/receiver.hpp
+++ b/libcmix-common/receiver.hpp
@@ -7,56 +7,44 @@
/*!
* \file
*/
-struct SenderReceiver;
/*!
- * \brief The Receiver struct is a shim around ProtobufClient and only exposes things needed
- * for receiving messages.
+ * \brief BaseReceiver
*/
-struct Receiver : private ProtobufClient<CMixProtoFunctor>
+template<template <typename T> class C, typename F>
+struct BaseReceiver : private C<CMixProtoFunctor>
{
/*!
* \brief friend decleration allowing Receivers to be upgraded to SenderReceivers.
*/
- friend SenderReceiver;
+ friend F;
- using ProtobufClient::ProtobufClient;
- using ProtobufClient::operator=;
+ using C<CMixProtoFunctor>::C;
+ using C<CMixProtoFunctor>::operator=;
- using ProtobufClient::async_receive;
+ using C<CMixProtoFunctor>::async_receive;
- using ProtobufClient::async_connect;
+ using C<CMixProtoFunctor>::async_connect;
- using ProtobufClient::close;
+ using C<CMixProtoFunctor>::close;
- using ProtobufClient::on_done;
+ using C<CMixProtoFunctor>::on_done;
- using ProtobufClient::is_open;
+ using C<CMixProtoFunctor>::is_open;
};
-struct SSLSenderReceiver;
+/*!
+ * \brief Forward decleration the ability to convert Receivers to SenderReceivers.
+ */
+template <template <typename T> class C>
+struct BaseSenderReceiver;
/*!
- * \brief The Receiver struct is a shim around ProtobufClient and only exposes things needed
- * for receiving messages.
+ * \brief Conveniance typedef for Receiver.
*/
-struct SSLReceiver : private SSLProtobufClient<CMixProtoFunctor>
-{
- /*!
- * \brief friend decleration allowing Receivers to be upgraded to SenderReceivers.
- */
- friend SSLSenderReceiver;
-
- using SSLProtobufClient::SSLProtobufClient;
- using SSLProtobufClient::operator=;
-
- using SSLProtobufClient::async_receive;
-
- using SSLProtobufClient::async_connect;
-
- using SSLProtobufClient::close;
-
- using SSLProtobufClient::on_done;
-
- using SSLProtobufClient::is_open;
-};
+using Receiver = BaseReceiver<ProtobufClient, BaseSenderReceiver<ProtobufClient>>;
+
+/*!
+ * \brief Conveniance typedef for SSLReceiver.
+ */
+using SSLReceiver = BaseReceiver<SSLProtobufClient, BaseSenderReceiver<SSLProtobufClient>>; \ No newline at end of file