CommandLineHelpers.cc File Reference

Functions

template<>
std::string helpers::readFromCommandLine< std::string > (int argc, char *argv[], const std::string &varName, std::string value)
 

Function Documentation

◆ helpers::readFromCommandLine< std::string >()

template<>
std::string helpers::readFromCommandLine< std::string > ( int  argc,
char argv[],
const std::string &  varName,
std::string  value 
)
76 {
77  const size_t nDashes = countLeadingDashes(varName);
78  for (int i = 0; i < argc - 1; ++i) {
79  if (varName == argv[i]) {
80  value = argv[i+1];
81  logger(INFO, "readFromCommandLine: % set to % ", varName.substr(nDashes), value);
82  return value;
83  }
84  }
85  //if the variable is not found
86  logger(INFO, "readFromCommandLine: % set to default value % ", varName.substr(nDashes), value);
87  return value;
88 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
#define INFO(i)
Definition: mumps_solver.h:54
squared absolute value
Definition: GlobalFunctions.h:87
std::size_t countLeadingDashes(const std::string &s)
Counts the leading dash ('-') characters in a string.
Definition: CommandLineHelpers.cc:12

References helpers::countLeadingDashes(), i, INFO, logger, and Eigen::value.