ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
Minisat::DoubleOption Class Reference

#include <Options.h>

Inheritance diagram for Minisat::DoubleOption:
Collaboration diagram for Minisat::DoubleOption:

Public Member Functions

 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)
 
DoubleOptionoperator= (double x)
 
virtual bool parse (const char *str)
 
virtual void help (bool verbose=false)
 
- Public Member Functions inherited from Minisat::Option
 Option (const char *name_, const char *desc_, const char *cate_, const char *type_)
 
virtual ~Option ()
 

Protected Attributes

DoubleRange range
 
double value
 

Additional Inherited Members

- Static Public Member Functions inherited from Minisat::Option
static vec< Option * > & getOptionList ()
 
static const char *& getUsageString ()
 
static const char *& getHelpPrefixString ()
 
- Public Attributes inherited from Minisat::Option
const char * name
 
const char * description
 
const char * category
 
const char * type_name
 

Detailed Description

Definition at line 123 of file Options.h.

Constructor & Destructor Documentation

◆ DoubleOption()

Minisat::DoubleOption::DoubleOption ( const char * c,
const char * n,
const char * d,
double def = double(),
DoubleRange r = DoubleRange(-HUGE_VALfalseHUGE_VALfalse) )
inline

Definition at line 130 of file Options.h.

131 : Option(n, d, c, "<double>"), range(r), value(def) {
132 // FIXME: set LC_NUMERIC to "C" to make sure that strtof/strtod parses decimal point correctly.
133 }
DoubleRange range
Definition Options.h:126
Option(const char *name_, const char *desc_, const char *cate_, const char *type_)
Definition Options.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ help()

virtual void Minisat::DoubleOption::help ( bool verbose = false)
inlinevirtual

Implements Minisat::Option.

Definition at line 163 of file Options.h.

163 {
164 fprintf(stderr, " -%-12s = %-8s %c%4.2g .. %4.2g%c (default: %g)\n",
165 name, type_name,
166 range.begin_inclusive ? '[' : '(',
167 range.begin,
168 range.end,
169 range.end_inclusive ? ']' : ')',
170 value);
171 if (verbose){
172 fprintf(stderr, "\n %s\n", description);
173 fprintf(stderr, "\n");
174 }
175 }
const char * name
Definition Options.h:53
const char * type_name
Definition Options.h:56
const char * description
Definition Options.h:54

◆ operator double()

Minisat::DoubleOption::operator double ( void ) const
inline

Definition at line 135 of file Options.h.

135{ return value; }

◆ operator double &()

Minisat::DoubleOption::operator double & ( void )
inline

Definition at line 136 of file Options.h.

136{ return value; }

◆ operator=()

DoubleOption & Minisat::DoubleOption::operator= ( double x)
inline

Definition at line 137 of file Options.h.

137{ value = x; return *this; }
Here is the call graph for this function:

◆ parse()

virtual bool Minisat::DoubleOption::parse ( const char * str)
inlinevirtual

Implements Minisat::Option.

Definition at line 139 of file Options.h.

139 {
140 const char* span = str;
141
142 if (!match(span, "-") || !match(span, name) || !match(span, "="))
143 return false;
144
145 char* end;
146 double tmp = strtod(span, &end);
147
148 if (end == NULL)
149 return false;
150 else if (tmp >= range.end && (!range.end_inclusive || tmp != range.end)){
151 fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name);
152 exit(1);
153 }else if (tmp <= range.begin && (!range.begin_inclusive || tmp != range.begin)){
154 fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name);
155 exit(1); }
156
157 value = tmp;
158 // fprintf(stderr, "READ VALUE: %g\n", value);
159
160 return true;
161 }
VOID_HACK exit()
Here is the call graph for this function:

Member Data Documentation

◆ range

DoubleRange Minisat::DoubleOption::range
protected

Definition at line 126 of file Options.h.

◆ value

double Minisat::DoubleOption::value
protected

Definition at line 127 of file Options.h.


The documentation for this class was generated from the following file: