3 #ifndef INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_
4 #define INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_
12 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS)
13 #undef NLIB_VIS_PUBLIC
14 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT
24 NLIB_MOVE_MEMBER_HELPER_3(
Trie, m_Louds, m_IsTerminal, m_Labels);
26 m_Louds.swap(rhs.m_Louds);
27 m_IsTerminal.swap(rhs.m_IsTerminal);
28 m_Labels.swap(rhs.m_Labels);
34 typedef bool (*MatchCallback)(
const char* first,
const char* last, uint32_t nodeid,
37 this->Match(cstr,
nlib_strlen(cstr), callback, user_obj);
39 NLIB_VIS_PUBLIC void Match(
const void* data,
size_t n, MatchCallback callback,
41 NLIB_VIS_PUBLIC void MatchBackward(const
void* data,
size_t n, MatchCallback callback,
42 void* user_obj = NULL) NLIB_NOEXCEPT;
45 void Reset() NLIB_NOEXCEPT {
54 NLIB_VIS_HIDDEN int Match_(
const void* data,
const unsigned char* p, uint32_t pos,
55 MatchCallback callback,
void* user_obj,
bool isfwd)
NLIB_NOEXCEPT;
59 detail::BitVector32 m_IsTerminal;
60 detail::PlainArray32<unsigned char> m_Labels;
73 NLIB_VIS_PUBLIC bool AddWords(const
char* str,
size_t len) NLIB_NOEXCEPT;
74 bool AddWords(const
char* str) NLIB_NOEXCEPT {
75 return AddWords(str, strlen(str));
86 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS)
87 #undef NLIB_VIS_PUBLIC
88 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT
91 #endif // INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Class to create a Trie object.
Defines the basic classes that form the basis to Rank and Select operations.
Defines the class for constructing and accessing a LOUDS succinct tree.
void swap(Trie &rhs) noexcept
Swaps the contents of an object.
Trie() noexcept
Instantiates the object.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
void Match(const char *cstr, MatchCallback callback, void *user_obj=NULL) noexcept
Inspects the string to detect the target string registered in Trie.
~TrieBuilder() noexcept
Destructor.
The class for realloc-based implementations of C string vectors.
Implements Trie using LOUDS.
Defines that class that is corresponding to std::unique_ptr.
bool Init() noexcept
Resets the contents of an object.
TrieBuilder() noexcept
Instantiates the object.
~Trie() noexcept
Destructor.
Provides a compact tree structure that can provide various operations in constant time...
The class for writing binary to streams (to OutputStream).
The class for reading binary from streams (from InputStream).
The class for realloc-based implementations of vectors with POD-type elements.