GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/options/options_handler.h Lines: 0 14 0.0 %
Date: 2021-08-01 Branches: 0 42 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 <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/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
  template <typename T>
48
  void geqZero(const std::string& option,
49
               const std::string& flag,
50
               T value) const
51
  {
52
    if (value < 0)
53
    {
54
      std::stringstream ss;
55
      ss << flag << ": " << value << " is not a legal setting, should be "
56
         << value << " >= 0.";
57
      throw OptionException(ss.str());
58
    }
59
  }
60
  template <typename T>
61
  void betweenZeroAndOne(const std::string& option,
62
                         const std::string& flag,
63
                         T value) const
64
  {
65
    if (value < 0 || value > 1)
66
    {
67
      std::stringstream ss;
68
      ss << flag << ": " << value
69
         << " is not a legal setting, should be 0 <= " << flag << " <= 1.";
70
      throw OptionException(ss.str());
71
    }
72
  }
73
74
  // theory/quantifiers/options_handlers.h
75
  void checkInstWhenMode(const std::string& option,
76
                         const std::string& flag,
77
                         InstWhenMode mode);
78
79
  // theory/bv/options_handlers.h
80
  void abcEnabledBuild(const std::string& option,
81
                       const std::string& flag,
82
                       bool value);
83
  void abcEnabledBuild(const std::string& option,
84
                       const std::string& flag,
85
                       const std::string& value);
86
87
  void checkBvSatSolver(const std::string& option,
88
                        const std::string& flag,
89
                        SatSolverMode m);
90
  void checkBitblastMode(const std::string& option,
91
                         const std::string& flag,
92
                         BitblastMode m);
93
94
  void setBitblastAig(const std::string& option,
95
                      const std::string& flag,
96
                      bool arg);
97
98
  // printer/options_handlers.h
99
  InstFormatMode stringToInstFormatMode(const std::string& option,
100
                                        const std::string& flag,
101
                                        const std::string& optarg);
102
103
  /**
104
   * Throws a ModalException if this option is being set after final
105
   * initialization.
106
   */
107
  void setProduceAssertions(const std::string& option,
108
                            const std::string& flag,
109
                            bool value);
110
111
  void setStats(const std::string& option, const std::string& flag, bool value);
112
113
  uint64_t limitHandler(const std::string& option,
114
                        const std::string& flag,
115
                        const std::string& optarg);
116
  void setResourceWeight(const std::string& option,
117
                         const std::string& flag,
118
                         const std::string& optarg);
119
120
  /* expr/options_handlers.h */
121
  void setDefaultExprDepthPredicate(const std::string& option,
122
                                    const std::string& flag,
123
                                    int depth);
124
  void setDefaultDagThreshPredicate(const std::string& option,
125
                                    const std::string& flag,
126
                                    int dag);
127
128
  /* main/options_handlers.h */
129
  void copyright(const std::string& option, const std::string& flag);
130
  void showConfiguration(const std::string& option, const std::string& flag);
131
  void showDebugTags(const std::string& option, const std::string& flag);
132
  void showTraceTags(const std::string& option, const std::string& flag);
133
  void threadN(const std::string& option, const std::string& flag);
134
135
  /* options/base_options_handlers.h */
136
  void setVerbosity(const std::string& option,
137
                    const std::string& flag,
138
                    int value);
139
  void increaseVerbosity(const std::string& option, const std::string& flag);
140
  void decreaseVerbosity(const std::string& option, const std::string& flag);
141
  OutputLanguage stringToOutputLanguage(const std::string& option,
142
                                        const std::string& flag,
143
                                        const std::string& optarg);
144
  InputLanguage stringToInputLanguage(const std::string& option,
145
                                      const std::string& flag,
146
                                      const std::string& optarg);
147
  void enableTraceTag(const std::string& option,
148
                      const std::string& flag,
149
                      const std::string& optarg);
150
  void enableDebugTag(const std::string& option,
151
                      const std::string& flag,
152
                      const std::string& optarg);
153
154
  void enableOutputTag(const std::string& option,
155
                       const std::string& flag,
156
                       const std::string& optarg);
157
158
 private:
159
160
  /** Pointer to the containing Options object.*/
161
  Options* d_options;
162
163
  /* Help strings */
164
  static const std::string s_instFormatHelp;
165
166
}; /* class OptionHandler */
167
168
}  // namespace options
169
}  // namespace cvc5
170
171
#endif /*  CVC5__OPTIONS__OPTIONS_HANDLER_H */