blob: 610f015f8831768cf17361d4176d90f9c95047d7 [file] [log] [blame]
Krzysztof Grobelny80697712021-03-04 09:49:27 +00001#pragma once
2
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +01003#include "types/duration_types.hpp"
Krzysztof Grobelny80697712021-03-04 09:49:27 +00004#include "types/operation_type.hpp"
5
6#include <cstdint>
7#include <memory>
8#include <utility>
9#include <vector>
10
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010011namespace metrics
Krzysztof Grobelny80697712021-03-04 09:49:27 +000012{
13
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010014using ReadingItem = std::pair<Milliseconds, double>;
Krzysztof Grobelny80697712021-03-04 09:49:27 +000015
16class CollectionFunction
17{
18 public:
19 virtual ~CollectionFunction() = default;
20
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010021 virtual double calculate(const std::vector<ReadingItem>& readings,
22 Milliseconds timestamp) const = 0;
23 virtual double
Krzysztof Grobelny80697712021-03-04 09:49:27 +000024 calculateForStartupInterval(std::vector<ReadingItem>& readings,
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010025 Milliseconds timestamp) const = 0;
Krzysztof Grobelny80697712021-03-04 09:49:27 +000026};
27
28std::shared_ptr<CollectionFunction> makeCollectionFunction(OperationType);
29
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010030} // namespace metrics