3 #ifndef INCLUDE_NN_NLIB_SUCCINCT_AHOCORASICK_H_ 4 #define INCLUDE_NN_NLIB_SUCCINCT_AHOCORASICK_H_ 6 #include "nn/nlib/Swap.h" 10 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 11 #undef NLIB_VIS_PUBLIC 12 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 20 static const size_t LABEL_WIDTH = 8;
21 static const int LABEL_MASK = (1 << LABEL_WIDTH) - 1;
22 static const int NUMLABEL_PER_BYTE = 8 / LABEL_WIDTH;
29 AhoCorasickPrivate* tmp = prv_;
33 typedef bool (*MatchCallback)(
const char* first,
const char* last, uint32_t nodeid,
36 this->Match(doc,
nlib_strlen(doc), callback, userobj);
38 void Match(
const char* doc, MatchCallback callback)
NLIB_NOEXCEPT {
41 void Match(
const void* data,
size_t n, MatchCallback callback,
void* userobj)
NLIB_NOEXCEPT;
42 void Match(
const void* data,
size_t n, MatchCallback callback) NLIB_NOEXCEPT {
43 Match(data, n, callback, NULL);
47 void MemSize(
size_t* len_store,
size_t* goto_arc,
size_t* report_arc,
54 struct AhoCorasickPrivate;
55 AhoCorasickPrivate* prv_;
63 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::AhoCorasick)
65 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 66 #undef NLIB_VIS_PUBLIC 67 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 70 #endif // INCLUDE_NN_NLIB_SUCCINCT_AHOCORASICK_H_ Defines the basic classes that form the basis to Rank and Select operations.
#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 *doc, MatchCallback callback, void *userobj) noexcept
Inspects the string to detect the target string.
void swap(AhoCorasick &rhs) noexcept
Swaps the contents of an object.
Uses the Aho-Corasick algorithm to detect language and patterns.
AhoCorasick() noexcept
Instantiates the object with default parameters (default constructor).
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
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).
Defines the class for constructing and accessing a parentheses representation of a tree...
Creates the index (automaton) used in the Aho-Corasick algorithm.