16 #ifndef INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 17 #define INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 25 #include "nn/nlib/Swap.h" 28 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 29 #undef NLIB_VIS_PUBLIC 30 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 40 NLIB_DEFMOVE_PIMPL(
Trie);
42 typedef
bool (*MatchCallback)(const
char* first, const
char* last, uint32_t nodeid,
44 void Match(const
char* cstr, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT {
45 this->Match(cstr,
nlib_strlen(cstr), callback, user_obj);
48 this->Match(cstr,
nlib_strlen(cstr), callback,
nullptr);
50 void Match(
const void* data,
size_t n, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT;
52 Match(data, n, callback,
nullptr);
56 MatchBackward(
const void* data,
size_t n, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT;
58 MatchBackward(data, n, callback,
nullptr);
62 #ifdef __cpp_rvalue_references 63 std::pair<errno_t, Nlist<uint32_t> >
64 GetCommonPrefixWords(
const void* prefix,
size_t n)
NLIB_NOEXCEPT;
74 MatchCallback callback,
void* user_obj,
bool isfwd)
NLIB_NOEXCEPT;
91 #ifdef __cpp_rvalue_references 100 struct TrieBuilderPrivate;
101 TrieBuilderPrivate* prv_;
108 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::Trie)
109 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::TrieBuilder)
111 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 112 #undef NLIB_VIS_PUBLIC 113 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 116 #endif // INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 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.
constexpr Trie() noexcept
Instantiates the object with default parameters (default constructor). Requires initialization with I...
void Match(const char *cstr, MatchCallback callback) noexcept
A parameter omitted version of the above function which passes nullptr as a parameter.
#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 void *data, size_t n, MatchCallback callback) noexcept
A parameter omitted version of the above function which passes nullptr as a parameter.
std::unique_ptr< Trie > Build2() noexcept
Creates the Trie object and return it with unique_ptr.
~TrieBuilder() noexcept
Destructor.
The class for realloc-based implementations of C string vectors.
Implements Trie using LOUDS.
bool AddWords(const char *str) noexcept
Adds a string from an array containing a set of target strings. The strings must be delimited by newl...
Defines the class that resembles std::vector but can store objects that cannot be copied...
constexpr TrieBuilder() noexcept
Instantiates the object with default parameters (default constructor). Requires initialization with I...
~Trie() noexcept
Destructor.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
void MatchBackward(const void *data, size_t n, MatchCallback callback) noexcept
A parameter omitted version of the above function which passes nullptr as a parameter.
The class for writing binary to streams (to OutputStream).
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
The class for reading binary from streams (from InputStream).
The class for realloc-based implementations of vectors with POD-type elements.