ccced2cacff54cec187c317127f3f420ee7f0daa
[cvc5.git] / src / smt / expr_names.cpp
1 /********************* */
2 /*! \file expr_names.cpp
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Andrew Reynolds
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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 Utility for maintaining expression names.
13 **/
14
15 #include "smt/expr_names.h"
16
17 namespace CVC4 {
18 namespace smt {
19
20 ExprNames::ExprNames(context::UserContext* u)
21 : d_exprNames(u)
22 {
23 }
24
25 void ExprNames::setExpressionName(const Node& e, const std::string& name) {
26 d_exprNames[e] = name;
27 }
28
29 bool ExprNames::getExpressionName(const Node& e, std::string& name) const {
30 auto it = d_exprNames.find(e);
31 if(it!=d_exprNames.end()) {
32 name = (*it).second;
33 return true;
34 }
35 return false;
36 }
37
38 } // namespace smt
39 } // namespace CVC4