| 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.4 2008-09-11 19:40:59 gezelter Exp $ | 
| 47 | 
> | 
 *  @version $Id: ParameterManager.hpp,v 1.5 2008-10-22 20:01:49 gezelter Exp $ | 
| 48 | 
  | 
 * | 
| 49 | 
  | 
 */ | 
| 50 | 
  | 
 | 
| 64 | 
  | 
#include "utils/StringTokenizer.hpp" | 
| 65 | 
  | 
#include "utils/CaseConversion.hpp" | 
| 66 | 
  | 
 | 
| 67 | 
+ | 
 | 
| 68 | 
  | 
template<typename T>  | 
| 69 | 
  | 
struct ParameterTraits; | 
| 70 | 
  | 
 | 
| 110 | 
  | 
  static std::string getParamType() { return "int";}   | 
| 111 | 
  | 
}; | 
| 112 | 
  | 
 | 
| 113 | 
+ | 
//int    | 
| 114 | 
+ | 
template<> | 
| 115 | 
+ | 
struct ParameterTraits<unsigned long int>{ | 
| 116 | 
+ | 
  typedef unsigned long int RepType; | 
| 117 | 
+ | 
  template<typename T> static bool    convert(T, RepType&){return false;}  | 
| 118 | 
+ | 
  template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}  | 
| 119 | 
+ | 
  static bool convert(RepType v, RepType& r)            { r=v; return true;} | 
| 120 | 
+ | 
  static bool convert(int v, RepType& r)                {r = static_cast<unsigned long int>(v); return true;} | 
| 121 | 
+ | 
  static std::string getParamType() { return "unsigned long int";}   | 
| 122 | 
+ | 
}; | 
| 123 | 
+ | 
 | 
| 124 | 
  | 
//RealType | 
| 125 | 
  | 
template<>                      | 
| 126 | 
  | 
struct ParameterTraits<RealType>{ | 
| 129 | 
  | 
  template<typename T> static RepType convert(T v)        {RepType tmp; convert(v,tmp);return tmp;}  | 
| 130 | 
  | 
  static bool convert(RepType v, RepType& r)            {r=v; return true;} | 
| 131 | 
  | 
  static bool convert(int v, RepType& r)                {r = static_cast<RealType>(v); return true;} | 
| 132 | 
+ | 
  static bool convert(unsigned long int v, RepType& r)  {r = static_cast<RealType>(v); return true;} | 
| 133 | 
  | 
  static std::string getParamType() { return "RealType";}     | 
| 134 | 
  | 
}; | 
| 135 | 
  | 
 | 
| 174 | 
  | 
  bool empty() {return empty_;} | 
| 175 | 
  | 
  virtual bool setData(std::string) = 0; | 
| 176 | 
  | 
  virtual bool setData(int) = 0; | 
| 177 | 
+ | 
  virtual bool setData(unsigned long int) = 0; | 
| 178 | 
  | 
  virtual bool setData(RealType) = 0; | 
| 179 | 
  | 
  virtual bool setData(std::pair<int, int>) = 0; | 
| 180 | 
  | 
  virtual std::string getParamType() = 0; | 
| 181 | 
  | 
protected: | 
| 182 | 
< | 
    std::string keyword_; | 
| 182 | 
> | 
  std::string keyword_; | 
| 183 | 
  | 
  bool optional_; | 
| 184 | 
  | 
  bool defaultValue_; | 
| 185 | 
  | 
  bool empty_; | 
| 195 | 
  | 
  virtual bool setData(std::string sval) { | 
| 196 | 
  | 
    return internalSetData<std::string>(sval); | 
| 197 | 
  | 
  } | 
| 198 | 
+ | 
 | 
| 199 | 
  | 
  virtual bool setData(int ival) { | 
| 200 | 
  | 
    return internalSetData<int>(ival); | 
| 201 | 
  | 
  } | 
| 202 | 
+ | 
 | 
| 203 | 
+ | 
  virtual bool setData(unsigned long int lival) { | 
| 204 | 
+ | 
    return internalSetData<unsigned long int>(lival); | 
| 205 | 
+ | 
  } | 
| 206 | 
  | 
   | 
| 207 | 
  | 
  virtual bool setData(RealType dval) { | 
| 208 | 
  | 
    return internalSetData<RealType>(dval); |