/** * ParameterConfigurator.hh * * Created on: 18 oct. 2012 * Author: AKKA IS */ #ifndef PARAMETERCONFIGURATOR_HH_ #define PARAMETERCONFIGURATOR_HH_ #include #include #include namespace AMDA { namespace Parameters { /** * @brief context of FileConfigurator * @see FileConfigurator */ class CfgContext { public: typedef std::list Data; /** * @brief add an any values in context */ template void push(T v) { _data.push_back(v); } /** * @brief get any value added with type T */ template T get() const { for ( Data::const_reverse_iterator rit = _data.rbegin(); rit != _data.rend(); ++rit ) { if ( (*rit).type() == typeid(T)) { return boost::any_cast(*rit); } } return NULL; } private: Data _data; }; /** * @brief Interface to parse a xml or other file */ class FileConfigurator { public: /** * Destructor. */ virtual ~FileConfigurator() {} /** * Must be implemented to parse file */ virtual bool proceed(const char* filename, const CfgContext& context, bool optionalFile = false) = 0; /** * @brief _path getter */ const std::string& getParamPath() { return _path; } /** * @brief _path setter */ void setParamPath(const std::string& path) { _path = path; } private: /** * @brief path for find file */ std::string _path; }; } /* namespace Parameters */ } /* namespace AMDA */ #endif /* PARAMETERCONFIGURATOR_HH_ */