Skip to content
Base_Archiver.h 2.24 KiB
Newer Older
Valerio Pastore's avatar
Valerio Pastore committed

Valerio Pastore's avatar
Valerio Pastore committed
#pragma once
Valerio Pastore's avatar
Valerio Pastore committed
#include <string>
Valerio Pastore's avatar
Valerio Pastore committed
#include <Base_Packet.h>
Valerio Pastore's avatar
Valerio Pastore committed

Valerio Pastore's avatar
.  
Valerio Pastore committed
namespace inaf::oasbo::Archivers {
Valerio Pastore's avatar
Valerio Pastore committed
/**
 * @brief The BaseArchiver class is an abstract base class for archivers.
 * 
 * This class provides a common interface for archiving packets. Derived classes
 * must implement the pure virtual functions defined in this class.
 */
Valerio Pastore's avatar
.  
Valerio Pastore committed
class BaseArchiver {
Valerio Pastore's avatar
Valerio Pastore committed
protected:
Valerio Pastore's avatar
.  
Valerio Pastore committed
	std::string dest; /**< The destination of the archiver. */
Valerio Pastore's avatar
Valerio Pastore committed
public:
Valerio Pastore's avatar
Valerio Pastore committed
	/**
	 * @brief Write a packet to the archiver.
	 * 
	 * This function writes the given packet to the "archive".
	 * 
	 * @param packet The packet to write.
	 * @return An integer indicating the success or failure of the write operation.
	 */
Valerio Pastore's avatar
.  
Valerio Pastore committed
	virtual int write(PacketLib::BasePacket&) = 0;
Valerio Pastore's avatar
Valerio Pastore committed
	/**
	 * @brief Write a packet to the archiver with a specified destination.
	 * 
	 * This function writes the given packet to the archiver with the specified destination.
	 * 
	 * @param packet The packet to write.
	 * @param destination The destination where the packet should be written.
	 * @return An integer indicating the success or failure of the write operation.
	 */
Valerio Pastore's avatar
.  
Valerio Pastore committed
	virtual int write(PacketLib::BasePacket&, std::string destination) = 0;
Valerio Pastore's avatar
Valerio Pastore committed
	/**
	 * @brief Open the archiver.
	 * 
	 * This function opens the archiver.
	 * 
	 * @return An integer indicating the success or failure of the open operation.
	 */
Valerio Pastore's avatar
Valerio Pastore committed
	virtual int open()=0;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Close the archiver.
	 * 
	 * This function closes the archiver.
	 * 
	 * @return An integer indicating the success or failure of the close operation.
	 */
Valerio Pastore's avatar
Valerio Pastore committed
	virtual int close()=0;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Check if the archiver is open.
	 * 
	 * This function checks if the archiver is open.
	 * 
	 * @return A boolean value indicating whether the archiver is open or not.
	 */
	virtual bool is_open()=0;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Set the destination of the archiver.
	 * 
	 * This function sets the destination of the archiver.
	 * 
	 * @param dest The destination to set.
	 */
Valerio Pastore's avatar
Valerio Pastore committed
	virtual void setDest(std::string dest) = 0;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Get the destination of the archiver.
	 * 
	 * This function gets the destination of the archiver.
	 * 
	 * @return The destination of the archiver.
	 */
Valerio Pastore's avatar
Valerio Pastore committed
	virtual std::string getDest() = 0;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Destructor for the BaseArchiver class.
	 */
Valerio Pastore's avatar
Valerio Pastore committed
	virtual ~BaseArchiver() = default;

};