summaryrefslogtreecommitdiff
path: root/extractor/matchings_trie.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-03-07 22:49:46 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-03-07 22:49:46 +0000
commite362788ec318f0d9a349eeb2459cf72747502919 (patch)
tree474f8bccf1f88a0a358094fd4d855ebc6278a2b2 /extractor/matchings_trie.cc
parentb34c347cd7f4f8965e4d943543a31f9a4e886f54 (diff)
Parallelized grammar extraction.
Diffstat (limited to 'extractor/matchings_trie.cc')
-rw-r--r--extractor/matchings_trie.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/extractor/matchings_trie.cc b/extractor/matchings_trie.cc
index c7b98765..7fb7a529 100644
--- a/extractor/matchings_trie.cc
+++ b/extractor/matchings_trie.cc
@@ -2,19 +2,22 @@
namespace extractor {
-void MatchingsTrie::Reset() {
- ResetTree(root);
+MatchingsTrie::MatchingsTrie() {
root = make_shared<TrieNode>();
}
+MatchingsTrie::~MatchingsTrie() {
+ DeleteTree(root);
+}
+
shared_ptr<TrieNode> MatchingsTrie::GetRoot() const {
return root;
}
-void MatchingsTrie::ResetTree(shared_ptr<TrieNode> root) {
+void MatchingsTrie::DeleteTree(shared_ptr<TrieNode> root) {
if (root != NULL) {
for (auto child: root->children) {
- ResetTree(child.second);
+ DeleteTree(child.second);
}
if (root->suffix_link != NULL) {
root->suffix_link.reset();