Newer
Older
/**
* @brief The BasePacketMonitor class is an abstract base class for packet monitors in the DAQ system.
*
* This class provides a common interface for packet monitoring functionality.
* Derived classes must implement the monit(), printStats(), and reset() methods.
* The class also provides methods to access and retrieve statistics related to the monitored packets.
*/
std::map<std::string, std::string> stats; /**< A map to store statistics related to the monitored packets. */
/**
* @brief Monitors a packet.
*
* This pure virtual method is used to monitor a packet.
* Derived classes must implement this method to define the monitoring behavior.
*
* @param packet The packet to be monitored.
*/
/**
* @brief Prints the statistics related to the monitored packets.
*
* This pure virtual method is used to print the statistics related to the monitored packets.
* Derived classes must implement this method to define the printing behavior.
*/
virtual void printStats() = 0;
/**
* @brief Resets the statistics related to the monitored packets.
*
* This pure virtual method is used to reset the statistics related to the monitored packets.
* Derived classes must implement this method to define the resetting behavior.
*/
/**
* @brief Retrieves the statistics map.
*
* This method returns the map containing the statistics related to the monitored packets.
*
* @return The map containing the statistics related to the monitored packets.
*/
virtual std::map<std::string, std::string> getStatsMap() const {
return stats;
}
/**
* @brief Retrieves a specific statistic.
*
* This method retrieves a specific statistic from the statistics map.
* If the statistic is not found, it returns std::nullopt.
*
* @param stat The name of the statistic to retrieve.
* @return An optional string containing the value of the statistic, or std::nullopt if the statistic is not found.
*/
std::optional<std::string> getStat(std::string stat) const {