|
The Sparta Modeling Framework
|
Manages string internment for SPARTA. This allows strings to be compared by pointer once interned. More...
#include <StringManager.hpp>
Public Types | |
| using | StringUniquePtr = std::unique_ptr<std::string, Deleter> |
| Mapping of strings to their addresses. | |
| typedef std::map< std::string, StringUniquePtr > | StringMap |
Public Member Functions | |
| StringManager () | |
| Constructor. | |
| std::string * | internString (const std::string &s) |
| Stores a string in shared space within this manager unless it is already stored. | |
| std::string * | findString (const std::string &s) const |
| Find a string in this manager. | |
| bool | hasString (const std::string &s) const |
| Checks to see if a string is present without adding it. | |
| bool | isInterned (const std::string *s) const |
| Determines if a string is interned in this string manager by its pointer. | |
| void | dumpStrings (std::ostream &o, bool pretty=false) const |
| Write all strings interned in the string manager to an ostream. | |
| uint32_t | getNumStrings () const |
| Gets the number of strings in this StringManager. | |
Static Public Member Functions | |
| static StringManager & | getStringManager () |
| Returns the StringManager singleton. | |
Public Attributes | |
| StringMap | string_map_ |
| Mapping of ID to string for getting the string associated with this ID. Allows lookup with a string from anywhere to see if any equivalent string are in this manager. | |
| uint32_t | max_string_len_ |
| Maximum string length held by the StringManager. | |
| const uint64_t | is_constructed |
| Has this singleton been constructed yet. Yes if equal to IS_CONSTRUCTED_CONST. | |
| const std::string *const | EMPTY |
| Holds interned empty strings. | |
Static Public Attributes | |
| static const uint64_t | IS_CONSTRUCTED_CONST = 0x0123456789abcdef |
| Value of is_constructed after construction. | |
Friends | |
| class | SpartaStaticInitializer |
| Allow initialization of statics through this helper. | |
Manages string internment for SPARTA. This allows strings to be compared by pointer once interned.
Definition at line 22 of file StringManager.hpp.
| std::map<std::string, StringUniquePtr> sparta::StringManager::StringMap |
Definition at line 98 of file StringManager.hpp.
| using sparta::StringManager::StringUniquePtr = std::unique_ptr<std::string, Deleter> |
Mapping of strings to their addresses.
Definition at line 97 of file StringManager.hpp.
|
inline |
Constructor.
Definition at line 122 of file StringManager.hpp.
|
inline |
Write all strings interned in the string manager to an ostream.
Definition at line 195 of file StringManager.hpp.
|
inline |
Find a string in this manager.
Definition at line 157 of file StringManager.hpp.
|
inline |
Gets the number of strings in this StringManager.
Definition at line 213 of file StringManager.hpp.
|
inlinestatic |
Returns the StringManager singleton.
Definition at line 224 of file StringManager.hpp.
|
inline |
Checks to see if a string is present without adding it.
Definition at line 171 of file StringManager.hpp.

|
inline |
Stores a string in shared space within this manager unless it is already stored.
| s | string to intern. Can be anything |
Definition at line 138 of file StringManager.hpp.

|
inline |
Determines if a string is interned in this string manager by its pointer.
Definition at line 181 of file StringManager.hpp.
|
friend |
Allow initialization of statics through this helper.
Definition at line 92 of file StringManager.hpp.
| const std::string* const sparta::StringManager::EMPTY |
Holds interned empty strings.
Definition at line 218 of file StringManager.hpp.
| const uint64_t sparta::StringManager::is_constructed |
Has this singleton been constructed yet. Yes if equal to IS_CONSTRUCTED_CONST.
Definition at line 112 of file StringManager.hpp.
|
static |
Value of is_constructed after construction.
Definition at line 117 of file StringManager.hpp.
| uint32_t sparta::StringManager::max_string_len_ |
Maximum string length held by the StringManager.
Definition at line 106 of file StringManager.hpp.
| StringMap sparta::StringManager::string_map_ |
Mapping of ID to string for getting the string associated with this ID. Allows lookup with a string from anywhere to see if any equivalent string are in this manager.
Definition at line 105 of file StringManager.hpp.