StatisticProcess.hh 2.05 KB
/*
 * StatisticProcess.hh
 *
 *  Created on: Nov 05, 2014
 *      Author: AKKA
 */

#ifndef STATISTICPROCESS_HH_
#define STATISTICPROCESS_HH_

#include <vector>

#include <boost/shared_ptr.hpp>
#include <log4cxx/logger.h>


#include "AMDA_exception.hh"
#include "DataClient.hh"
#include "Parameter.hh"
#include "StatisticOperation.hh"

namespace AMDA {
namespace Parameters {

//class StatisticOperation;

/**
 * @class StatisticProcess
 * @brief A StatisticProcess is used to compute a statistic result in input data.
 * @details This class implement AMDA::Parameters::DataClient interface
 */
class StatisticProcess : public AMDA::Parameters::DataClient {
public:
	/**
	 *
	 * Default constructor.
	 */
	StatisticProcess(Parameter &parameter, bool isCoverageIndependantOfResultType, int index = -1);

	/**
	 * Default destructor.
	 */
	virtual ~StatisticProcess();

	/**
	 * @overload DataClient::establishConnection
	 */
	virtual void establishConnection();

	/**
	 * @brief initializes time attribute
	 */
	virtual TimeStamp init(TimeIntervalListSPtr pTimeIntervalList);

	/*
	 * @brief Set arguments map
	 */
	void setArguments(std::map<std::string,std::string>& args);

	/*
	 * @brief create statistic operation
	 */
	virtual void createOperation(void) = 0;

	/*
	 * @brief get result dimension definition
	 */
	std::string getResultDimDefinition(bool forCoverage = false);

	/**
	 * @brief compute statistic result and push it in a vector of string
	 */
	void compute(std::vector<std::string> &result, std::vector<std::string> &coverage);

	/*
	 * @brief get UCD of the statistic process
	 */
	virtual std::string getUCD(void);

protected:
	static log4cxx::LoggerPtr _logger;

	Parameter&  _parameter;

	std::map<std::string,std::string> _args;

	bool _isCoverageIndependantOfResultType;

	int _index;

	TimeIntervalListSPtr _timeIntervalList;

	TimeIntervalList::iterator _currentTimeInterval;

	StatisticOperationBase* _operation;
};

typedef boost::shared_ptr<StatisticProcess> StatisticProcessSPtr;

} /* namespace Parameters */

} /* namespace AMDA */
#endif /* STATISTICPROCESS_HH_ */