GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass_context.h Lines: 14 14 100.0 %
Date: 2021-03-22 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file preprocessing_pass_context.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Aina Niemetz, Mathias Preiner, Andrew Reynolds
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief The preprocessing pass context for passes
13
 **
14
 ** Implementation of the preprocessing pass context for passes. This context
15
 ** allows preprocessing passes to retrieve information besides the assertions
16
 ** from the solver and interact with it without getting full access.
17
 **/
18
19
#include "cvc4_private.h"
20
21
#ifndef CVC4__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H
22
#define CVC4__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H
23
24
#include "context/cdhashset.h"
25
#include "smt/smt_engine.h"
26
#include "theory/trust_substitutions.h"
27
#include "util/resource_manager.h"
28
29
namespace CVC4 {
30
class SmtEngine;
31
class TheoryEngine;
32
namespace theory::booleans {
33
class CircuitPropagator;
34
}
35
namespace prop {
36
class PropEngine;
37
}
38
namespace preprocessing {
39
40
8992
class PreprocessingPassContext
41
{
42
 public:
43
  PreprocessingPassContext(
44
      SmtEngine* smt,
45
      theory::booleans::CircuitPropagator* circuitPropagator,
46
      ProofNodeManager* pnm);
47
48
364
  SmtEngine* getSmt() { return d_smt; }
49
304847
  TheoryEngine* getTheoryEngine() { return d_smt->getTheoryEngine(); }
50
11322
  prop::PropEngine* getPropEngine() { return d_smt->getPropEngine(); }
51
128401
  context::Context* getUserContext() { return d_smt->getUserContext(); }
52
17990
  context::Context* getDecisionContext() { return d_smt->getContext(); }
53
54
10361
  theory::booleans::CircuitPropagator* getCircuitPropagator()
55
  {
56
10361
    return d_circuitPropagator;
57
  }
58
59
4980
  context::CDHashSet<Node, NodeHashFunction>& getSymsInAssertions()
60
  {
61
4980
    return d_symsInAssertions;
62
  }
63
64
127059
  void spendResource(ResourceManager::Resource r)
65
  {
66
127059
    d_resourceManager->spendResource(r);
67
127059
  }
68
69
  /** Get the current logic info of the SmtEngine */
70
9026
  const LogicInfo& getLogicInfo() { return d_smt->getLogicInfo(); }
71
72
  /** Gets a reference to the top-level substitution map */
73
  theory::TrustSubstitutionMap& getTopLevelSubstitutions();
74
75
  /** Record symbols in assertions
76
   *
77
   * This method is called when a set of assertions is finalized. It adds
78
   * the symbols to d_symsInAssertions that occur in assertions.
79
   */
80
  void recordSymbolsInAssertions(const std::vector<Node>& assertions);
81
82
  /** The the proof node manager associated with this context, if it exists */
83
  ProofNodeManager* getProofNodeManager();
84
85
 private:
86
  /** Pointer to the SmtEngine that this context was created in. */
87
  SmtEngine* d_smt;
88
89
  /** Pointer to the ResourceManager for this context. */
90
  ResourceManager* d_resourceManager;
91
92
  /* The top level substitutions */
93
  theory::TrustSubstitutionMap d_topLevelSubstitutions;
94
95
  /** Instance of the circuit propagator */
96
  theory::booleans::CircuitPropagator* d_circuitPropagator;
97
  /** Pointer to the proof node manager, if it exists */
98
  ProofNodeManager* d_pnm;
99
100
  /**
101
   * The (user-context-dependent) set of symbols that occur in at least one
102
   * assertion in the current user context.
103
   */
104
  context::CDHashSet<Node, NodeHashFunction> d_symsInAssertions;
105
106
};  // class PreprocessingPassContext
107
108
}  // namespace preprocessing
109
}  // namespace CVC4
110
111
#endif /* CVC4__PREPROCESSING__PREPROCESSING_PASS_CONTEXT_H */