/* * ParamGet.hh * * Created on: 15 oct. 2012 * Author: casimir */ #ifndef PARAMGET_HH_ #define PARAMGET_HH_ #include #include #include "AMDA_exception.hh" #include "DataWriter.hh" namespace AMDA { namespace Parameters { //used class class Parameter; /** * Exception specific for ParseMainArguments */ struct ParamGet_exception: virtual AMDA_exception { }; /** * @brief Abstract class to Get parameter value * @details must be implemented for get value in a dataBase, file, or any way */ class ParamGet : public AMDA::Parameters::DataWriter { public: /** * Constructor */ ParamGet(Parameter & parameter); /** * Constructor by copy */ ParamGet(const ParamGet &pParamGet, Parameter & parameter); /** * Destructor */ virtual ~ParamGet(); /* * @overload DataWriter::useNearestValue - to know the resampling strategy to use. If it's true, the nearest value will be use */ bool useNearestValue(); /* * @brief set the resampling strategy to use */ void setUseNearestValue(bool useNearestValue) { _useNearestValue = useNearestValue; } protected: static log4cxx::LoggerPtr _logger; private: bool _useNearestValue; }; typedef boost::shared_ptr ParamGetSPtr; // This CRTP class implements clone() for Derived template class ParamGet_CRTP : public ParamGet { public: /** * Default constructor */ ParamGet_CRTP(Parameter ¶meter) : ParamGet(parameter) {} /** * constructor by copy */ ParamGet_CRTP(const ParamGet &pDataWriter, Parameter ¶meter) : ParamGet(pDataWriter,parameter) {} /** * Clone the future instance */ virtual DataWriter *clone(Parameter ¶meter) const { return new Derived(static_cast(*this),parameter); } }; } /* namespace Parameters */ } /* namespace AMDA */ #endif /* PARAMGET_HH_ */