CBMC
goto_harness_generator_factory.h
Go to the documentation of this file.
1 /******************************************************************\
2 
3 Module: goto_harness_generator_factory
4 
5 Author: Diffblue Ltd.
6 
7 \******************************************************************/
8 
9 #ifndef CPROVER_GOTO_HARNESS_GOTO_HARNESS_GENERATOR_FACTORY_H
10 #define CPROVER_GOTO_HARNESS_GOTO_HARNESS_GENERATOR_FACTORY_H
11 
12 #include <functional>
13 #include <list>
14 #include <map>
15 #include <memory>
16 #include <string>
17 
18 class goto_harness_generatort; // IWYU pragma: keep
19 class goto_modelt;
20 
21 #define GOTO_HARNESS_GENERATOR_TYPE_OPT "harness-type"
22 #define GOTO_HARNESS_GENERATOR_HARNESS_FUNCTION_NAME_OPT "harness-function-name"
23 
24 // clang-format off
25 #define GOTO_HARNESS_FACTORY_OPTIONS \
26  "(" GOTO_HARNESS_GENERATOR_TYPE_OPT "):" \
27  "(" GOTO_HARNESS_GENERATOR_HARNESS_FUNCTION_NAME_OPT "):" \
28 // end GOTO_HARNESS_FACTORY_OPTIONS
29 
30 // clang-format on
31 
34 {
35 public:
38  std::function<std::unique_ptr<goto_harness_generatort>()>;
39 
40  using generator_optionst = std::map<std::string, std::list<std::string>>;
41 
45  void register_generator(
46  std::string generator_name,
47  build_generatort build_generator);
48 
51  std::unique_ptr<goto_harness_generatort> factory(
52  const std::string &generator_name,
53  const generator_optionst &generator_options,
54  const goto_modelt &goto_model);
55 
56 private:
57  std::map<std::string, build_generatort> generators;
58 };
59 
60 #endif // CPROVER_GOTO_HARNESS_GOTO_HARNESS_GENERATOR_FACTORY_H
helper to select harness type by name.
std::map< std::string, build_generatort > generators
std::map< std::string, std::list< std::string > > generator_optionst
std::function< std::unique_ptr< goto_harness_generatort >()> build_generatort
the type of a function that produces a goto-harness generator.
std::unique_ptr< goto_harness_generatort > factory(const std::string &generator_name, const generator_optionst &generator_options, const goto_modelt &goto_model)
return a generator matching the generator name.
void register_generator(std::string generator_name, build_generatort build_generator)
register a new goto-harness generator with the given name.