GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/bags/term_registry.h Lines: 1 1 100.0 %
Date: 2021-09-16 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mudathir Mohamed, Gereon Kremer
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
 * Bags state object.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__BAGS__TERM_REGISTRY_H
19
#define CVC5__THEORY__BAGS__TERM_REGISTRY_H
20
21
#include <map>
22
23
#include "context/cdhashmap.h"
24
#include "expr/node.h"
25
#include "smt/env_obj.h"
26
27
namespace cvc5 {
28
namespace theory {
29
namespace bags {
30
31
class InferenceManager;
32
class SolverState;
33
34
/**
35
 * Term registry, the purpose of this class is to maintain a database of
36
 * commonly used terms, and mappings from bags to their "proxy variables".
37
 */
38
9939
class TermRegistry : protected EnvObj
39
{
40
  typedef context::CDHashMap<Node, Node> NodeMap;
41
42
 public:
43
  TermRegistry(Env& env, SolverState& state, InferenceManager& im);
44
45
  /**
46
   * Returns the existing empty bag for type tn
47
   * or creates a new one and returns it.
48
   **/
49
  Node getEmptyBag(TypeNode tn);
50
51
 private:
52
  /** The inference manager */
53
  InferenceManager& d_im;
54
  /** Map from bag terms to their proxy variables */
55
  NodeMap d_proxy;
56
  /** Backwards map of above */
57
  NodeMap d_proxy_to_term;
58
  /** Map from types to empty bag of that type */
59
  std::map<TypeNode, Node> d_emptybag;
60
}; /* class Term */
61
62
}  // namespace bags
63
}  // namespace theory
64
}  // namespace cvc5
65
66
#endif /* CVC5__THEORY__BAGS__TERM_REGISTRY_H */