GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/options/options_handler.h Lines: 0 6 0.0 %
Date: 2021-05-22 Branches: 0 8 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Tim King, Mathias Preiner, Aina Niemetz
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * Interface for custom handlers and predicates options.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__OPTIONS__OPTIONS_HANDLER_H
19
#define CVC5__OPTIONS__OPTIONS_HANDLER_H
20
21
#include <ostream>
22
#include <string>
23
24
#include "options/base_handlers.h"
25
#include "options/bv_options.h"
26
#include "options/decision_options.h"
27
#include "options/language.h"
28
#include "options/option_exception.h"
29
#include "options/printer_modes.h"
30
#include "options/quantifiers_options.h"
31
32
namespace cvc5 {
33
34
class Options;
35
36
namespace options {
37
38
/**
39
 * Class that responds to command line options being set.
40
 *
41
 * Most functions can throw an OptionException on failure.
42
 */
43
class OptionsHandler {
44
public:
45
  OptionsHandler(Options* options);
46
47
  void unsignedGreater0(const std::string& option, unsigned value) {
48
    options::greater(0)(option, value);
49
  }
50
51
  void unsignedLessEqual2(const std::string& option, unsigned value) {
52
    options::less_equal(2)(option, value);
53
  }
54
55
  void doubleGreaterOrEqual0(const std::string& option, double value) {
56
    options::greater_equal(0.0)(option, value);
57
  }
58
59
  void doubleLessOrEqual1(const std::string& option, double value) {
60
    options::less_equal(1.0)(option, value);
61
  }
62
63
  // theory/quantifiers/options_handlers.h
64
  void checkInstWhenMode(std::string option, InstWhenMode mode);
65
66
  // theory/bv/options_handlers.h
67
  void abcEnabledBuild(std::string option, bool value);
68
  void abcEnabledBuild(std::string option, std::string value);
69
70
  template<class T> void checkSatSolverEnabled(std::string option, T m);
71
72
  void checkBvSatSolver(std::string option, SatSolverMode m);
73
  void checkBitblastMode(std::string option, BitblastMode m);
74
75
  void setBitblastAig(std::string option, bool arg);
76
77
  // printer/options_handlers.h
78
  InstFormatMode stringToInstFormatMode(std::string option, std::string optarg);
79
80
  // decision/options_handlers.h
81
  void setDecisionModeStopOnly(std::string option, DecisionMode m);
82
83
  /**
84
   * Throws a ModalException if this option is being set after final
85
   * initialization.
86
   */
87
  void setProduceAssertions(std::string option, bool value);
88
89
  void setStats(const std::string& option, bool value);
90
91
  unsigned long limitHandler(std::string option, std::string optarg);
92
  void setResourceWeight(std::string option, std::string optarg);
93
94
  /* expr/options_handlers.h */
95
  void setDefaultExprDepthPredicate(std::string option, int depth);
96
  void setDefaultDagThreshPredicate(std::string option, int dag);
97
98
  /* main/options_handlers.h */
99
  void copyright(std::string option);
100
  void showConfiguration(std::string option);
101
  void showDebugTags(std::string option);
102
  void showTraceTags(std::string option);
103
  void threadN(std::string option);
104
105
  /* options/base_options_handlers.h */
106
  void setVerbosity(std::string option, int value);
107
  void increaseVerbosity(std::string option);
108
  void decreaseVerbosity(std::string option);
109
  OutputLanguage stringToOutputLanguage(std::string option, std::string optarg);
110
  InputLanguage stringToInputLanguage(std::string option, std::string optarg);
111
  void enableTraceTag(std::string option, std::string optarg);
112
  void enableDebugTag(std::string option, std::string optarg);
113
114
 private:
115
116
  /** Pointer to the containing Options object.*/
117
  Options* d_options;
118
119
  /* Help strings */
120
  static const std::string s_instFormatHelp;
121
122
}; /* class OptionHandler */
123
124
template<class T>
125
void OptionsHandler::checkSatSolverEnabled(std::string option, T m)
126
{
127
#if !defined(CVC5_USE_CRYPTOMINISAT) && !defined(CVC5_USE_CADICAL) \
128
    && !defined(CVC5_USE_KISSAT)
129
  std::stringstream ss;
130
  ss << "option `" << option
131
     << "' requires cvc5 to be built with CryptoMiniSat or CaDiCaL or Kissat";
132
  throw OptionException(ss.str());
133
#endif
134
}
135
136
}  // namespace options
137
}  // namespace cvc5
138
139
#endif /*  CVC5__OPTIONS__OPTIONS_HANDLER_H */