#pragma once #include #include namespace inaf::oasbo::Providers { /** * @brief The BaseProvider class is an abstract base class for providers in the DAQ system. * * This class defines the common interface for providers that write packets to a destination. * Derived classes must implement the pure virtual functions defined in this class. */ class BaseProvider{ protected: std::string dest; /**< The destination where packets are written to. */ public: /** * @brief Writes a packet to the destination. * * @param packet The packet to be written. * @return int Returns an integer indicating the success or failure of the write operation. */ virtual int write(PacketLib::BasePacket &packet) = 0; /** * @brief Writes a packet to a specified destination. * * @param packet The packet to be written. * @param dest The destination where the packet should be written to. * @return int Returns an integer indicating the success or failure of the write operation. */ virtual int write(PacketLib::BasePacket &packet, std::string dest) = 0; /** * @brief Opens the provider. * * @return int Returns an integer indicating the success or failure of the open operation. */ virtual int open() = 0; /** * @brief Closes the provider. * * @return int Returns an integer indicating the success or failure of the close operation. */ virtual int close() = 0; /** * @brief Checks if the provider is open. * * @return bool Returns true if the provider is open, false otherwise. */ virtual bool isOpen() = 0; /** * @brief Sets the destination where packets should be written to. * * @param dest The destination to be set. */ virtual void setDest(std::string dest) = 0; /** * @brief Gets the current destination where packets are written to. * * @return std::string Returns the current destination. */ virtual std::string getDest() = 0; /** * @brief Default destructor. */ virtual ~BaseProvider() = default; }; }