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

#include <Options.h>

Inheritance diagram for Gluco::Int64Option:
Collaboration diagram for Gluco::Int64Option:

Public Member Functions

 Int64Option (const char *c, const char *n, const char *d, int64_t def=int64_t(), Int64Range r=Int64Range(INT64_MIN, INT64_MAX))
 
 operator int64_t (void) const
 
 operator int64_t & (void)
 
Int64Optionoperator= (int64_t x)
 
virtual bool parse (const char *str)
 
virtual void help (bool verbose=false)
 
- Public Member Functions inherited from Gluco::Option
 Option (const char *name_, const char *desc_, const char *cate_, const char *type_)
 
virtual ~Option ()
 

Protected Attributes

Int64Range range
 
int64_t value
 

Additional Inherited Members

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

Detailed Description

Definition at line 247 of file Options.h.

Constructor & Destructor Documentation

◆ Int64Option()

Gluco::Int64Option::Int64Option ( const char * c,
const char * n,
const char * d,
int64_t def = int64_t(),
Int64Range r = Int64Range(INT64_MIN, INT64_MAX) )
inline

Definition at line 254 of file Options.h.

255 : Option(n, d, c, "<int64>"), range(r), value(def) {}
Int64Range range
Definition Options.h:250
Option(const char *name_, const char *desc_, const char *cate_, const char *type_)
Definition Options.h:71
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ help()

virtual void Gluco::Int64Option::help ( bool verbose = false)
inlinevirtual

Implements Gluco::Option.

Definition at line 284 of file Options.h.

284 {
285 fprintf(stderr, " -%-12s = %-8s [", name, type_name);
286 if (range.begin == INT64_MIN)
287 fprintf(stderr, "imin");
288 else
289 fprintf(stderr, "%4d", (int)range.begin);
290
291 fprintf(stderr, " .. ");
292 if (range.end == INT64_MAX)
293 fprintf(stderr, "imax");
294 else
295 fprintf(stderr, "%4d", (int)range.end);
296
297 fprintf(stderr, "] (default: %d)\n", (int)value);
298 if (verbose){
299 fprintf(stderr, "\n %s\n", description);
300 fprintf(stderr, "\n");
301 }
302 }
const char * name
Definition Options.h:55
const char * description
Definition Options.h:56
const char * type_name
Definition Options.h:58

◆ operator int64_t()

Gluco::Int64Option::operator int64_t ( void ) const
inline

Definition at line 257 of file Options.h.

257{ return value; }

◆ operator int64_t &()

Gluco::Int64Option::operator int64_t & ( void )
inline

Definition at line 258 of file Options.h.

258{ return value; }

◆ operator=()

Int64Option & Gluco::Int64Option::operator= ( int64_t x)
inline

Definition at line 259 of file Options.h.

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

◆ parse()

virtual bool Gluco::Int64Option::parse ( const char * str)
inlinevirtual

Implements Gluco::Option.

Definition at line 261 of file Options.h.

261 {
262 const char* span = str;
263
264 if (!match(span, "-") || !match(span, name) || !match(span, "="))
265 return false;
266
267 char* end;
268 int64_t tmp = strtoll(span, &end, 10);
269
270 if (end == NULL)
271 return false;
272 else if (tmp > range.end){
273 fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name);
274 exit(1);
275 }else if (tmp < range.begin){
276 fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name);
277 exit(1); }
278
279 value = tmp;
280
281 return true;
282 }
VOID_HACK exit()
Here is the call graph for this function:

Member Data Documentation

◆ range

Int64Range Gluco::Int64Option::range
protected

Definition at line 250 of file Options.h.

◆ value

int64_t Gluco::Int64Option::value
protected

Definition at line 251 of file Options.h.


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