Representation of a string definition.
More...
#include <pearl/String.h>
|
typedef uint32_t | IdType |
| String definition identifier type. More...
|
|
Instances of the String class provide information about global string definitions. They are referenced by various other definitions, such as Region or Location, and associate a character string with a numerical identifier. String definitions are globally defined and continously enumerated, i.e., the ID is element of [0,#strings-1].
- Todo:
- Find a way to get rid of MACHINE_ID, MACHINE, NODE_ID, and NODE.
◆ IdType
◆ String()
pearl::String::String |
( |
IdType |
id, |
|
|
const std::string & |
str |
|
) |
| |
Creates a new string definition instance using the given global identifier id and the character string str.
- Parameters
-
id | Global string identifier |
str | Associated character string |
◆ getCString()
const char* pearl::String::getCString |
( |
| ) |
const |
Returns the character string associated to the string definition as a null-terminated C string. For the returned pointer, the same restrictions apply as for the c_str() member function of the std::string class. That is, the returned array points to an internal location large enough to hold the character string plus its terminating null-character, but the values in this array should not be modified in the program.
- Returns
- Null-terminated C string
◆ getId()
IdType pearl::String::getId |
( |
| ) |
const |
Returns the global identifier of the string definition.
- Returns
- Global identifier
◆ getString()
const std::string pearl::String::getString |
( |
| ) |
const |
Returns the character string associated to the string definition as a C++ std::string object.
- Returns
- C++ std::string object
◆ operator!=()
Compares two string definition objects lhs and rhs for inequality. Two string definitions are considered unequal if either their global identifiers or their associated characters strings differ.
- Parameters
-
lhs | Left-hand operand |
rhs | Right-hand operand |
- Returns
- True if the string definitions differ, false otherwise.
◆ operator<<()
std::ostream & operator<< |
( |
std::ostream & |
stream, |
|
|
const String & |
item |
|
) |
| |
|
related |
Prints the contents of the given string definition object item to an output stream in a human-readable form.
- Parameters
-
stream | Output stream |
item | String definition object |
- Returns
- Output stream
◆ operator==()
Compares two string definition objects lhs and rhs for equality. Two string definitions are considered equal if both their global identifiers and their associated characters strings are identical.
- Parameters
-
lhs | Left-hand operand |
rhs | Right-hand operand |
- Returns
- True if the string definitions are equal, false otherwise.
◆ MACHINE
const String pearl::String::MACHINE |
|
static |
◆ MACHINE_ID
◆ NO_ID
const IdType pearl::String::NO_ID = (~static_cast<IdType>(0)) |
|
static |
◆ NODE
const String pearl::String::NODE |
|
static |
◆ NODE_ID
◆ UNDEFINED
const String pearl::String::UNDEFINED |
|
static |
The documentation for this class was generated from the following file: