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