GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/sygus/type_node_id_trie.cpp Lines: 15 15 100.0 %
Date: 2021-03-22 Branches: 12 18 66.7 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file type_node_id_trie.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-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
11
 **
12
 ** \brief Implementation of type node identifier trie
13
 **/
14
15
#include "theory/quantifiers/sygus/type_node_id_trie.h"
16
17
using namespace CVC4::kind;
18
19
namespace CVC4 {
20
namespace theory {
21
namespace quantifiers {
22
23
1140
void TypeNodeIdTrie::add(Node v, std::vector<TypeNode>& types)
24
{
25
1140
  TypeNodeIdTrie* tnt = this;
26
3153
  for (unsigned i = 0, size = types.size(); i < size; i++)
27
  {
28
2013
    tnt = &tnt->d_children[types[i]];
29
  }
30
1140
  tnt->d_data.push_back(v);
31
1140
}
32
33
1666
void TypeNodeIdTrie::assignIds(std::map<Node, unsigned>& assign,
34
                               unsigned& idCount)
35
{
36
1666
  if (!d_data.empty())
37
  {
38
1779
    for (const Node& v : d_data)
39
    {
40
1140
      assign[v] = idCount;
41
    }
42
639
    idCount++;
43
  }
44
2658
  for (std::pair<const TypeNode, TypeNodeIdTrie>& c : d_children)
45
  {
46
992
    c.second.assignIds(assign, idCount);
47
  }
48
1666
}
49
50
}  // namespace quantifiers
51
}  // namespace theory
52
26676
}  // namespace CVC4