/* * * Created on: Mar 1, 2021 * Author: astrisw * */ #pragma once #include #include #include namespace inaf::oasbo::PacketMonitors{ class BasePacketMonitor{ protected: std::map stats; public: virtual void monit(PacketLib::BasePacket &) = 0; virtual void printStats()=0; virtual void reset() = 0; virtual std::map getStatsMap() const { return stats;} std::optional getStat(std::string stat) const { try { return this->stats.at(stat); } catch (const std::out_of_range &) { std::cerr << "No stat with name " << stat << std::endl; return std::nullopt; } } virtual ~BasePacketMonitor() = default; }; }