# | Line 44 | Line 44 | |
---|---|---|
44 | * | |
45 | * Created by Charles F. Vardeman II on 11/16/05. | |
46 | * @author Charles F. Vardeman II | |
47 | < | * @version $Id: ParameterManager.hpp,v 1.2 2005-12-16 18:55:55 tim Exp $ |
47 | > | * @version $Id: ParameterManager.hpp,v 1.3 2006-05-17 21:51:42 tim Exp $ |
48 | * | |
49 | */ | |
50 | ||
# | Line 57 | Line 57 | |
57 | #include <vector> | |
58 | #include <string> | |
59 | #include <map> | |
60 | + | #include "config.h" |
61 | ||
62 | ||
62 | – | |
63 | #include "utils/CaseConversion.hpp" | |
64 | ||
65 | ||
# | Line 109 | Line 109 | struct ParameterTraits<int>{ | |
109 | static std::string getParamType() { return "int";} | |
110 | }; | |
111 | ||
112 | < | //double |
112 | > | //RealType |
113 | template<> | |
114 | < | struct ParameterTraits<double>{ |
115 | < | typedef double RepType; |
114 | > | struct ParameterTraits<RealType>{ |
115 | > | typedef RealType RepType; |
116 | template<typename T> static bool convert(T, RepType&){return false;} | |
117 | template<typename T> static RepType convert(T v) {RepType tmp; convert(v,tmp);return tmp;} | |
118 | static bool convert(RepType v, RepType& r) {r=v; return true;} | |
119 | < | static bool convert(int v, RepType& r) {r = static_cast<double>(v); return true;} |
120 | < | static std::string getParamType() { return "double";} |
119 | > | static bool convert(int v, RepType& r) {r = static_cast<RealType>(v); return true;} |
120 | > | static std::string getParamType() { return "RealType";} |
121 | }; | |
122 | ||
123 | ||
# | Line 134 | Line 134 | class ParameterBase { (public) | |
134 | bool empty() {return empty_;} | |
135 | virtual bool setData(std::string) = 0; | |
136 | virtual bool setData(int) = 0; | |
137 | < | virtual bool setData(double) = 0; |
137 | > | virtual bool setData(RealType) = 0; |
138 | virtual std::string getParamType() = 0; | |
139 | protected: | |
140 | std::string keyword_; | |
# | Line 157 | Line 157 | class Parameter : public ParameterBase{ (public) | |
157 | return internalSetData<int>(ival); | |
158 | } | |
159 | ||
160 | < | virtual bool setData(double dval) { |
161 | < | return internalSetData<double>(dval); |
160 | > | virtual bool setData(RealType dval) { |
161 | > | return internalSetData<RealType>(dval); |
162 | } | |
163 | ||
164 | virtual std::string getParamType() { return ParameterTraits<ParamType>::getParamType();} |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |