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

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

#include <NetworkConfigParser.hpp>

Public Member Functions

 NetworkConfigParser ()
 a class to set the name of the configuration file and extracts and parses the data
 
 NetworkConfigParser (const std::string &fileName)
 
void readData (const std::string &fileName)
 
void setData (const int numberOfConcurrentConnection, const int buffersize, DisCosTiC::Networktype &latency, DisCosTiC::Networktype &inverse_bandwidth, DisCosTiC::Networktype &o, DisCosTiC::Networktype &O, DisCosTiC::Networktype &g, DisCosTiC::Networktype &G, DisCosTiC_Datatype &eagerLimit, const int mode)
 
bool getKey (const std::string &key) const
 
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 parseLine (const std::string &line, size_t const lineNum)
 a function that parse the line by calling above mentioed functions
 

Private Attributes

int dataCounter = 0
 
double networkFileData [1000][8] = {0}
 
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 32 of file NetworkConfigParser.hpp.

Constructor & Destructor Documentation

◆ NetworkConfigParser() [1/2]

UserInterface::NetworkConfigParser::NetworkConfigParser ( )
inline

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

Definition at line 95 of file NetworkConfigParser.hpp.

◆ NetworkConfigParser() [2/2]

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

Definition at line 98 of file NetworkConfigParser.hpp.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getKey()

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

Definition at line 209 of file NetworkConfigParser.hpp.

References data.

Referenced by getValue().

+ Here is the caller graph for this function:

◆ getValue()

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

a function that retrieves the value of a specific key

Definition at line 217 of file NetworkConfigParser.hpp.

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

+ Here is the call graph for this function:

◆ parseLine()

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

a function that parse the line by calling above mentioed functions

Definition at line 60 of file NetworkConfigParser.hpp.

References dataCounter, and networkFileData.

Referenced by NetworkConfigParser(), and readData().

+ Here is the caller graph for this function:

◆ readData()

void UserInterface::NetworkConfigParser::readData ( const std::string & fileName)
inline

Definition at line 124 of file NetworkConfigParser.hpp.

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

Referenced by main().

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

◆ removeComment()

void UserInterface::NetworkConfigParser::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 43 of file NetworkConfigParser.hpp.

Referenced by NetworkConfigParser(), and readData().

+ Here is the caller graph for this function:

◆ setData()

void UserInterface::NetworkConfigParser::setData ( const int numberOfConcurrentConnection,
const int buffersize,
DisCosTiC::Networktype & latency,
DisCosTiC::Networktype & inverse_bandwidth,
DisCosTiC::Networktype & o,
DisCosTiC::Networktype & O,
DisCosTiC::Networktype & g,
DisCosTiC::Networktype & G,
DisCosTiC_Datatype & eagerLimit,
const int mode )
inline

Definition at line 150 of file NetworkConfigParser.hpp.

References dataCounter, and networkFileData.

Referenced by main().

+ Here is the caller graph for this function:

◆ whitespace()

bool UserInterface::NetworkConfigParser::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 52 of file NetworkConfigParser.hpp.

Referenced by NetworkConfigParser(), and readData().

+ Here is the caller graph for this function:

Member Data Documentation

◆ data

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

which will hold pairs of key-value

Definition at line 37 of file NetworkConfigParser.hpp.

Referenced by getKey(), and getValue().

◆ dataCounter

int UserInterface::NetworkConfigParser::dataCounter = 0
private

Definition at line 35 of file NetworkConfigParser.hpp.

Referenced by parseLine(), and setData().

◆ fileName

std::string UserInterface::NetworkConfigParser::fileName
private

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

Definition at line 38 of file NetworkConfigParser.hpp.

Referenced by NetworkConfigParser(), and readData().

◆ networkFileData

double UserInterface::NetworkConfigParser::networkFileData[1000][8] = {0}
private

Definition at line 36 of file NetworkConfigParser.hpp.

Referenced by parseLine(), and setData().


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