| 44 |
|
* |
| 45 |
|
* Created by Charles F. Vardeman II on 11/15/05. |
| 46 |
|
* @author Charles F. Vardeman II |
| 47 |
< |
* @version $Id: OptionSectionParser.cpp,v 1.2 2005-11-16 23:10:02 tim Exp $ |
| 47 |
> |
* @version $Id: OptionSectionParser.cpp,v 1.3 2005-12-05 22:23:57 gezelter Exp $ |
| 48 |
|
* |
| 49 |
|
*/ |
| 50 |
|
|
| 55 |
|
#include "utils/StringUtils.hpp" |
| 56 |
|
namespace oopse { |
| 57 |
|
|
| 58 |
– |
bool ForceFieldOptions::setData(const std::string& keyword, const std::string& value) { |
| 59 |
– |
bool result; |
| 60 |
– |
ParamMap::iterator i =parameters_.find(keyword); |
| 61 |
– |
if (i != parameters_.end()) { |
| 62 |
– |
if(isType<int>(value)){ |
| 63 |
– |
int ival = lexi_cast<int>(value); |
| 64 |
– |
result = i->second->setData(ival); |
| 65 |
– |
} |
| 66 |
– |
else if (isType<double>(value)){ |
| 67 |
– |
double dval = lexi_cast<double>(value); |
| 68 |
– |
result = i->second->setData(dval); |
| 69 |
– |
} else{ |
| 70 |
– |
result = i->second->setData(value); |
| 71 |
– |
} |
| 72 |
– |
} else { |
| 73 |
– |
sprintf(painCave.errMsg, "%s is an unrecognized keyword\n", keyword.c_str() ); |
| 74 |
– |
painCave.isFatal = 0; |
| 75 |
– |
simError(); |
| 76 |
– |
} |
| 77 |
– |
|
| 78 |
– |
return result; |
| 79 |
– |
} |
| 80 |
– |
|
| 58 |
|
OptionSectionParser::OptionSectionParser(ForceFieldOptions& options) : options_(options) { |
| 59 |
|
setSectionName("Options"); |
| 60 |
|
} |