#include <Options.h>
|
| | DoubleOption (const char *c, const char *n, const char *d, double def=double(), DoubleRange r=DoubleRange(-HUGE_VAL, false, HUGE_VAL, false)) |
| |
| | operator double (void) const |
| |
| | operator double & (void) |
| |
| DoubleOption & | operator= (double x) |
| |
| virtual bool | parse (const char *str) |
| |
| virtual void | help (bool verbose=false) |
| |
| | Option (const char *name_, const char *desc_, const char *cate_, const char *type_) |
| |
| virtual | ~Option () |
| |
Definition at line 125 of file Options.h.
◆ DoubleOption()
Definition at line 132 of file Options.h.
134
135 }
Option(const char *name_, const char *desc_, const char *cate_, const char *type_)
◆ help()
| virtual void Gluco2::DoubleOption::help |
( |
bool | verbose = false | ) |
|
|
inlinevirtual |
Implements Gluco2::Option.
Definition at line 165 of file Options.h.
165 {
166 fprintf(stderr, " -%-12s = %-8s %c%4.2g .. %4.2g%c (default: %g)\n",
168 range.begin_inclusive ?
'[' :
'(',
171 range.end_inclusive ?
']' :
')',
173 if (verbose){
175 fprintf(stderr, "\n");
176 }
177 }
◆ operator double()
| Gluco2::DoubleOption::operator double |
( |
void | | ) |
const |
|
inline |
◆ operator double &()
| Gluco2::DoubleOption::operator double & |
( |
void | | ) |
|
|
inline |
◆ operator=()
◆ parse()
| virtual bool Gluco2::DoubleOption::parse |
( |
const char * | str | ) |
|
|
inlinevirtual |
Implements Gluco2::Option.
Definition at line 141 of file Options.h.
141 {
142 const char* span = str;
143
144 if (!match(span,
"-") || !match(span,
name) || !match(span,
"="))
145 return false;
146
147 char* end;
148 double tmp = strtod(span, &end);
149
150 if (end == NULL)
151 return false;
152 else if (tmp >=
range.end && (!
range.end_inclusive || tmp !=
range.end)){
153 fprintf(stderr,
"ERROR! value <%s> is too large for option \"%s\".\n", span,
name);
155 }
else if (tmp <=
range.begin && (!
range.begin_inclusive || tmp !=
range.begin)){
156 fprintf(stderr,
"ERROR! value <%s> is too small for option \"%s\".\n", span,
name);
158
160
161
162 return true;
163 }
◆ range
◆ value
| double Gluco2::DoubleOption::value |
|
protected |
The documentation for this class was generated from the following file: