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-08-17 Branches: 12 16 75.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Aina Niemetz
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
 * Implementation of type node identifier trie.
14
 */
15
16
#include "theory/quantifiers/sygus/type_node_id_trie.h"
17
18
using namespace cvc5::kind;
19
20
namespace cvc5 {
21
namespace theory {
22
namespace quantifiers {
23
24
881
void TypeNodeIdTrie::add(Node v, std::vector<TypeNode>& types)
25
{
26
881
  TypeNodeIdTrie* tnt = this;
27
2493
  for (unsigned i = 0, size = types.size(); i < size; i++)
28
  {
29
1612
    tnt = &tnt->d_children[types[i]];
30
  }
31
881
  tnt->d_data.push_back(v);
32
881
}
33
34
1378
void TypeNodeIdTrie::assignIds(std::map<Node, unsigned>& assign,
35
                               unsigned& idCount)
36
{
37
1378
  if (!d_data.empty())
38
  {
39
1398
    for (const Node& v : d_data)
40
    {
41
881
      assign[v] = idCount;
42
    }
43
517
    idCount++;
44
  }
45
2227
  for (std::pair<const TypeNode, TypeNodeIdTrie>& c : d_children)
46
  {
47
849
    c.second.assignIds(assign, idCount);
48
  }
49
1378
}
50
51
}  // namespace quantifiers
52
}  // namespace theory
53
29337
}  // namespace cvc5