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
commit092b7cf020680e949d6956ec6ef2cf012faccd86 (patch)
tree4bc074572925a10b63928639be244a60f153f7ac /extractor/matchings_trie.cc
parentd7271db305bd1aeaf9c3d9ac1043546fec22a402 (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();