6 #if !defined(HSDS_TRIE_HPP_)
10 #include "hsds/vector.hpp"
53 void build(std::vector<std::string>& keyList,
bool useTailTrie =
false);
75 uint64_t limit = DEFAULT_LIMIT_VALUE)
const;
85 void commonPrefixSearch(
const char* str,
size_t len, std::vector<Result>& results, uint64_t limit =
86 DEFAULT_LIMIT_VALUE)
const;
96 void predictiveSearch(
const char* str,
size_t len, std::vector<id_t>& retIDs,
97 uint64_t limit = DEFAULT_LIMIT_VALUE)
const;
112 id_t traverse(
const char* str,
size_t len, uint64_t& nodePos, uint64_t& zeros,
size_t& keyPos)
const;
171 static const uint64_t DEFAULT_LIMIT_VALUE = ~(0ULL);
176 Vector<Vector<char> > vtails_;
177 Vector<uint8_t> edges_;
183 uint64_t tailIDSize_;
185 void build(hsds::Vector<Vector<char> >& keyList);
186 void buildTailTrie();
187 bool isLeaf(uint64_t pos)
const;
188 void getChild(uint8_t c, uint64_t& pos, uint64_t& zeros)
const;
189 void getParent(uint8_t& c, uint64_t& pos, uint64_t& zeros)
const;
190 void enumerateAll(uint64_t pos, uint64_t zeros, std::vector<id_t>& retIDs,
size_t limit)
const;
191 bool tailMatch(
const char* str,
size_t len,
size_t depth, uint64_t tailID,
size_t& retLen)
const;
192 Vector<char> getTail(uint64_t i)
const;