diff options
Diffstat (limited to 'libcmix-common/sender.hpp')
| -rw-r--r-- | libcmix-common/sender.hpp | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/libcmix-common/sender.hpp b/libcmix-common/sender.hpp index c722e30..d1baabe 100644 --- a/libcmix-common/sender.hpp +++ b/libcmix-common/sender.hpp @@ -9,61 +9,43 @@ */ /*! - * \brief forward declaration for SenderReceiver to allow for the friend declaration. + * \brief BaseSender */ -struct SenderReceiver; - -/*! - * \brief The Sender struct is a shim around ProtobufClient and only exposes things needed - * for sending messages. - */ -struct Sender : private ProtobufClient<CMixProtoFunctor> +template<template <typename T> class C, typename F> +struct BaseSender : private C<CMixProtoFunctor> { /*! * The friend declaration that allows for the Sender to be upgraded to a SenderReceiver. */ - friend SenderReceiver; + friend F; - using ProtobufClient::ProtobufClient; - using ProtobufClient::operator=; + using C<CMixProtoFunctor>::C; + using C<CMixProtoFunctor>::operator=; - using ProtobufClient::async_send; + using C<CMixProtoFunctor>::async_send; - 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; }; /*! - * \brief forward declaration for SenderReceiver to allow for the friend declaration. + * \brief forward declaration for BaseSenderReceiver to allow for the friend declaration. */ -struct SSLSenderReceiver; +template <template <typename T> class C> +struct BaseSenderReceiver; /*! - * \brief The Sender struct is a shim around ProtobufClient and only exposes things needed - * for sending messages. + * \brief Conveniance typedef for Sender */ -struct SSLSender : private SSLProtobufClient<CMixProtoFunctor> -{ - /*! - * The friend declaration that allows for the Sender to be upgraded to a SenderReceiver. - */ - friend SSLSenderReceiver; - - using SSLProtobufClient::SSLProtobufClient; - using SSLProtobufClient::operator=; - - using SSLProtobufClient::async_send; - - using SSLProtobufClient::async_connect; - - using SSLProtobufClient::close; - - using SSLProtobufClient::on_done; - - using SSLProtobufClient::is_open; -}; +using Sender = BaseSender<ProtobufClient, BaseSenderReceiver<ProtobufClient>>; + +/*! + * \brief Conveniance typedef for SSLSender + */ + +using SSLSender = BaseSender<SSLProtobufClient, BaseSenderReceiver<SSLProtobufClient>>;
\ No newline at end of file |
