Public Types | |
using | MapType = std::unordered_map< boost::string_view, size_t, boost::hash< boost::string_view > > |
A convenient alias for the internal type of the map. More... | |
using | TokenType = boost::string_view |
The type of the token that the dictionary stores. More... | |
Public Member Functions | |
StringEncodingDictionary ()=default | |
Construct the default class. More... | |
StringEncodingDictionary (const StringEncodingDictionary &other) | |
Copy the class from the given object. More... | |
StringEncodingDictionary (StringEncodingDictionary &&other)=default | |
Standard move constructor. More... | |
size_t | AddToken (const boost::string_view 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 boost::string_view 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... | |
StringEncodingDictionary & | operator= (const StringEncodingDictionary &other) |
Copy the class from the given object. More... | |
StringEncodingDictionary & | operator= (StringEncodingDictionary &&other)=default |
Standard move assignment operator. More... | |
template | |
void | serialize (Archive &ar, const unsigned int) |
Serialize the class to the given archive. More... | |
size_t | Size () const |
Get the size of the dictionary. More... | |
const std::deque< std::string > & | Tokens () const |
Get the tokens. More... | |
std::deque< std::string > & | Tokens () |
Modify the tokens. More... | |
size_t | Value (const boost::string_view token) const |
The function returns the label assigned to the given token. More... | |
Definition at line 111 of file string_encoding_dictionary.hpp.
using MapType = std::unordered_map< boost::string_view, size_t, boost::hash |
A convenient alias for the internal type of the map.
Definition at line 118 of file string_encoding_dictionary.hpp.
using TokenType = boost::string_view |
The type of the token that the dictionary stores.
Definition at line 121 of file string_encoding_dictionary.hpp.
|
default |
Construct the default class.
|
inline |
Copy the class from the given object.
Definition at line 127 of file string_encoding_dictionary.hpp.
|
default |
Standard move constructor.
|
inline |
The function adds the given token to the dictionary and assigns a label to the token.
The label is equal to the resulting size of the dictionary. The function returns the assigned label.
token | The given token. |
Definition at line 170 of file string_encoding_dictionary.hpp.
|
inline |
Clear the dictionary.
Definition at line 196 of file string_encoding_dictionary.hpp.
|
inline |
The function returns true if the dictionary contains the given token.
token | The given token. |
Definition at line 158 of file string_encoding_dictionary.hpp.
|
inline |
Get the mapping.
Definition at line 208 of file string_encoding_dictionary.hpp.
|
inline |
Modify the mapping.
Definition at line 210 of file string_encoding_dictionary.hpp.
|
inline |
Copy the class from the given object.
Definition at line 138 of file string_encoding_dictionary.hpp.
|
default |
Standard move assignment operator.
|
inline |
Serialize the class to the given archive.
Definition at line 216 of file string_encoding_dictionary.hpp.
|
inline |
Get the size of the dictionary.
Definition at line 193 of file string_encoding_dictionary.hpp.
|
inline |
Get the tokens.
Definition at line 203 of file string_encoding_dictionary.hpp.
|
inline |
Modify the tokens.
Definition at line 205 of file string_encoding_dictionary.hpp.
|
inline |
The function returns the label assigned to the given token.
The function throws std::out_of_range if no such token is found.
token | The given token. |
Definition at line 187 of file string_encoding_dictionary.hpp.