CBMC
java_object_factory_parameters.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Poetzl
6 
7 \*******************************************************************/
8 
10 
11 #include <util/cmdline.h>
12 #include <util/exception_utils.h>
13 #include <util/options.h>
14 
16 {
18 
19  if(options.is_set("java-assume-inputs-interval"))
20  {
21  const auto &interval_string =
22  options.get_option("java-assume-inputs-interval");
23  auto interval = interval_uniont::of_string(interval_string);
24  if(!interval.has_value())
25  {
27  "argument must be a comma-seperated sequence of intervals of the form"
28  " [int:int], [int:] or [:int]",
29  "--java-assume-inputs-interval");
30  }
31  if(interval->is_empty())
32  {
34  "interval is empty, lower limit cannot be bigger than upper limit",
35  "--java-assume-inputs-interval");
36  }
38  }
39  assume_inputs_integral = options.is_set("java-assume-inputs-integral");
40 }
41 
43  const cmdlinet &cmdline,
44  optionst &options)
45 {
46  parse_object_factory_options(cmdline, options);
47 
48  if(cmdline.isset("java-assume-inputs-interval"))
49  {
50  options.set_option(
51  "java-assume-inputs-interval",
52  cmdline.get_value("java-assume-inputs-interval"));
53  }
54  if(cmdline.isset("java-assume-inputs-integral"))
55  {
56  options.set_option("java-assume-inputs-integral", true);
57  }
58 }
std::string get_value(char option) const
Definition: cmdline.cpp:48
virtual bool isset(char option) const
Definition: cmdline.cpp:30
static std::optional< interval_uniont > of_string(const std::string &to_parse)
Parse a string which is a comma , separated list of intervals of the form "[lower1:upper1]",...
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
bool is_set(const std::string &option) const
N.B. opts.is_set("foo") does not imply opts.get_bool_option("foo")
Definition: options.cpp:62
void set_option(const std::string &option, const bool value)
Definition: options.cpp:28
const std::string get_option(const std::string &option) const
Definition: options.cpp:67
void parse_java_object_factory_options(const cmdlinet &cmdline, optionst &options)
Parse the java object factory parameters from a given command line.
void parse_object_factory_options(const cmdlinet &cmdline, optionst &options)
Parse the object factory parameters from a given command line.
Options.
interval_uniont assume_inputs_interval
Force numerical primitive inputs to fall within the interval.
bool assume_inputs_integral
Force double and float inputs to be integral.
void set(const optionst &)
Assigns the parameters from given options.
void set(const optionst &)
Assigns the parameters from given options.