/** * StatisticOperation.hh * * Created on: 4 nov. 2012 * Author: AKKA IS */ #ifndef STATISTICOPERATION_HH_ #define STATISTICOPERATION_HH_ #include #include #include #include #include #include "StatisticData.hh" namespace AMDA { namespace Parameters { class StatisticProcess; ///< @see StatisticProcess class ParamDataIndexInfo; ///< @see ParamDataIndexInfo /** * @brief Interface of StatisticProcess operation * @details must be implemented in an StatisticProcess implementation to compute statistic data * @see Process */ class StatisticOperationBase { public: /** * @brief default constructor */ StatisticOperationBase(StatisticProcess& process) : _process(process){ } /** * @brief destructor */ virtual ~StatisticOperationBase() {} /** * @brief compute statistic data * @detail pParamDataIndexInfo contain input description data */ virtual void compute(ParamDataIndexInfo &pParamDataIndexInfo) = 0; /* * @brief finalize computation - must be call before to get result */ virtual void finalizeCompute(void) { //Nothing to do } /* * @brief push statistic result in two string vectors (one for the statistic computation, the other one for the coverage) * ideal is the ideal number of data in the current interval (in relation to the parameter sampling time) */ virtual void pushResult(std::vector& result, std::vector& coverage, int ideal, bool isCoverageIndependantOfResultType,int index) = 0; /** * @brief Reset static data to process on another data flow. */ virtual void reset() { //Nothing to do } /** * @brief Get the result dimensiond efinition. * If forCoverage is true, the given dimension is for the coverage */ virtual std::string getResultDimDefinition(bool forCoverage = false) = 0; protected: /** * @brief Reference on parent process */ StatisticProcess &_process; }; template class StatisticOperation : public StatisticOperationBase { public: /* * @brief constructor */ StatisticOperation(StatisticProcess& process) : StatisticOperationBase(process), _resultData() { } /* * @brief destructor */ virtual ~StatisticOperation(void) { } /* * @biref Get statistic result */ TStatisticData getStatisticResult(void) { return _resultData; } /* * @brief push result in a string vector */ void pushResult(std::vector& result, std::vector& coverage, int ideal, bool isCoverageIndependantOfResultType, int index = -1) { pushStatisticDataInVectorString(result, coverage, _resultData, ideal, isCoverageIndependantOfResultType, index); } protected: TStatisticData _resultData; }; } } #endif /* STATISTICOPERATION_HH_ */