blob: 251e7042c47ac5fe92cb3d0243b959d92432db9f [file] [log] [blame]
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +01001#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
12namespace metrics
13{
14
15class 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
28std::vector<std::unique_ptr<CollectionData>>
29 makeCollectionData(size_t size, OperationType, CollectionTimeScope,
30 CollectionDuration);
31
32} // namespace metrics