| 66 |
|
template<typename T> static bool convert(T v, RepType& r){return false;} // !NB everything is ok |
| 67 |
|
template<typename T> static RepType convert(T v) {RepType tmp; convert(v,tmp);return tmp;} |
| 68 |
|
static bool convert(RepType v, RepType& r) { r = v; return true;} |
| 69 |
< |
static char* getParamType() { return "std::string";} |
| 69 |
> |
static std::string getParamType() { return "string";} |
| 70 |
|
}; |
| 71 |
|
//bool |
| 72 |
|
template<> |
| 87 |
|
|
| 88 |
|
return result; |
| 89 |
|
} |
| 90 |
< |
static char* getParamType() { return "bool";} |
| 90 |
> |
static std::string getParamType() { return "bool";} |
| 91 |
|
}; |
| 92 |
|
|
| 93 |
|
//int |
| 97 |
|
template<typename T> static bool convert(T, RepType&){return false;} |
| 98 |
|
template<typename T> static RepType convert(T v) {RepType tmp; convert(v,tmp);return tmp;} |
| 99 |
|
static bool convert(RepType v, RepType& r) { r=v; return true;} |
| 100 |
< |
static char* getParamType() { return "int";} |
| 100 |
> |
static std::string getParamType() { return "int";} |
| 101 |
|
}; |
| 102 |
|
|
| 103 |
|
//double |
| 108 |
|
template<typename T> static RepType convert(T v) {RepType tmp; convert(v,tmp);return tmp;} |
| 109 |
|
static bool convert(RepType v, RepType& r) {r=v; return true;} |
| 110 |
|
static bool convert(int v, RepType& r) {r = static_cast<double>(v); return true;} |
| 111 |
< |
static char* getParamType() { return "double";} |
| 111 |
> |
static std::string getParamType() { return "double";} |
| 112 |
|
}; |
| 113 |
|
|
| 114 |
|
|
| 115 |
|
class ParameterBase { |
| 116 |
|
public: |
| 117 |
|
ParameterBase() : keyword_(), optional_(false), defaultValue_(false), empty_(true) {} |
| 118 |
+ |
virtual ~ParameterBase() {} |
| 119 |
|
bool isOptional() {return optional_;} |
| 120 |
|
void setOptional(bool optional) {optional_ = optional;} |
| 121 |
|
bool hasDefaultValue() {return defaultValue_;} |
| 126 |
|
virtual bool setData(std::string) = 0; |
| 127 |
|
virtual bool setData(int) = 0; |
| 128 |
|
virtual bool setData(double) = 0; |
| 129 |
< |
virtual char* getParamType() = 0; |
| 129 |
> |
virtual std::string getParamType() = 0; |
| 130 |
|
protected: |
| 131 |
|
std::string keyword_; |
| 132 |
|
bool optional_; |
| 152 |
|
return internalSetData<double>(dval); |
| 153 |
|
} |
| 154 |
|
|
| 155 |
< |
virtual char* getParamType() { return ParameterTraits<ParamType>::getParamType();} |
| 155 |
> |
virtual std::string getParamType() { return ParameterTraits<ParamType>::getParamType();} |
| 156 |
|
private: |
| 157 |
|
template<class T> bool internalSetData(T data) { |
| 158 |
|
ParamType tmp; |