1c8e3a64aSKrzysztof Grobelny #pragma once 2c8e3a64aSKrzysztof Grobelny 38069771cSKrzysztof Grobelny #include "interfaces/clock.hpp" 4c8e3a64aSKrzysztof Grobelny #include "interfaces/metric.hpp" 5f7ea2997SKrzysztof Grobelny #include "interfaces/metric_listener.hpp" 66ccfcbf5SKrzysztof Grobelny #include "interfaces/sensor.hpp" 7c8e3a64aSKrzysztof Grobelny #include "interfaces/sensor_listener.hpp" 8f7ea2997SKrzysztof Grobelny #include "metrics/collection_data.hpp" 9f7ea2997SKrzysztof Grobelny #include "types/collection_duration.hpp" 10c8e3a64aSKrzysztof Grobelny 116ccfcbf5SKrzysztof Grobelny class Metric : 126ccfcbf5SKrzysztof Grobelny public interfaces::Metric, 136ccfcbf5SKrzysztof Grobelny public interfaces::SensorListener, 146ccfcbf5SKrzysztof Grobelny public std::enable_shared_from_this<Metric> 15c8e3a64aSKrzysztof Grobelny { 16c8e3a64aSKrzysztof Grobelny public: 17cff70c14SKrzysztof Grobelny Metric(Sensors sensors, OperationType operationType, CollectionTimeScope, 18cff70c14SKrzysztof Grobelny CollectionDuration, std::unique_ptr<interfaces::Clock>); 19c8e3a64aSKrzysztof Grobelny 206ccfcbf5SKrzysztof Grobelny void initialize() override; 217e098e93SLukasz Kazmierczak void deinitialize() override; 229e8da546SKrzysztof Grobelny const std::vector<MetricValue>& getUpdatedReadings() override; 2351f0fd50SKrzysztof Grobelny void sensorUpdated(interfaces::Sensor&, Milliseconds, 2451f0fd50SKrzysztof Grobelny double value) override; 25d2238194SKrzysztof Grobelny LabeledMetricParameters dumpConfiguration() const override; 2618e7101cSKrzysztof Grobelny uint64_t metricCount() const override; 27f7ea2997SKrzysztof Grobelny void registerForUpdates(interfaces::MetricListener& listener) override; 28f7ea2997SKrzysztof Grobelny void unregisterFromUpdates(interfaces::MetricListener& listener) override; 29f7ea2997SKrzysztof Grobelny void updateReadings(Milliseconds) override; 30f7ea2997SKrzysztof Grobelny bool isTimerRequired() const override; 31c8e3a64aSKrzysztof Grobelny 32c8e3a64aSKrzysztof Grobelny private: 33*583ba441SPatrick Williams metrics::CollectionData& findAssociatedData( 34*583ba441SPatrick Williams const interfaces::Sensor& notifier); 356ccfcbf5SKrzysztof Grobelny 36dcc4e193SKrzysztof Grobelny std::vector<MetricValue> readings; 37dcc4e193SKrzysztof Grobelny Sensors sensors; 38e8fc5751SKrzysztof Grobelny OperationType operationType; 398069771cSKrzysztof Grobelny CollectionTimeScope collectionTimeScope; 40dcc4e193SKrzysztof Grobelny CollectionDuration collectionDuration; 41f7ea2997SKrzysztof Grobelny std::vector<std::unique_ptr<metrics::CollectionData>> collectionAlgorithms; 428069771cSKrzysztof Grobelny std::unique_ptr<interfaces::Clock> clock; 43f7ea2997SKrzysztof Grobelny std::vector<std::reference_wrapper<interfaces::MetricListener>> listeners; 44c8e3a64aSKrzysztof Grobelny }; 45