提交 67e40f88 编写于 作者: dengyihao's avatar dengyihao

refactor builder struct

上级 d266c6f2
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "index_fst.h" #include "index_fst.h"
#include "tcoding.h" #include "tcoding.h"
#include "tchecksum.h" #include "tchecksum.h"
#include "indexInt.h"
static void fstPackDeltaIn(FstCountingWriter *wrt, CompiledAddr nodeAddr, CompiledAddr transAddr, uint8_t nBytes) { static void fstPackDeltaIn(FstCountingWriter *wrt, CompiledAddr nodeAddr, CompiledAddr transAddr, uint8_t nBytes) {
...@@ -806,6 +807,7 @@ bool fstBuilderInsert(FstBuilder *b, FstSlice bs, Output in) { ...@@ -806,6 +807,7 @@ bool fstBuilderInsert(FstBuilder *b, FstSlice bs, Output in) {
fstBuilderInsertOutput(b, bs, in); fstBuilderInsertOutput(b, bs, in);
return true; return true;
} }
indexInfo("key must be ordered");
return false; return false;
} }
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
int main(int argc, char** argv) { int main(int argc, char** argv) {
FstBuilder *b = fstBuilderCreate(NULL, 0); FstBuilder *b = fstBuilderCreate(NULL, 0);
{ {
std::string str("abc"); std::string str("aaa");
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size()); FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size());
Output val = 1; Output val = 1;
fstBuilderInsert(b, key, val); fstBuilderInsert(b, key, val);
...@@ -77,10 +77,15 @@ int main(int argc, char** argv) { ...@@ -77,10 +77,15 @@ int main(int argc, char** argv) {
// //
{ {
std::string str("adc");
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size()); for (size_t i = 1; i < 26; i++) {
Output val = 2; std::string str("aaa");
fstBuilderInsert(b, key, val); str[2] = 'a' + i ;
FstSlice key = fstSliceCreate((uint8_t *)str.c_str(), str.size());
Output val = 2;
fstBuilderInsert(b, key, val);
}
} }
//fstBuilderInsert(b, key1, val2); //fstBuilderInsert(b, key1, val2);
fstBuilderFinish(b); fstBuilderFinish(b);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册