215 using RepType = std::pair<int, int>;
218 static bool convert(T, RepType&) {
223 static RepType convert(T v) {
229 static bool convert(RepType v, RepType& r) {
234 static bool convert(std::string v, RepType& r) {
239 r = std::make_pair(atom1, atom2);
242 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
243 "ParameterManager Error: "
244 "Incorrect number of tokens to make a pair!\n");
245 painCave.severity = OPENMD_ERROR;
246 painCave.isFatal = 1;
252 static std::string getParamType() {
return "std::pair<int, int>"; }
257 using RepType = std::vector<RealType>;
260 static bool convert(T, RepType&) {
265 static RepType convert(T v) {
271 static bool convert(RepType v, RepType& r) {
276 static bool convert(std::string v, RepType& r) {
277 std::cerr <<
"calling tokenizer\n";
280 r = std::vector<RealType>(size, 0.0);
281 for (
unsigned int i = 0; i < size; i++) {
288 static std::string getParamType() {
return "std::vector<RealType>"; }
294 keyword_(), optional_(
false), defaultValue_(
false), empty_(
true) {}
296 bool isOptional() {
return optional_; }
297 void setOptional(
bool optional) { optional_ = optional; }
298 bool hasDefaultValue() {
return defaultValue_; }
299 virtual bool isValid() {
return true; }
300 const std::string& getKeyword() {
return keyword_; }
301 void setKeyword(
const std::string& keyword) { keyword_ = keyword; }
302 bool empty() {
return empty_; }
303 virtual bool setData(std::string) = 0;
304 virtual bool setData(
int) = 0;
305 virtual bool setData(
unsigned long int) = 0;
306 virtual bool setData(RealType) = 0;
307 virtual bool setData(std::pair<int, int>) = 0;
308 virtual bool setData(std::vector<RealType>) = 0;
309 virtual std::string getParamType() = 0;
312 std::string keyword_;
323 void setDefaultValue(
const ParamType& value) {
325 defaultValue_ =
true;
328 ParamType getData() {
return data_; }
330 virtual bool setData(std::string sval) {
331 return internalSetData<std::string>(sval);
333 virtual bool setData(
int ival) {
return internalSetData<int>(ival); }
334 virtual bool setData(
unsigned long int lival) {
335 return internalSetData<unsigned long int>(lival);
337 virtual bool setData(RealType dval) {
338 return internalSetData<RealType>(dval);
340 virtual bool setData(std::pair<int, int> pval) {
341 return internalSetData<std::pair<int, int>>(pval);
343 virtual bool setData(std::vector<RealType> pval) {
344 return internalSetData<std::vector<RealType>>(pval);
347 virtual std::string getParamType() {
353 bool internalSetData(T data) {
355 bool result = ValueType::convert(data, tmp);