/******************************************************************************
* Icinga 2 *
- * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
/**
* @ingroup livestatus
*/
-class MaxAggregator : public Aggregator
+struct MaxAggregatorState final : public AggregatorState
+{
+ double Max{0};
+};
+
+/**
+ * @ingroup livestatus
+ */
+class MaxAggregator final : public Aggregator
{
public:
- DECLARE_OBJECT(MaxAggregator);
+ DECLARE_PTR_TYPEDEFS(MaxAggregator);
- MaxAggregator(const String& attr);
+ MaxAggregator(String attr);
- virtual void Apply(const Table::Ptr& table, const Value& row);
- virtual double GetResult(void) const;
+ void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
+ double GetResultAndFreeState(AggregatorState *state) const override;
private:
- double m_Max;
String m_MaxAttr;
+
+ static MaxAggregatorState *EnsureState(AggregatorState **state);
};
}