/* * Process.hh * * Created on: Oct 31, 2012 * Author: f.casimir */ #ifndef PROCESS_HH_ #define PROCESS_HH_ #include #include #include #include "AMDA_exception.hh" #include "DataWriter.hh" #include "DataClient.hh" #include "Parameter.hh" namespace AMDA { namespace Parameters { /** * Exception specific for ParseMainArguments */ struct Process_exception: virtual AMDA_exception { }; class Operation; /** * @class Process * @brief Interface to implemented a Process, a Process is used to compute a new ParamData with input data. * @details an implementation must implemented AMDA::Parameters::DataWriter and AMDA::Parameters::DataClien interface */ class Process : public AMDA::Parameters::DataWriter, public AMDA::Parameters::DataClient { public: typedef std::vector AttributeList; /** * * Default constructor. */ Process(Parameter ¶meter); /** * * Default constructor. */ Process(const Process &process, Parameter ¶meter); /** * Default destructor. */ virtual ~Process(); // Get methods const std::string& getExpression() const { return _expression; } const std::string& getDescription() const { return _description; } Operation* getOperation() { return _operation; } ParameterSPtr getReferenceParameter() { return _refParameterSPtr; } AttributeList& getAttributList() { return _attributList; } // Set methods void setExpression(const std::string& expression) { _expression = expression; } void setDescription(const std::string& description) { _description = description; } void setOperation(Operation* pOperation) { _operation = pOperation; } void setReferenceParameter( ParameterSPtr refParameterSPtr) { _refParameterSPtr = refParameterSPtr;} void setGapThreshold(double gapThreshold) { _gapThreshold = gapThreshold; } // Others methods virtual bool isEmptyExpression() { return _expression.empty(); } void setAttributList(AttributeList pAttributList) { _attributList = pAttributList; } protected: static log4cxx::LoggerPtr _logger; /** * to store attribut of process write in _expression */ AttributeList _attributList; std::string _expression; std::string _description; Operation *_operation; ParameterSPtr _refParameterSPtr; double _gapThreshold; }; typedef boost::shared_ptr ProcessSPtr; // This CRTP class implements clone() for Derived template class Process_CRTP : public Process { public: /** * Default constructor */ Process_CRTP(Parameter ¶meter) : Process(parameter) {} /** * constructeur by copy */ Process_CRTP(const Process &pProcess, Parameter ¶meter) : Process(pProcess, parameter) {} virtual DataWriter *clone(Parameter ¶meter) const { return new Derived(static_cast(*this),parameter); } }; } /* namespace Parameters */ } /* namespace AMDA */ #endif /* PROCESS_HH_ */