blob: fdeafc3b04fa5fbc7749cc1ddc75cd4f59967c2d [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;
Patrick Williams583ba442025-02-03 14:28:19 -050023 virtual double calculateForStartupInterval(
24 std::vector<ReadingItem>& readings, Milliseconds timestamp) const = 0;
Krzysztof Grobelny80697712021-03-04 09:49:27 +000025};
26
27std::shared_ptr<CollectionFunction> makeCollectionFunction(OperationType);
28
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010029} // namespace metrics