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