GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/ee_manager.h Lines: 4 4 100.0 %
Date: 2021-11-07 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds
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
 * Utilities for management of equality engines.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__EE_MANAGER__H
19
#define CVC5__THEORY__EE_MANAGER__H
20
21
#include <map>
22
#include <memory>
23
24
#include "smt/env_obj.h"
25
#include "theory/ee_setup_info.h"
26
#include "theory/theory.h"
27
#include "theory/uf/equality_engine.h"
28
29
namespace cvc5 {
30
31
class TheoryEngine;
32
33
namespace theory {
34
35
class SharedSolver;
36
37
/**
38
 * This is (theory-agnostic) information associated with the management of
39
 * an equality engine for a single theory. This information is maintained
40
 * by the manager class below.
41
 *
42
 * Currently, this simply is the equality engine itself, for memory
43
 * management purposes.
44
 */
45
198484
struct EeTheoryInfo
46
{
47
198549
  EeTheoryInfo() : d_usedEe(nullptr) {}
48
  /** Equality engine that is used (if it exists) */
49
  eq::EqualityEngine* d_usedEe;
50
  /** Equality engine allocated specifically for this theory (if it exists) */
51
  std::unique_ptr<eq::EqualityEngine> d_allocEe;
52
};
53
54
/** Virtual base class for equality engine managers */
55
class EqEngineManager : protected EnvObj
56
{
57
 public:
58
   /**
59
   * @param te Reference to the theory engine
60
   * @param sharedSolver The shared solver that is being used in combination
61
   * with this equality engine manager
62
    */
63
  EqEngineManager(Env& env, TheoryEngine& te, SharedSolver& shs);
64
15268
  virtual ~EqEngineManager() {}
65
  /**
66
   * Initialize theories, called during TheoryEngine::finishInit after theory
67
   * objects have been created but prior to their final initialization. This
68
   * sets up equality engines for all theories.
69
   *
70
   * This method is context-independent, and is applied once during
71
   * the lifetime of TheoryEngine (during finishInit).
72
   */
73
  virtual void initializeTheories() = 0;
74
  /**
75
   * Get the equality engine theory information for theory with the given id.
76
   */
77
  const EeTheoryInfo* getEeTheoryInfo(TheoryId tid) const;
78
79
  /** Allocate equality engine that is context-dependent on c with info esi */
80
  eq::EqualityEngine* allocateEqualityEngine(EeSetupInfo& esi,
81
                                             context::Context* c);
82
  /**
83
   * Notify this class that we are about to terminate with a model. This method
84
   * is for debugging only.
85
   *
86
   * @param incomplete Whether we are answering "unknown" instead of "sat".
87
   */
88
10
  virtual void notifyModel(bool incomplete) {}
89
90
 protected:
91
  /** Reference to the theory engine */
92
  TheoryEngine& d_te;
93
  /** Reference to the shared solver */
94
  SharedSolver& d_sharedSolver;
95
  /** Information related to the equality engine, per theory. */
96
  std::map<TheoryId, EeTheoryInfo> d_einfo;
97
};
98
99
}  // namespace theory
100
}  // namespace cvc5
101
102
#endif /* CVC5__THEORY__EE_MANAGER__H */