]> granicus.if.org Git - icinga2/blob - lib/livestatus/invavgaggregator.hpp
Docs: Explain across midnight time periods with an overlapping range
[icinga2] / lib / livestatus / invavgaggregator.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef INVAVGAGGREGATOR_H
4 #define INVAVGAGGREGATOR_H
5
6 #include "livestatus/table.hpp"
7 #include "livestatus/aggregator.hpp"
8
9 namespace icinga
10 {
11
12 /**
13  * @ingroup livestatus
14  */
15 struct InvAvgAggregatorState final : public AggregatorState
16 {
17         double InvAvg{0};
18         double InvAvgCount{0};
19 };
20
21 /**
22  * @ingroup livestatus
23  */
24 class InvAvgAggregator final : public Aggregator
25 {
26 public:
27         DECLARE_PTR_TYPEDEFS(InvAvgAggregator);
28
29         InvAvgAggregator(String attr);
30
31         void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
32         double GetResultAndFreeState(AggregatorState *state) const override;
33
34 private:
35         String m_InvAvgAttr;
36
37         static InvAvgAggregatorState *EnsureState(AggregatorState **state);
38 };
39
40 }
41
42 #endif /* INVAVGAGGREGATOR_H */