#pragma once #include #include namespace inaf::oasbo::Receivers { /** * @brief The BaseReceiver class is an abstract base class for receivers in the DAQ system. * * This class provides a common interface for receiving data from clients. It defines pure virtual * functions for getting and setting the host, connecting to and closing the connection with the client, * checking if the receiver is connected to the client, and receiving data from the client. * * Derived classes must implement these functions according to their specific requirements. */ class BaseReceiver { protected: std::string host; public: /** * @brief Get the host address. * * @return The host address as a string. */ virtual std::string getHost() = 0; /** * @brief Set the host address. * * @param host The host address to set. */ virtual void setHost(std::string host) = 0; /** * @brief Connect to the client. * * @return An integer indicating the success or failure of the operation. */ virtual int connectToClient()=0; /** * @brief Close the connection with the client. * * @return An integer indicating the success or failure of the operation. */ virtual int closeConnectionToClient()=0; /** * @brief Check if the receiver is connected to the client. * * @return true if the receiver is connected to the client, false otherwise. */ virtual bool isConnectedToClient() const =0; /** * @brief Receive data from the client. * * @param packet The received packet will be stored in this parameter. * @return An integer indicating the success or failure of the operation. */ virtual int receiveFromClient(Packets::BasePacket&) = 0; /** * @brief Virtual destructor. */ virtual ~BaseReceiver() = default; }; }