Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/metric.hpp" |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 4 | #include "interfaces/sensor.hpp" |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 5 | #include "interfaces/sensor_listener.hpp" |
| 6 | |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 7 | class Metric : |
| 8 | public interfaces::Metric, |
| 9 | public interfaces::SensorListener, |
| 10 | public std::enable_shared_from_this<Metric> |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 11 | { |
| 12 | public: |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 13 | Metric(std::vector<std::shared_ptr<interfaces::Sensor>> sensors, |
| 14 | std::string operationType, std::string id, std::string metadata); |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 15 | |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 16 | void initialize() override; |
| 17 | const std::vector<MetricValue>& getReadings() const override; |
| 18 | void sensorUpdated(interfaces::Sensor&, uint64_t) override; |
| 19 | void sensorUpdated(interfaces::Sensor&, uint64_t, double value) override; |
Krzysztof Grobelny | d223819 | 2020-12-02 09:27:28 +0000 | [diff] [blame] | 20 | LabeledMetricParameters dumpConfiguration() const override; |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 21 | |
| 22 | private: |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 23 | MetricValue& findMetric(interfaces::Sensor&); |
| 24 | |
| 25 | std::vector<std::shared_ptr<interfaces::Sensor>> sensors; |
| 26 | std::string operationType; |
| 27 | std::string id; |
| 28 | std::string metadata; |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 29 | std::vector<MetricValue> readings; |
| 30 | }; |