Krzysztof Grobelny | f7ea299 | 2022-01-27 11:04:58 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "types/collection_duration.hpp" |
| 4 | #include "types/collection_time_scope.hpp" |
| 5 | #include "types/duration_types.hpp" |
| 6 | #include "types/operation_type.hpp" |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <optional> |
| 10 | #include <vector> |
| 11 | |
| 12 | namespace metrics |
| 13 | { |
| 14 | |
| 15 | class CollectionData |
| 16 | { |
| 17 | public: |
| 18 | virtual ~CollectionData() = default; |
| 19 | |
| 20 | virtual std::optional<double> update(Milliseconds timestamp) = 0; |
| 21 | virtual double update(Milliseconds timestamp, double value) = 0; |
| 22 | bool updateLastValue(double value); |
| 23 | |
| 24 | private: |
| 25 | std::optional<double> lastValue; |
| 26 | }; |
| 27 | |
| 28 | std::vector<std::unique_ptr<CollectionData>> |
| 29 | makeCollectionData(size_t size, OperationType, CollectionTimeScope, |
| 30 | CollectionDuration); |
| 31 | |
| 32 | } // namespace metrics |