GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/options/options_handler.h Lines: 3 14 21.4 %
Date: 2021-08-17 Branches: 1 60 1.7 %

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 <sstream>
23
#include <string>
24
25
#include "options/bv_options.h"
26
#include "options/decision_options.h"
27
#include "options/language.h"
28
#include "options/managed_streams.h"
29
#include "options/option_exception.h"
30
#include "options/printer_modes.h"
31
#include "options/quantifiers_options.h"
32
33
namespace cvc5 {
34
35
class Options;
36
37
namespace options {
38
39
/**
40
 * Class that responds to command line options being set.
41
 *
42
 * Most functions can throw an OptionException on failure.
43
 */
44
class OptionsHandler {
45
public:
46
  OptionsHandler(Options* options);
47
48
  template <typename T>
49
2
  void checkMinimum(const std::string& option,
50
                    const std::string& flag,
51
                    T value,
52
                    T minimum) const
53
  {
54
2
    if (value < minimum)
55
    {
56
      std::stringstream ss;
57
      ss << flag << " = " << value
58
         << " is not a legal setting, value should be at least " << minimum
59
         << ".";
60
      throw OptionException(ss.str());
61
    }
62
2
  }
63
  template <typename T>
64
  void checkMaximum(const std::string& option,
65
                    const std::string& flag,
66
                    T value,
67
                    T maximum) const
68
  {
69
    if (value > maximum)
70
    {
71
      std::stringstream ss;
72
      ss << flag << " = " << value
73
         << " is not a legal setting, value should be at most " << maximum
74
         << ".";
75
      throw OptionException(ss.str());
76
    }
77
  }
78
79
  // theory/quantifiers/options_handlers.h
80
  void checkInstWhenMode(const std::string& option,
81
                         const std::string& flag,
82
                         InstWhenMode mode);
83
84
  // theory/bv/options_handlers.h
85
  void abcEnabledBuild(const std::string& option,
86
                       const std::string& flag,
87
                       bool value);
88
  void abcEnabledBuild(const std::string& option,
89
                       const std::string& flag,
90
                       const std::string& value);
91
92
  void checkBvSatSolver(const std::string& option,
93
                        const std::string& flag,
94
                        SatSolverMode m);
95
  void checkBitblastMode(const std::string& option,
96
                         const std::string& flag,
97
                         BitblastMode m);
98
99
  void setBitblastAig(const std::string& option,
100
                      const std::string& flag,
101
                      bool arg);
102
103
  // printer/options_handlers.h
104
  InstFormatMode stringToInstFormatMode(const std::string& option,
105
                                        const std::string& flag,
106
                                        const std::string& optarg);
107
108
  /**
109
   * Throws a ModalException if this option is being set after final
110
   * initialization.
111
   */
112
  void setProduceAssertions(const std::string& option,
113
                            const std::string& flag,
114
                            bool value);
115
116
  void setStats(const std::string& option, const std::string& flag, bool value);
117
118
  uint64_t limitHandler(const std::string& option,
119
                        const std::string& flag,
120
                        const std::string& optarg);
121
  void setResourceWeight(const std::string& option,
122
                         const std::string& flag,
123
                         const std::string& optarg);
124
125
  /* expr/options_handlers.h */
126
  void setDefaultExprDepth(const std::string& option,
127
                           const std::string& flag,
128
                           int depth);
129
  void setDefaultDagThresh(const std::string& option,
130
                           const std::string& flag,
131
                           int dag);
132
133
  /* main/options_handlers.h */
134
  void copyright(const std::string& option, const std::string& flag);
135
  void showConfiguration(const std::string& option, const std::string& flag);
136
  void showDebugTags(const std::string& option, const std::string& flag);
137
  void showTraceTags(const std::string& option, const std::string& flag);
138
  void threadN(const std::string& option, const std::string& flag);
139
140
  /* options/base_options_handlers.h */
141
  void setDumpStream(const std::string& option,
142
                     const std::string& flag,
143
                     const ManagedOut& mo);
144
  void setErrStream(const std::string& option,
145
                    const std::string& flag,
146
                    const ManagedErr& me);
147
  void setInStream(const std::string& option,
148
                   const std::string& flag,
149
                   const ManagedIn& mi);
150
  void setOutStream(const std::string& option,
151
                    const std::string& flag,
152
                    const ManagedOut& mo);
153
  void setVerbosity(const std::string& option,
154
                    const std::string& flag,
155
                    int value);
156
  void increaseVerbosity(const std::string& option, const std::string& flag);
157
  void decreaseVerbosity(const std::string& option, const std::string& flag);
158
  OutputLanguage stringToOutputLanguage(const std::string& option,
159
                                        const std::string& flag,
160
                                        const std::string& optarg);
161
  InputLanguage stringToInputLanguage(const std::string& option,
162
                                      const std::string& flag,
163
                                      const std::string& optarg);
164
  void enableTraceTag(const std::string& option,
165
                      const std::string& flag,
166
                      const std::string& optarg);
167
  void enableDebugTag(const std::string& option,
168
                      const std::string& flag,
169
                      const std::string& optarg);
170
171
  void enableOutputTag(const std::string& option,
172
                       const std::string& flag,
173
                       const std::string& optarg);
174
175
  void setDumpMode(const std::string& option,
176
                   const std::string& flag,
177
                   const std::string& optarg);
178
  void setPrintSuccess(const std::string& option,
179
                       const std::string& flag,
180
                       bool value);
181
182
 private:
183
184
  /** Pointer to the containing Options object.*/
185
  Options* d_options;
186
187
  /* Help strings */
188
  static const std::string s_instFormatHelp;
189
190
}; /* class OptionHandler */
191
192
}  // namespace options
193
}  // namespace cvc5
194
195
#endif /*  CVC5__OPTIONS__OPTIONS_HANDLER_H */