diff options
Diffstat (limited to 'src/storage/phrase_large_table.cpp')
-rw-r--r-- | src/storage/phrase_large_table.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/storage/phrase_large_table.cpp b/src/storage/phrase_large_table.cpp index 7a7dfd0..ad3262f 100644 --- a/src/storage/phrase_large_table.cpp +++ b/src/storage/phrase_large_table.cpp @@ -23,6 +23,52 @@ #include <string.h> #include "phrase_large_table.h" + +/* class definition */ + +namespace novel{ + +class PhraseLengthIndexLevel{ +protected: + GArray* m_phrase_array_indexes; +public: + PhraseLengthIndexLevel(); + ~PhraseLengthIndexLevel(); + + /* load/store method */ + bool load(MemoryChunk * chunk, table_offset_t offset, table_offset_t end); + bool store(MemoryChunk * new_chunk, table_offset_t offset, table_offset_t & end); + + /* search/add_index/remove_index method */ + int search( int phrase_length, /* in */ utf16_t phrase[], + /* out */ phrase_token_t & token); + + int add_index( int phrase_length, /* in */ utf16_t phrase[], /* in */ phrase_token_t token); + int remove_index( int phrase_length, /* in */ utf16_t phrase[], /* out */ phrase_token_t & token); +}; + +template<size_t phrase_length> +class PhraseArrayIndexLevel{ +protected: + MemoryChunk m_chunk; +public: + bool load(MemoryChunk * chunk, table_offset_t offset, table_offset_t end); + bool store(MemoryChunk * new_chunk, table_offset_t offset, table_offset_t & end); + + /* search/add_index/remove_index method */ + int search( /* in */ utf16_t phrase[], + /* out */ phrase_token_t & token); + + int add_index(/* in */ utf16_t phrase[], /* in */ phrase_token_t token); + int remove_index(/* in */ utf16_t phrase[], /* out */ phrase_token_t & token); +}; + +}; + +using namespace novel; + +/* class implementation */ + template<size_t phrase_length> struct PhraseIndexItem{ phrase_token_t m_token; |