am 8032d295: am 3437032a: Merge "Add TrieMap.save()." into lmp-dev
* commit '8032d2953a5392a55c9707f4193c2115a188ef53': Add TrieMap.save().main
commit
1e08b5239c
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#include "suggest/policyimpl/dictionary/utils/trie_map.h"
|
#include "suggest/policyimpl/dictionary/utils/trie_map.h"
|
||||||
|
|
||||||
|
#include "suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h"
|
||||||
|
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
|
||||||
const int TrieMap::INVALID_INDEX = -1;
|
const int TrieMap::INVALID_INDEX = -1;
|
||||||
|
@ -98,6 +100,11 @@ bool TrieMap::put(const int key, const uint64_t value, const int bitmapEntryInde
|
||||||
return putInternal(unsignedKey, value, getBitShuffledKey(unsignedKey), bitmapEntryIndex,
|
return putInternal(unsignedKey, value, getBitShuffledKey(unsignedKey), bitmapEntryIndex,
|
||||||
readEntry(bitmapEntryIndex), 0 /* level */);
|
readEntry(bitmapEntryIndex), 0 /* level */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TrieMap::save(FILE *const file) const {
|
||||||
|
return DictFileWritingUtils::writeBufferToFileTail(file, &mBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate next entry in a certain level.
|
* Iterate next entry in a certain level.
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
@ -192,6 +193,8 @@ class TrieMap {
|
||||||
return TrieMapRange(this, bitmapEntryIndex);
|
return TrieMapRange(this, bitmapEntryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool save(FILE *const file) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(TrieMap);
|
DISALLOW_COPY_AND_ASSIGN(TrieMap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue