summaryrefslogtreecommitdiff
path: root/src/smt/options_manager.h
blob: 62ad37eb080274592dc1ead2ba78f30a3808aa4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*********************                                                        */
/*! \file options_manager.h
 ** \verbatim
 ** Top contributors (to current version):
 **   Andrew Reynolds, Tim King, Gereon Kremer
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 ** in the top-level source directory and their institutional affiliations.
 ** All rights reserved.  See the file COPYING in the top-level source
 ** directory for licensing information.\endverbatim
 **
 ** \brief Module for managing options of an SmtEngine.
 **/

#ifndef CVC4__SMT__OPTIONS_MANAGER_H
#define CVC4__SMT__OPTIONS_MANAGER_H

#include "options/options_listener.h"
#include "smt/managed_ostreams.h"

namespace cvc5 {

class LogicInfo;
class Options;
class ResourceManager;
class SmtEngine;

namespace smt {

/**
 * This class is intended to be used by SmtEngine, and is responsible for:
 * (1) Implementing core options including timeouts and output preferences,
 * (2) Setting default values for options based on a logic.
 *
 * Notice that the constructor of this class retroactively sets all
 * necessary options that have already been set in the options object it is
 * given. This is to ensure that the command line arguments, which modified
 * on an options object in the driver, immediately take effect upon creation of
 * this class.
 */
class OptionsManager : public OptionsListener
{
 public:
  OptionsManager(Options* opts, ResourceManager* rm = nullptr);
  ~OptionsManager();
  /**
   * Called when a set option call is made on the options object associated
   * with this class. This handles all options that should be taken into account
   * immediately instead of e.g. at SmtEngine::finishInit time. This primarily
   * includes options related to parsing and output.
   *
   * This function call is made after the option has been updated. This means
   * that the value of the option can be queried in the options object that
   * this class is listening to.
   */
  void notifySetOption(const std::string& key) override;
  /**
   * Finish init, which is called at the beginning of SmtEngine::finishInit,
   * just before solving begins. This initializes the options pertaining to
   * time limits, and sets the default options.
   */
  void finishInit(LogicInfo& logic, bool isInternalSubsolver);

 private:
  /** Reference to the options object */
  Options* d_options;
  /** Pointer to the resource manager */
  ResourceManager* d_resourceManager;
  /** Manager for the memory of regular-output-channel. */
  ManagedRegularOutputChannel d_managedRegularChannel;
  /** Manager for the memory of diagnostic-output-channel. */
  ManagedDiagnosticOutputChannel d_managedDiagnosticChannel;
  /** Manager for the memory of --dump-to. */
  ManagedDumpOStream d_managedDumpChannel;
};

}  // namespace smt
}  // namespace cvc5

#endif /* CVC4__SMT__OPTIONS_MANAGER_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback