1 #pragma once 2 3 #include "types/duration_types.hpp" 4 #include "types/operation_type.hpp" 5 6 #include <cstdint> 7 #include <memory> 8 #include <utility> 9 #include <vector> 10 11 namespace metrics 12 { 13 14 using ReadingItem = std::pair<Milliseconds, double>; 15 16 class CollectionFunction 17 { 18 public: 19 virtual ~CollectionFunction() = default; 20 21 virtual double calculate(const std::vector<ReadingItem>& readings, 22 Milliseconds timestamp) const = 0; 23 virtual double 24 calculateForStartupInterval(std::vector<ReadingItem>& readings, 25 Milliseconds timestamp) const = 0; 26 }; 27 28 std::shared_ptr<CollectionFunction> makeCollectionFunction(OperationType); 29 30 } // namespace metrics 31