2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2013-07-11 15:52:01 +02:00
|
|
|
|
|
|
|
#ifndef AGGREGATOR_H
|
|
|
|
#define AGGREGATOR_H
|
|
|
|
|
2015-02-26 09:02:45 +01:00
|
|
|
#include "livestatus/i2-livestatus.hpp"
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "livestatus/table.hpp"
|
|
|
|
#include "livestatus/filter.hpp"
|
2013-07-11 15:52:01 +02:00
|
|
|
|
2013-11-11 11:57:25 +01:00
|
|
|
namespace icinga
|
2013-07-11 15:52:01 +02:00
|
|
|
{
|
|
|
|
|
2017-08-14 15:30:06 +02:00
|
|
|
/**
|
|
|
|
* @ingroup livestatus
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
struct AggregatorState
|
2017-08-14 15:30:06 +02:00
|
|
|
{
|
2018-01-04 04:25:35 +01:00
|
|
|
virtual ~AggregatorState();
|
2017-08-14 15:30:06 +02:00
|
|
|
};
|
|
|
|
|
2013-07-11 15:52:01 +02:00
|
|
|
/**
|
|
|
|
* @ingroup livestatus
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
class Aggregator : public Object
|
2013-07-11 15:52:01 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-11-07 18:37:07 +01:00
|
|
|
DECLARE_PTR_TYPEDEFS(Aggregator);
|
2013-07-11 15:52:01 +02:00
|
|
|
|
2017-08-14 15:30:06 +02:00
|
|
|
virtual void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) = 0;
|
|
|
|
virtual double GetResultAndFreeState(AggregatorState *state) const = 0;
|
2013-07-11 15:52:01 +02:00
|
|
|
void SetFilter(const Filter::Ptr& filter);
|
|
|
|
|
|
|
|
protected:
|
2018-01-04 09:43:49 +01:00
|
|
|
Aggregator() = default;
|
2017-12-13 12:54:14 +01:00
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
Filter::Ptr GetFilter() const;
|
2017-12-13 12:54:14 +01:00
|
|
|
|
2013-07-11 15:52:01 +02:00
|
|
|
private:
|
|
|
|
Filter::Ptr m_Filter;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* AGGREGATOR_H */
|