DisCostiC v2.0.0
Distributed Cost in Cluster: a cross-architecture simulator for massively parallel MPI programs
Loading...
Searching...
No Matches
UserInterface::ConfigParser Class Reference

a wrapper class which contains functions for parsing the configuration file end class configParser More...

#include <ConfigParser.hpp>

Public Member Functions

 ConfigParser (const std::string &fileName)
 a class to set the name of the configuration file and extracts and parses the data
 
bool getKey (const std::string &key) const
 a function for finding the key
 
template<typename scalarT >
scalarT getValue (const std::string &key, scalarT const &defaultValue=scalarT()) const
 a function that retrieves the value of a specific key
 

Private Member Functions

void removeComment (std::string &line) const
 a function that removes everything from the semicolon (including it) to the end of the line.
 
bool whitespace (const std::string &line) const
 a function that returns false if a non-space character was found, true otherwise. The function is "const" because it does not alter any class member variables.
 
void extractKey (std::string &key, size_t const &sepPos, const std::string &line) const
 a function that extracts the key from the pair of key = value
 
void extractValue (std::string &value, size_t const &sepPos, const std::string &line) const
 a function that extracts the value from the pair of key = value
 
void parseLine (const std::string &line, size_t const lineNum)
 a function that parse the line by calling above mentioed functions
 

Private Attributes

std::map< std::string, std::string > data
 which will hold pairs of key-value
 
std::string fileName
 As member variables, we will only have a std::string, which will hold the name of the configuration file.
 

Detailed Description

a wrapper class which contains functions for parsing the configuration file end class configParser

Definition at line 58 of file ConfigParser.hpp.

Constructor & Destructor Documentation

◆ ConfigParser()

UserInterface::ConfigParser::ConfigParser ( const std::string & fileName)
inline

a class to set the name of the configuration file and extracts and parses the data

Definition at line 121 of file ConfigParser.hpp.

References fileclose, fileName, fileopen, parseLine(), removeComment(), and whitespace().

+ Here is the call graph for this function:

Member Function Documentation

◆ extractKey()

void UserInterface::ConfigParser::extractKey ( std::string & key,
size_t const & sepPos,
const std::string & line ) const
inlineprivate

a function that extracts the key from the pair of key = value

Definition at line 83 of file ConfigParser.hpp.

Referenced by parseLine().

+ Here is the caller graph for this function:

◆ extractValue()

void UserInterface::ConfigParser::extractValue ( std::string & value,
size_t const & sepPos,
const std::string & line ) const
inlineprivate

a function that extracts the value from the pair of key = value

Definition at line 92 of file ConfigParser.hpp.

Referenced by parseLine().

+ Here is the caller graph for this function:

◆ getKey()

bool UserInterface::ConfigParser::getKey ( const std::string & key) const
inline

a function for finding the key

Definition at line 148 of file ConfigParser.hpp.

References data.

Referenced by getValue(), and parseLine().

+ Here is the caller graph for this function:

◆ getValue()

template<typename scalarT >
scalarT UserInterface::ConfigParser::getValue ( const std::string & key,
scalarT const & defaultValue = scalarT() ) const
inline

a function that retrieves the value of a specific key

Definition at line 156 of file ConfigParser.hpp.

References data, getKey(), and UserInterface::Conversion::stringTOScalarT().

Referenced by AST::AST(), DisCosTiC::Benchmark::Benchmark(), UserInterface::ChromeTraceViz::ChromeTraceViz(), DisCosTiC::CompModel::CompModel(), AST::Exec(), AST::execNodeLVL(), UserInterface::ItacVtf::ItacVtf(), main(), NodeModel::NodeModel(), NodeModel::NodeModel(), DisCosTiC::Benchmark::Oneway_PositiveDisplacement(), and UserInterface::TimeRankOP::TimeRankOP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseLine()

void UserInterface::ConfigParser::parseLine ( const std::string & line,
size_t const lineNum )
inlineprivate

a function that parse the line by calling above mentioed functions

Definition at line 102 of file ConfigParser.hpp.

References data, extractKey(), extractValue(), and getKey().

Referenced by ConfigParser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeComment()

void UserInterface::ConfigParser::removeComment ( std::string & line) const
inlineprivate

a function that removes everything from the semicolon (including it) to the end of the line.

Definition at line 67 of file ConfigParser.hpp.

Referenced by ConfigParser().

+ Here is the caller graph for this function:

◆ whitespace()

bool UserInterface::ConfigParser::whitespace ( const std::string & line) const
inlineprivate

a function that returns false if a non-space character was found, true otherwise. The function is "const" because it does not alter any class member variables.

Definition at line 75 of file ConfigParser.hpp.

Referenced by ConfigParser().

+ Here is the caller graph for this function:

Member Data Documentation

◆ data

std::map<std::string, std::string> UserInterface::ConfigParser::data
private

which will hold pairs of key-value

Definition at line 61 of file ConfigParser.hpp.

Referenced by getKey(), getValue(), and parseLine().

◆ fileName

std::string UserInterface::ConfigParser::fileName
private

As member variables, we will only have a std::string, which will hold the name of the configuration file.

Definition at line 62 of file ConfigParser.hpp.

Referenced by ConfigParser().


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