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

Representation of a source-code location definition. More...

#include <pearl/SourceLocation.h>

Public Types

typedef uint32_t IdType
 Source-code location definition identifier type. More...
 

Public Member Functions

Constructors & destructor
 SourceLocation (IdType id, const String &filename, const uint32_t line)
 Constructor. More...
 
Access definition data
IdType getId () const
 Get global identifier. More...
 
const StringgetFilename () const
 Get filename. More...
 
uint32_t getLine () const
 Get line number. More...
 

Static Public Attributes

static const IdType NO_ID = (~static_cast<IdType>(0))
 Numerical identifier used for undefined source-code location definitions. More...
 
static const SourceLocation UNDEFINED
 Static instance of class SourceLocation representing undefined source-code location entries in other definitions. More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

Instances of the SourceLocation class provide information about a particular location in the source code with line granularity. Source locations are characterized by a file name and a line number within the corresponding file. The numerical identifiers of the individual source-code locations are globally defined and continuously enumerated, i.e., the ID is element of [0,#sourceLocations-1].

Member Typedef Documentation

◆ IdType

Constructor & Destructor Documentation

◆ SourceLocation()

pearl::SourceLocation::SourceLocation ( IdType  id,
const String filename,
const uint32_t  line 
)

Creates a new source-code location definition instance and initializes it with the given values.

Parameters
idGlobal source-code location identifier
filenameName of source file (String::UNDEFINED if unknown)
lineLine number within filename (zero if unknown)

Member Function Documentation

◆ getFilename()

const String& pearl::SourceLocation::getFilename ( ) const

Returns the string definition storing the name of the source-code file.

Returns
Filename if available, String::UNDEFINED otherwise

◆ getId()

IdType pearl::SourceLocation::getId ( ) const

Returns the global identifier of the source-code location definition.

Returns
Global identifier

◆ getLine()

uint32_t pearl::SourceLocation::getLine ( ) const

Returns the line number within the source file.

Returns
Line number if available, zero otherwise

Friends And Related Function Documentation

◆ operator!=()

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

Compares two source-code location definition objects lhs and rhs for inequality. Two source-code location definitions are considered unequal if any of their attributes differs.

Parameters
lhsLeft-hand operand
rhsRight-hand operand
Returns
True if the source-code location definitions differ, false otherwise

◆ operator<<()

std::ostream & operator<< ( std::ostream &  stream,
const SourceLocation item 
)
related

Prints the contents of the given source-code location definition object item to an output stream in a human-readable form.

Parameters
streamOutput stream
itemSource-code location definition object
Returns
Output stream

◆ operator==()

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

Compares two source-code location definition objects lhs and rhs for equality. Two source-code location definitions are considered equal if all of their attributes are identical.

Parameters
lhsLeft-hand operand
rhsRight-hand operand
Returns
True if the source-code location definitions are equal, false otherwise

Member Data Documentation

◆ NO_ID

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

◆ UNDEFINED

const SourceLocation pearl::SourceLocation::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