Skip to content
Snippets Groups Projects
Commit d44283ec authored by Leon Dietrich's avatar Leon Dietrich Committed by Benny Baumann
Browse files

add: Document abstract connection clients

parent ee7b3235
No related branches found
No related tags found
1 merge request!1First unit tests
...@@ -15,6 +15,10 @@ namespace rmrf::net { ...@@ -15,6 +15,10 @@ namespace rmrf::net {
class connection_client : public std::enable_shared_from_this<connection_client> { class connection_client : public std::enable_shared_from_this<connection_client> {
public: public:
/**
* This function type accepts a reference to the incomming data string which it may not alter
* and may not return any data.
*/
typedef std::function<void(const std::string&)> incomming_data_cb; typedef std::function<void(const std::string&)> incomming_data_cb;
protected: protected:
...@@ -25,6 +29,7 @@ public: ...@@ -25,6 +29,7 @@ public:
/** /**
* Use this method to send data to the other endpoint. * Use this method to send data to the other endpoint.
* @param data The data to send
*/ */
virtual void write_data(const std::string& data) = 0; virtual void write_data(const std::string& data) = 0;
...@@ -33,7 +38,7 @@ public: ...@@ -33,7 +38,7 @@ public:
* called when the client got data to process. * called when the client got data to process.
* @param cb The callback function to register [void(std::string data)] * @param cb The callback function to register [void(std::string data)]
*/ */
inline void set_incomming_data_callback(const incomming_data_cb &cb) { inline void set_incomming_data_callback(const incomming_data_cb& cb) {
this->in_data_cb = cb; this->in_data_cb = cb;
}; };
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment