| [adcfc6] | 1 | /* | 
|---|
|  | 2 | * Parameter.hpp | 
|---|
|  | 3 | * | 
|---|
|  | 4 | *  Created on: Apr 16, 2012 | 
|---|
|  | 5 | *      Author: ankele | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #ifndef PARAMETER_HPP_ | 
|---|
|  | 9 | #define PARAMETER_HPP_ | 
|---|
|  | 10 |  | 
|---|
|  | 11 |  | 
|---|
|  | 12 |  | 
|---|
|  | 13 | // include config.h | 
|---|
|  | 14 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 15 | #include <config.h> | 
|---|
|  | 16 | #endif | 
|---|
|  | 17 |  | 
|---|
|  | 18 | #include <string> | 
|---|
|  | 19 |  | 
|---|
|  | 20 | #include "Value.hpp" | 
|---|
|  | 21 | #include "ParameterInterface.hpp" | 
|---|
|  | 22 |  | 
|---|
| [e45c1d] | 23 | class ParameterException; | 
|---|
|  | 24 | class ParameterValueException; | 
|---|
|  | 25 |  | 
|---|
| [adcfc6] | 26 | /** This class encapsulates a clonable, continuous value. | 
|---|
|  | 27 | * | 
|---|
|  | 28 | */ | 
|---|
|  | 29 | template <typename T> | 
|---|
|  | 30 | class Parameter : public ParameterInterface<T>, public Value<T> | 
|---|
|  | 31 | { | 
|---|
|  | 32 | public: | 
|---|
| [f10b0c] | 33 | Parameter(const Parameter<T> &instance); | 
|---|
| [adcfc6] | 34 | Parameter(const std::string &_name); | 
|---|
|  | 35 | Parameter(const std::string &_name, const T &_value); | 
|---|
|  | 36 | Parameter(const std::string &_name, const Validator<T> &_Validator); | 
|---|
|  | 37 | Parameter(const std::string &_name, const Validator<T> &_Validator, const T &_value); | 
|---|
|  | 38 | Parameter(const std::string &_name, const std::vector<T> &_ValidValues); | 
|---|
|  | 39 | Parameter(const std::string &_name, const std::vector<T> &_ValidValues, const T &_value); | 
|---|
|  | 40 | Parameter(const std::string &_name, const range<T> &_ValidRange); | 
|---|
|  | 41 | Parameter(const std::string &_name, const range<T> &_ValidRange, const T &_value); | 
|---|
|  | 42 | virtual ~Parameter(); | 
|---|
|  | 43 |  | 
|---|
| [e45c1d] | 44 | // catch the following functions from Value<T> to add exception information | 
|---|
|  | 45 | const std::string getAsString() const throw(ParameterValueException); | 
|---|
|  | 46 | const T & get() const throw(ParameterValueException); | 
|---|
|  | 47 | void set(const T & _value) throw(ParameterValueException); | 
|---|
|  | 48 | void setAsString(const std::string _value) throw(ParameterValueException); | 
|---|
|  | 49 |  | 
|---|
| [adcfc6] | 50 | // comparator | 
|---|
| [e45c1d] | 51 | bool operator==(const Parameter<T> &_instance) const throw(ParameterException); | 
|---|
|  | 52 | bool operator!=(const Parameter<T> &_instance) const throw(ParameterException) | 
|---|
| [adcfc6] | 53 | { return !((*this)==(_instance)); } | 
|---|
|  | 54 |  | 
|---|
| [118f1e] | 55 | ParameterAsString* clone() const; | 
|---|
| [adcfc6] | 56 |  | 
|---|
| [f10b0c] | 57 | //private: // TODO... | 
|---|
| [adcfc6] | 58 | Parameter(); | 
|---|
|  | 59 | }; | 
|---|
|  | 60 |  | 
|---|
|  | 61 | #include "Parameter_impl.hpp" | 
|---|
|  | 62 |  | 
|---|
|  | 63 |  | 
|---|
|  | 64 | #endif /* PARAMETER_HPP_ */ | 
|---|