FSMgine
High-performance finite state machine library for C++17 with single-threaded and multi-threaded variants
|
Provides memory-efficient string storage through string interning. More...
#include <StringInterner.hpp>
Public Member Functions | |
std::string_view | intern (const std::string &str) |
Interns a string and returns a persistent string_view. | |
std::string_view | intern (std::string_view sv) |
Interns a string_view and returns a persistent string_view. | |
void | clear () |
Clears all interned strings (TEST ONLY - DO NOT USE IN PRODUCTION) | |
Static Public Member Functions | |
static StringInterner & | instance () |
Gets the singleton instance of StringInterner. | |
Provides memory-efficient string storage through string interning.
StringInterner implements the string interning pattern to optimize string storage and comparison in the FSM. By interning strings, we achieve:
void fsmgine::StringInterner::clear | ( | ) |
Clears all interned strings (TEST ONLY - DO NOT USE IN PRODUCTION)
|
static |
Gets the singleton instance of StringInterner.
std::string_view fsmgine::StringInterner::intern | ( | const std::string & | str | ) |
Interns a string and returns a persistent string_view.
str | The string to intern |
std::string_view fsmgine::StringInterner::intern | ( | std::string_view | sv | ) |
Interns a string_view and returns a persistent string_view.
sv | The string_view to intern |