PEARL
Parallel Event Access and Replay Library
Public Types | Static Public Attributes | List of all members
pearl::String Class Reference

Representation of a string definition. More...

#include <pearl/String.h>

Public Types

typedef uint32_t IdType
 String definition identifier type. More...
 

Public Member Functions

Constructors & destructor
 String (IdType id, const std::string &str)
 Constructor. More...
 
Access definition data
IdType getId () const
 Get global identifier. More...
 
const std::string getString () const
 Get string data as C++ std::string. More...
 
const char * getCString () const
 Get string data as C string. More...
 

Static Public Attributes

static const IdType NO_ID = (~static_cast<IdType>(0))
 Numerical identifier used for undefined string definitions. More...
 
static const String UNDEFINED
 Static instance of class String representing undefined string entries in other definitions. More...
 
static const IdType MACHINE_ID = NO_ID - 1
 Numerical identifier used for the String::MACHINE instance. More...
 
static const String MACHINE
 Static instance of class String providing the character string "machine" for the EPIK trace reader. More...
 
static const IdType NODE_ID = NO_ID - 2
 Numerical identifier used for the String::NODE instance. More...
 
static const String NODE
 Static instance of class String providing the character string "node" for the EPIK trace reader. More...
 

Related Functions

(Note that these are not member functions.)

Stream I/O functions
std::ostream & operator<< (std::ostream &stream, const String &item)
 Stream output operator. More...
 
Comparison operators
bool operator== (const String &lhs, const String &rhs)
 Equality operator. More...
 
bool operator!= (const String &lhs, const String &rhs)
 Inequality operator. More...
 

Detailed Description

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.

Member Typedef Documentation

◆ IdType

typedef uint32_t pearl::String::IdType

Constructor & Destructor Documentation

◆ 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
idGlobal string identifier
strAssociated character string

Member Function Documentation

◆ 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

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const String lhs,
const String rhs 
)
related

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
lhsLeft-hand operand
rhsRight-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
streamOutput stream
itemString definition object
Returns
Output stream

◆ operator==()

bool operator== ( const String lhs,
const String rhs 
)
related

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
lhsLeft-hand operand
rhsRight-hand operand
Returns
True if the string definitions are equal, false otherwise.

Member Data Documentation

◆ MACHINE

const String pearl::String::MACHINE
static

◆ MACHINE_ID

const IdType pearl::String::MACHINE_ID = NO_ID - 1
static

◆ NO_ID

const IdType pearl::String::NO_ID = (~static_cast<IdType>(0))
static

◆ NODE

const String pearl::String::NODE
static

◆ NODE_ID

const IdType pearl::String::NODE_ID = NO_ID - 2
static

◆ UNDEFINED

const String pearl::String::UNDEFINED
static

The documentation for this class was generated from the following file:

Scalasca    Copyright © 1998–2019 Forschungszentrum Jülich GmbH, Jülich Supercomputing Centre
Copyright © 2009–2015 German Research School for Simulation Sciences GmbH, Laboratory for Parallel Programming