| 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 |
|
|---|
| 23 | class ParameterException;
|
|---|
| 24 | class ParameterValueException;
|
|---|
| 25 |
|
|---|
| 26 | /** This class encapsulates a clonable, continuous value.
|
|---|
| 27 | *
|
|---|
| 28 | */
|
|---|
| 29 | template <typename T>
|
|---|
| 30 | class Parameter :
|
|---|
| 31 | virtual public ParameterInterface,
|
|---|
| 32 | virtual public Value<T>
|
|---|
| 33 | {
|
|---|
| 34 | public:
|
|---|
| 35 | Parameter(const Parameter<T> &instance);
|
|---|
| 36 | Parameter(const std::string &_name);
|
|---|
| 37 | Parameter(const std::string &_name, const T &_value);
|
|---|
| 38 | Parameter(const std::string &_name, const Validator<T> &_Validator);
|
|---|
| 39 | Parameter(const std::string &_name, const Validator<T> &_Validator, const T &_value);
|
|---|
| 40 | Parameter(const std::string &_name, const std::vector<T> &_ValidValues);
|
|---|
| 41 | Parameter(const std::string &_name, const std::vector<T> &_ValidValues, const T &_value);
|
|---|
| 42 | Parameter(const std::string &_name, const range<T> &_ValidRange);
|
|---|
| 43 | Parameter(const std::string &_name, const range<T> &_ValidRange, const T &_value);
|
|---|
| 44 | virtual ~Parameter();
|
|---|
| 45 |
|
|---|
| 46 | // catch the following functions from Value<T> to add exception information
|
|---|
| 47 | const std::string getAsString() const throw(ParameterValueException);
|
|---|
| 48 | const T & get() const throw(ParameterValueException);
|
|---|
| 49 | void set(const T & _value) throw(ParameterValueException);
|
|---|
| 50 | void setAsString(const std::string &_value) throw(ParameterValueException);
|
|---|
| 51 |
|
|---|
| 52 | // comparator
|
|---|
| 53 | bool operator==(const Parameter<T> &_instance) const throw(ParameterException);
|
|---|
| 54 | bool operator!=(const Parameter<T> &_instance) const throw(ParameterException)
|
|---|
| 55 | { return !((*this)==(_instance)); }
|
|---|
| 56 |
|
|---|
| 57 | ParameterInterface* clone() const;
|
|---|
| 58 |
|
|---|
| 59 | //private: // TODO...
|
|---|
| 60 | Parameter();
|
|---|
| 61 | };
|
|---|
| 62 |
|
|---|
| 63 | #include "Parameter_impl.hpp"
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | #endif /* PARAMETER_HPP_ */
|
|---|