Implements Trie using LOUDS.
More...
#include "nn/nlib/succinct/Trie.h"
|
typedef bool(* | MatchCallback) (const char *first, const char *last, uint32_t nodeid, void *user_obj) |
| User-defined callback function. More...
|
|
|
void | Match (const char *cstr, MatchCallback callback, void *user_obj=NULL) noexcept |
| Inspects the string to detect the target string registered in Trie. More...
|
|
void | Match (const void *data, size_t n, MatchCallback callback, void *user_obj=NULL) noexcept |
| Inspects the data to detect the target pattern. More...
|
|
void | MatchBackward (const void *data, size_t n, MatchCallback callback, void *user_obj=NULL) noexcept |
| Inspects the data backwards to detect the target pattern. More...
|
|
errno_t | GetCommonPrefixWords (const void *prefix, size_t n, ReallocCstringVec *vec) noexcept |
| Lists the data with a common prefix in dictionary order. More...
|
|
void | Reset () noexcept |
| Returns the object to the state immediately after the constructor is called.
|
|
|
| Trie () noexcept |
| Instantiates the object.
|
|
| ~Trie () noexcept |
| Destructor.
|
|
Trie & | assign (Trie &rhs, move_tag) |
| Assigns the object by using swap for a move.
|
|
| Trie (Trie &rhs, move_tag) |
| Instantiates the object by using swap for a move.
|
|
| Trie (Trie &&rhs) |
| Instantiates the object (move constructor). This function is useful when using C++11.
|
|
Trie & | operator= (Trie &&rhs) |
| Move assignment operator. This function is useful when using C++11.
|
|
void | swap (Trie &rhs) noexcept |
| Swaps the contents of an object.
|
|
bool | Init () noexcept |
| Resets the contents of an object. More...
|
|
|
bool | Export (BinaryWriter *w) const noexcept |
| Writes the object to the file. More...
|
|
bool | Import (BinaryReader *r) noexcept |
| Reads the written object. More...
|
|
Implements Trie using LOUDS.
- Description
- Trie can be used with a compact data size. Used by creating using
TrieBuilder
, or importing it using the Import
method.
Definition at line 20 of file Trie.h.
nn::nlib::succinct::Trie::MatchCallback |
User-defined callback function.
- Parameters
-
[in] | first | Pointer to the head of the target term (tail when a reverse search). |
[in] | last | The end of the target term (immediately before the term when a reverse search). |
[in] | nodeid | The ID of the detected term (not a continuous value). |
[in,out] | user_obj | Pointer to the user-specified object. |
- Returns
- Continues analysis if
true
. Ends the process when false
.
- Description
- Called when the string (pattern) is detected. Developers will write a process to handle each.
Definition at line 34 of file Trie.h.
Writes the object to the file.
- Parameters
-
- Returns
- Returns
true
when successful.
- Description
- The written data can be read and restored using the
Import
function. The data is always written little endian.
nn::nlib::succinct::Trie::GetCommonPrefixWords |
( |
const void * |
prefix, |
|
|
size_t |
n, |
|
|
ReallocCstringVec * |
vec |
|
) |
| |
|
noexcept |
Lists the data with a common prefix in dictionary order.
- Parameters
-
[in] | prefix | Pointer to the prefix. |
[in] | n | Length of the prefix. |
[out] | vec | Vector where the string that has prefix as a prefix is stored. |
- Returns
- Returns
0
on success.
Reads the written object.
- Parameters
-
- Returns
- Returns
true
when import is successful.
nn::nlib::succinct::Trie::Init |
( |
| ) |
|
|
inlinenoexcept |
Resets the contents of an object.
- Returns
- Returns
true
.
Definition at line 30 of file Trie.h.
nn::nlib::succinct::Trie::Match |
( |
const char * |
cstr, |
|
|
MatchCallback |
callback, |
|
|
void * |
user_obj = NULL |
|
) |
| |
|
inlinenoexcept |
Inspects the string to detect the target string registered in Trie.
- Parameters
-
[in] | cstr | String that terminates at null. |
[in] | callback | Callback function called when the term is detected. |
[in,out] | user_obj | Pointer to the user-specified object. |
Definition at line 36 of file Trie.h.
nn::nlib::succinct::Trie::Match |
( |
const void * |
data, |
|
|
size_t |
n, |
|
|
MatchCallback |
callback, |
|
|
void * |
user_obj = NULL |
|
) |
| |
|
noexcept |
Inspects the data to detect the target pattern.
- Parameters
-
[in] | data | Pointer to the head of the data to be inspected. |
[in] | n | Data size. |
[in] | callback | Callback function called when the pattern is detected. |
[in,out] | user_obj | Pointer to the user-specified object. |
nn::nlib::succinct::Trie::MatchBackward |
( |
const void * |
data, |
|
|
size_t |
n, |
|
|
MatchCallback |
callback, |
|
|
void * |
user_obj = NULL |
|
) |
| |
|
noexcept |
Inspects the data backwards to detect the target pattern.
- Parameters
-
[in] | data | Pointer to the tail of the data to be inspected. |
[in] | n | Data size. |
[in] | callback | Callback function called when the pattern is detected. |
[in,out] | user_obj | Pointer to the user-specified object. |
The documentation for this class was generated from the following files: