/* * MaxFunc.hh * * Created on: Jun 22, 2018 * Author: benjamin */ #ifndef MAXFUNC_HH_ #define MAXFUNC_HH_ #include "AbstractFunc.hh" #include "Toolbox.hh" namespace AMDA { namespace Parameters { namespace StatisticFunctions { template OutputElemType computeMax(std::list>& mem, OutputElemType& nanVal) { OutputElemType result = nanVal; for (auto val : mem) { result = StatisticFunctions::max(val.second,result); } return result; } /** * @class MaxFunc * @brief * @details This class implements AbstractFunc. */ template class MaxFunc : public ClassicAbstractFunc { public: /** * @brief Constructor. */ MaxFunc(Process& pProcess, TimeIntervalListSPtr pTimeIntervalList, ParamDataSpec& paramInput, double windowtime) : ClassicAbstractFunc(pProcess, pTimeIntervalList, paramInput, windowtime) { } virtual ~MaxFunc() { } OutputElemType compute() { return computeMax(ClassicAbstractFunc::_mem, ClassicAbstractFunc::_nanVal); } }; /** * @class MaxFuncSm * @brief * @details This class implements AbstractFunc. */ template class MaxSmFunc : public SmAbstractFunc { public: /** * @brief Constructor. */ MaxSmFunc(Process& pProcess, TimeIntervalListSPtr pTimeIntervalList, ParamDataSpec& paramInput, double windowtime) : SmAbstractFunc(pProcess, pTimeIntervalList, paramInput, windowtime) { } virtual ~MaxSmFunc() { } OutputElemType compute() { return computeMax(SmAbstractFunc::_mem, SmAbstractFunc::_nanVal); } }; } /* namespace StatisticFunctions */ } /* namespace Parameters */ } /* namespace AMDA */ #endif /* MAXFUNC_HH_ */