PEARL
Parallel Event Access and Replay Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Attributes | Related Functions
pearl::String Class Reference

Representation of a string definition. More...

#include <pearl/String.h>

List of all members.

Public Types

typedef uint32_t IdType
 String definition identifier type.

Public Member Functions

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

Static Public Attributes

static const IdType NO_ID = (~static_cast<IdType>(0))
 Numerical identifier used for undefined string definitions.
static const String UNDEFINED
static const IdType MACHINE_ID = NO_ID - 1
 Numerical identifier used for the String::MACHINE instance.
static const String MACHINE
static const IdType NODE_ID = NO_ID - 2
 Numerical identifier used for the String::NODE instance.
static const String NODE

Related Functions

(Note that these are not member functions.)

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

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

typedef uint32_t pearl::String::IdType

Constructor & Destructor Documentation

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

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

Returns the global identifier of the string definition.

Returns:
Global identifier
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

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.
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
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

Static instance of class String providing the character string "machine" for the EPIK trace reader.

const IdType pearl::String::MACHINE_ID = NO_ID - 1 [static]
const IdType pearl::String::NO_ID = (~static_cast<IdType>(0)) [static]
const String pearl::String::NODE [static]

Static instance of class String providing the character string "node" for the EPIK trace reader.

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

Static instance of class String representing undefined string entries in other definitions.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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