From 94f9dcccec57f245c765eeac3a4fcd716ac733ec Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 5 Feb 2016 15:42:24 +0800 Subject: begin to write PhraseLargeTable3 for Kyoto Cabinet --- src/storage/phrase_large_table3_kyotodb.cpp | 27 +++++++++++++++++++++++++++ src/storage/phrase_large_table3_kyotodb.h | 3 +++ 2 files changed, 30 insertions(+) (limited to 'src/storage') diff --git a/src/storage/phrase_large_table3_kyotodb.cpp b/src/storage/phrase_large_table3_kyotodb.cpp index 3153f6e..32d8a8d 100644 --- a/src/storage/phrase_large_table3_kyotodb.cpp +++ b/src/storage/phrase_large_table3_kyotodb.cpp @@ -19,3 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "phrase_large_table3_kyotodb.h" + + +namespace pinyin{ + +PhraseLargeTable3::PhraseLargeTable3() { + m_db = NULL; + m_entry = NULL; +} + +void PhraseLargeTable3::reset() { + if (m_db) { + m_db->synchronize(); + m_db->close(); + delete m_db; + m_db = NULL; + } + + m_chunk.set_size(0); + + if (m_entry) { + delete m_entry; + m_entry = NULL; + } +} + +}; diff --git a/src/storage/phrase_large_table3_kyotodb.h b/src/storage/phrase_large_table3_kyotodb.h index ff6f0ce..0549697 100644 --- a/src/storage/phrase_large_table3_kyotodb.h +++ b/src/storage/phrase_large_table3_kyotodb.h @@ -22,6 +22,8 @@ #ifndef PHRASE_LARGE_TABLE3_KYOTODB_H #define PHRASE_LARGE_TABLE3_KYOTODB_H +#include "novel_types.h" +#include "memory_chunk.h" #include namespace pinyin{ @@ -32,6 +34,7 @@ class PhraseLargeTable3{ private: /* member variables. */ kyotocabinet::BasicDB * m_db; + MemoryChunk m_chunk; protected: PhraseTableEntry * m_entry; -- cgit