summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-02-05 15:42:24 +0800
committerPeng Wu <alexepico@gmail.com>2016-02-05 15:42:24 +0800
commit94f9dcccec57f245c765eeac3a4fcd716ac733ec (patch)
tree8dee5acdd0965a0a47fc3d3c2579406d91ab21a6 /src/storage
parent5cf152d3c98ca4e13c091455c26e8a8200751e0b (diff)
downloadlibpinyin-94f9dcccec57f245c765eeac3a4fcd716ac733ec.tar.gz
libpinyin-94f9dcccec57f245c765eeac3a4fcd716ac733ec.tar.xz
libpinyin-94f9dcccec57f245c765eeac3a4fcd716ac733ec.zip
begin to write PhraseLargeTable3 for Kyoto Cabinet
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/phrase_large_table3_kyotodb.cpp27
-rw-r--r--src/storage/phrase_large_table3_kyotodb.h3
2 files changed, 30 insertions, 0 deletions
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 <kcdb.h>
namespace pinyin{
@@ -32,6 +34,7 @@ class PhraseLargeTable3{
private:
/* member variables. */
kyotocabinet::BasicDB * m_db;
+ MemoryChunk m_chunk;
protected:
PhraseTableEntry * m_entry;