34 return &global_params;
58 if (line[0] !=
'\r' && line[0] !=
'\n' && line[0] !=
'#') {
60 for (valptr = line; *valptr && *valptr !=
' ' && *valptr !=
'\t';
66 while (*valptr ==
' ' || *valptr ==
'\t');
68 foundit =
SetParam(line, valptr, constraint, member_params);
72 tprintf(
"Warning: Parameter not found: %s\n", line);
83 auto *sp = FindParam<StringParam>(name,
GlobalParams()->string_params,
85 if (sp !=
nullptr && sp->constraint_ok(constraint)) sp->set_value(value);
86 if (*value ==
'\0')
return (sp !=
nullptr);
89 auto *ip = FindParam<IntParam>(name,
GlobalParams()->int_params,
91 if (ip && ip->constraint_ok(constraint)) {
93 std::stringstream stream(value);
94 stream.imbue(std::locale::classic());
96 if (intval != INT_MIN) {
97 ip->set_value(intval);
102 auto *bp = FindParam<BoolParam>(name,
GlobalParams()->bool_params,
104 if (bp !=
nullptr && bp->constraint_ok(constraint)) {
105 if (*value ==
'T' || *value ==
't' ||
106 *value ==
'Y' || *value ==
'y' || *value ==
'1') {
108 }
else if (*value ==
'F' || *value ==
'f' ||
109 *value ==
'N' || *value ==
'n' || *value ==
'0') {
110 bp->set_value(
false);
115 auto *dp = FindParam<DoubleParam>(name,
GlobalParams()->double_params,
117 if (dp !=
nullptr && dp->constraint_ok(constraint)) {
118 double doubleval = NAN;
119 std::stringstream stream(value);
120 stream.imbue(std::locale::classic());
122 if (!std::isnan(doubleval)) {
123 dp->set_value(doubleval);
126 return (sp || ip || bp || dp);
133 auto *sp = FindParam<StringParam>(name,
GlobalParams()->string_params,
136 *value = sp->
c_str();
140 auto *ip = FindParam<IntParam>(name,
GlobalParams()->int_params,
144 snprintf(buf,
sizeof(buf),
"%d", int32_t(*ip));
149 auto *bp = FindParam<BoolParam>(name,
GlobalParams()->bool_params,
152 *value = bool(*bp) ?
"1":
"0";
156 auto *dp = FindParam<DoubleParam>(name,
GlobalParams()->double_params,
159 std::ostringstream stream;
160 stream.imbue(std::locale::classic());
161 stream << double(*dp);
162 *value = stream.str().
c_str();
169 int num_iterations = (member_params ==
nullptr) ? 1 : 2;
170 std::ostringstream stream;
171 stream.imbue(std::locale::classic());
172 for (
int v = 0; v < num_iterations; ++v) {
174 for (
int i = 0; i < vec->
int_params.size(); ++i) {
175 stream << vec->
int_params[i]->name_str() <<
'\t' <<
179 for (
int i = 0; i < vec->
bool_params.size(); ++i) {
180 stream << vec->
bool_params[i]->name_str() <<
'\t' <<
195 fprintf(fp,
"%s", stream.str().c_str());
201 int num_iterations = (member_params ==
nullptr) ? 1 : 2;
202 for (v = 0; v < num_iterations; ++v) {
204 for (i = 0; i < vec->
int_params.size(); ++i) {