aboutsummaryrefslogtreecommitdiff
path: root/libcmix-network/client.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-09-28 13:18:18 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-09-28 13:18:18 +0200
commit3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375 (patch)
tree345583aaf457ce5076d0d5f7c158628dfd971360 /libcmix-network/client.hpp
parent85d25eebd38bb278ad598a291a007938854945a4 (diff)
downloadcmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.tar.gz
cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.tar.bz2
cmix-3fe7a5b6a18b6841ae51f294dc58fe9c8df6d375.zip
Finally made a initial doxygen documentation pass over all files.
Diffstat (limited to 'libcmix-network/client.hpp')
-rw-r--r--libcmix-network/client.hpp48
1 files changed, 46 insertions, 2 deletions
diff --git a/libcmix-network/client.hpp b/libcmix-network/client.hpp
index 46b989d..981283b 100644
--- a/libcmix-network/client.hpp
+++ b/libcmix-network/client.hpp
@@ -5,22 +5,66 @@
#include <array>
+/*!
+ * \file
+ */
+
+/*!
+ * \brief The Client class
+ */
class Client {
public:
+ /*!
+ * \brief OnDoneFT Function type of the function being called when this instance is done operating.
+ */
typedef std::function<void(void)> OnDoneFT;
+
+ /*!
+ * \brief MessageHandler Function type of the function handling incoming messages.
+ */
typedef std::function<void(std::vector<uint8_t>)> MessageHandler;
protected:
+ /*!
+ * \brief socket The socket connection this instance handles.
+ */
boost::asio::ip::tcp::socket socket;
private:
+ /*!
+ * \brief buffer Internal private buffer used to receive messages.
+ */
boost::asio::streambuf buffer;
+
+ /*!
+ * \brief done The done function being called when this is done operating.
+ */
OnDoneFT done;
+ /*!
+ * \brief handle_receive
+ * \param message_handler The function to call when a message has been received.
+ * \param ec A possible error that occured during receiving.
+ * \param read_bytes The number of bytes read.
+ */
+ void handle_receive(MessageHandler message_handler, boost::system::error_code const& ec, size_t read_bytes);
+
public:
+ /*!
+ * \brief Client
+ * \param socket An rvalue reference to a socket it will now own and receive from.
+ */
Client(boost::asio::ip::tcp::socket&& socket);
-
- void handle_receive(MessageHandler message_handler, boost::system::error_code const& ec, size_t read_bytes);
+
+ /*!
+ * \brief receive
+ * \param message_handler The function to call when a message has been received.
+ */
void receive(MessageHandler message_handler);
+
+ /*!
+ * \brief on_done sets the done callback.
+ * \param f The new done callback function.
+ */
void on_done(OnDoneFT f);
};