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

#include <Options.h>

Inheritance diagram for Minisat::IntOption:
Collaboration diagram for Minisat::IntOption:

Public Member Functions

 IntOption (const char *c, const char *n, const char *d, int32_t def=int32_t(), IntRange r=IntRange(INT32_MIN, INT32_MAX))
 
 operator int32_t (void) const
 
 operator int32_t & (void)
 
IntOptionoperator= (int32_t 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

IntRange range
 
int32_t 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 183 of file Options.h.

Constructor & Destructor Documentation

◆ IntOption()

Minisat::IntOption::IntOption ( const char * c,
const char * n,
const char * d,
int32_t def = int32_t(),
IntRange r = IntRange(INT32_MININT32_MAX) )
inline

Definition at line 190 of file Options.h.

191 : Option(n, d, c, "<int32>"), range(r), value(def) {}
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::IntOption::help ( bool verbose = false)
inlinevirtual

Implements Minisat::Option.

Definition at line 220 of file Options.h.

220 {
221 fprintf(stderr, " -%-12s = %-8s [", name, type_name);
222 if (range.begin == INT32_MIN)
223 fprintf(stderr, "imin");
224 else
225 fprintf(stderr, "%4d", range.begin);
226
227 fprintf(stderr, " .. ");
228 if (range.end == INT32_MAX)
229 fprintf(stderr, "imax");
230 else
231 fprintf(stderr, "%4d", range.end);
232
233 fprintf(stderr, "] (default: %d)\n", value);
234 if (verbose){
235 fprintf(stderr, "\n %s\n", description);
236 fprintf(stderr, "\n");
237 }
238 }
#define INT32_MAX
Definition pstdint.h:415
#define INT32_MIN
Definition pstdint.h:418
const char * name
Definition Options.h:53
const char * type_name
Definition Options.h:56
const char * description
Definition Options.h:54

◆ operator int32_t()

Minisat::IntOption::operator int32_t ( void ) const
inline

Definition at line 193 of file Options.h.

193{ return value; }

◆ operator int32_t &()

Minisat::IntOption::operator int32_t & ( void )
inline

Definition at line 194 of file Options.h.

194{ return value; }

◆ operator=()

IntOption & Minisat::IntOption::operator= ( int32_t x)
inline

Definition at line 195 of file Options.h.

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

◆ parse()

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

Implements Minisat::Option.

Definition at line 197 of file Options.h.

197 {
198 const char* span = str;
199
200 if (!match(span, "-") || !match(span, name) || !match(span, "="))
201 return false;
202
203 char* end;
204 int32_t tmp = strtol(span, &end, 10);
205
206 if (end == NULL)
207 return false;
208 else if (tmp > range.end){
209 fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name);
210 exit(1);
211 }else if (tmp < range.begin){
212 fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name);
213 exit(1); }
214
215 value = tmp;
216
217 return true;
218 }
VOID_HACK exit()
Here is the call graph for this function:

Member Data Documentation

◆ range

IntRange Minisat::IntOption::range
protected

Definition at line 186 of file Options.h.

◆ value

int32_t Minisat::IntOption::value
protected

Definition at line 187 of file Options.h.


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