Public Types | |
using | MapType = std::array< size_t, 1<< CHAR_BIT > |
A convenient alias for the internal type of the map. More... | |
using | TokenType = int |
The type of the token that the dictionary stores. More... | |
Public Member Functions | |
StringEncodingDictionary () | |
Construct the default class. More... | |
size_t | AddToken (const int token) |
The function adds the given token to the dictionary and assigns a label to the token. More... | |
void | Clear () |
Clear the dictionary. More... | |
bool | HasToken (const int token) const |
The function returns true if the dictionary contains the given token. More... | |
const MapType & | Mapping () const |
Get the mapping. More... | |
MapType & | Mapping () |
Modify the mapping. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the class to the given archive. More... | |
size_t | Size () const |
Get the size of the dictionary. More... | |
size_t | Value (const int token) const |
The function returns the label assigned to the given token. More... | |
Definition at line 256 of file string_encoding_dictionary.hpp.
using MapType = std::array<size_t, 1 << CHAR_BIT> |
A convenient alias for the internal type of the map.
Definition at line 260 of file string_encoding_dictionary.hpp.
using TokenType = int |
The type of the token that the dictionary stores.
Definition at line 263 of file string_encoding_dictionary.hpp.
|
inline |
Construct the default class.
Definition at line 266 of file string_encoding_dictionary.hpp.
|
inline |
The function adds the given token to the dictionary and assigns a label to the token.
The token must belong to [0, 255]; otherwise the behavior is undefined. The label is equal to the resulting size of the dictionary. The function returns the assigned label.
token | The given token. |
Definition at line 291 of file string_encoding_dictionary.hpp.
|
inline |
Clear the dictionary.
Definition at line 317 of file string_encoding_dictionary.hpp.
|
inline |
The function returns true if the dictionary contains the given token.
The token must belong to [0, 255]; otherwise the behavior is undefined.
token | The given token. |
Definition at line 278 of file string_encoding_dictionary.hpp.
|
inline |
Get the mapping.
Definition at line 323 of file string_encoding_dictionary.hpp.
|
inline |
Modify the mapping.
Definition at line 325 of file string_encoding_dictionary.hpp.
|
inline |
Serialize the class to the given archive.
Definition at line 331 of file string_encoding_dictionary.hpp.
|
inline |
Get the size of the dictionary.
Definition at line 311 of file string_encoding_dictionary.hpp.
|
inline |
The function returns the label assigned to the given token.
The function doesn't verify that the dictionary contains the token. The token must belong to [0, 255]; otherwise the behavior is undefined.
token | The given token. |
Definition at line 305 of file string_encoding_dictionary.hpp.