From 7212db13b9013aa15673ae65da65eeaf97ee0d12 Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Fri, 21 Mar 2025 22:13:38 +0100 Subject: add doxygen-comments for each member --- src/client/client.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'src/client/client.h') diff --git a/src/client/client.h b/src/client/client.h index 852ade3..bc2d702 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -11,22 +11,73 @@ #include #include "shared_memory.h" + +/** + * @class Client + * @brief Represents the client, which performs actions on the hashtable of the server. + */ class Client { public: + /** + * @brief Constructs a new client and opens the shared memory. + */ Client(); + + /** + * @brief Unmaps the shared memory. + */ ~Client(); + /** + * @brief Main client program. + * + * @details The user can choose the operation and the arguments, which will be sent to the + * server. + */ void start_client(); private: + /** + * @brief Memory which is shared with the server. + */ SharedMemory* shared_memory; + + /** + * @brief File descriptor for the shared memory, used to unmap and close the memory at the end. + */ int shm_fd; + /** + * @brief Sends a request to the server. + * + * @param shared_memory The memory to use. + * @param type The type of the operation the server has to process. + * @param k First potential argument of the request, represents the key. + * @param v Second potential argument of the request, represent the value. + * @return int The index of the request in the circular-buffer, so we can access it again for + * processing the respond. + */ int send_request( SharedMemory* shared_memory, Operations type, std::optional k, std::optional v); + + /** + * @brief Determines if the request was processed by the server. + * + * @param shared_memory The memory to use. + * @param index The index of the request in the circular-buffer. + * @return bool The request was processed by the server. + */ bool request_processed(SharedMemory* shared_memory, int index); + + /** + * @brief Processes the respond of the server. + * + * @param shared_memory The memory to use. + * @param index The index of the request in the circular-buffer. + * @return std::string The response of the server as a string. + */ std::string process_respond(SharedMemory* shared_memory, int index); }; -- cgit 1.4.1