1 /********************* */
2 /*! \file term_context_node.h
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Gereon Kremer
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
12 ** \brief Term context node utility.
15 #include "cvc4_private.h"
17 #ifndef CVC4__EXPR__TERM_CONTEXT_NODE_H
18 #define CVC4__EXPR__TERM_CONTEXT_NODE_H
20 #include "expr/node.h"
28 * A (term-context) sensitive term. This is a wrapper around a Node that
29 * additionally has a term context identifier, see getTermContext(). It depends
30 * on a pointer to a TermContext callback class (see term_context.h).
34 friend class TCtxStack
;
37 TCtxNode(Node n
, const TermContext
* tctx
);
38 /** get number of children */
39 size_t getNumChildren() const;
40 /** get child at index i */
41 TCtxNode
getChild(size_t i
) const;
45 uint32_t getContextId() const;
46 /** get term context */
47 const TermContext
* getTermContext() const;
48 //---------------------- utility methods
50 * Get node hash, which is a unique node representation of this TCtxNode.
51 * This method calls the method below on the data members of this class.
53 Node
getNodeHash() const;
55 * Get node hash, which is a unique node representation of the pair (n, val).
56 * In particular, this returns (SEXPR n (CONST_RATIONAL val)).
58 static Node
computeNodeHash(Node n
, uint32_t val
);
60 * Decompose node hash, which is an inverse of the above operation. In
61 * particular, given input h, this returns a node n and sets val to a value
62 * such that computeNodeHash(n, val) returns h.
64 static Node
decomposeNodeHash(Node h
, uint32_t& val
);
65 //---------------------- end utility methods
67 /** private constructor */
68 TCtxNode(Node n
, uint32_t val
, const TermContext
* tctx
);
71 /** The term context identifier */
73 /** The term context */
74 const TermContext
* d_tctx
;
79 #endif /* CVC4__EXPR__TERM_CONVERSION_PROOF_GENERATOR_H */