1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "livestatus/countaggregator.hpp"
5 using namespace icinga;
7 CountAggregatorState *CountAggregator::EnsureState(AggregatorState **state)
10 *state = new CountAggregatorState();
12 return static_cast<CountAggregatorState *>(*state);
15 void CountAggregator::Apply(const Table::Ptr& table, const Value& row, AggregatorState **state)
17 CountAggregatorState *pstate = EnsureState(state);
19 if (GetFilter()->Apply(table, row))
23 double CountAggregator::GetResultAndFreeState(AggregatorState *state) const
25 CountAggregatorState *pstate = EnsureState(&state);
26 double result = pstate->Count;