#pragma once #include "interfaces/clock.hpp" #include "interfaces/metric.hpp" #include "interfaces/sensor.hpp" #include "interfaces/sensor_listener.hpp" class Metric : public interfaces::Metric, public interfaces::SensorListener, public std::enable_shared_from_this { public: Metric(Sensors sensors, OperationType operationType, std::string id, CollectionTimeScope, CollectionDuration, std::unique_ptr); ~Metric(); void initialize() override; void deinitialize() override; std::vector getReadings() const override; void sensorUpdated(interfaces::Sensor&, Milliseconds) override; void sensorUpdated(interfaces::Sensor&, Milliseconds, double value) override; LabeledMetricParameters dumpConfiguration() const override; uint64_t sensorCount() const override; private: class CollectionData; class DataPoint; class DataInterval; class DataStartup; static std::vector> makeCollectionData(size_t size, OperationType, CollectionTimeScope, CollectionDuration); CollectionData& findAssociatedData(const interfaces::Sensor& notifier); std::string id; std::vector readings; Sensors sensors; OperationType operationType; CollectionTimeScope collectionTimeScope; CollectionDuration collectionDuration; std::vector> collectionAlgorithms; std::unique_ptr clock; };