summaryrefslogtreecommitdiff
path: root/extractor/matchings_trie.cc
blob: 921ec582df4565a84f13b0108436150caa557690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "matchings_trie.h"

void MatchingsTrie::Reset() {
  ResetTree(root);
  root = make_shared<TrieNode>();
}

shared_ptr<TrieNode> MatchingsTrie::GetRoot() const {
  return root;
}

void MatchingsTrie::ResetTree(shared_ptr<TrieNode> root) {
  if (root != NULL) {
    for (auto child: root->children) {
      ResetTree(child.second);
    }
    root.reset();
  }
}