add -W [ --warn ] flag to output warning messages, update cppgtfs

This commit is contained in:
Patrick Brosi 2024-01-30 12:51:22 +01:00
parent a078b22e18
commit ad0252695f
6 changed files with 79 additions and 27 deletions

View file

@ -111,6 +111,8 @@ void ConfigReader::help(const char* bin) {
<< "Disable hop cache \n"
<< std::setw(35) << " --stats"
<< "write stats to stats.json\n"
<< std::setw(35) << " -W [ --warn ]"
<< "enable verbose warning messages\n"
<< std::setw(35) << " -P"
<< "additional parameter string (in cfg file format)\n";
}
@ -144,11 +146,12 @@ void ConfigReader::read(Config* cfg, int argc, char** argv) {
{"stats", no_argument, 0, 14},
{"no-hop-cache", no_argument, 0, 15},
{"gaussian-noise", required_argument, 0, 16},
{"warn", no_argument, 0, 'W'},
{"keep-additional-gtfs-fields", no_argument, 0, 'F'},
{0, 0, 0, 0}};
int c;
while ((c = getopt_long(argc, argv, ":o:hvi:c:x:Dm:g:X:T:d:pP:F", ops, 0)) !=
while ((c = getopt_long(argc, argv, ":o:hvi:c:x:Dm:g:X:T:d:pP:FW", ops, 0)) !=
-1) {
switch (c) {
case 1:
@ -220,6 +223,9 @@ void ConfigReader::read(Config* cfg, int argc, char** argv) {
case 16:
cfg->gaussianNoise = atof(optarg);
break;
case 'W':
cfg->verbosity = 1;
break;
case 'F':
cfg->parseAdditionalGTFSFields = true;
break;

View file

@ -39,7 +39,8 @@ struct Config {
writeStats(false),
parseAdditionalGTFSFields(false),
gridSize(2000 / util::geo::M_PER_DEG),
gaussianNoise(0) {}
gaussianNoise(0),
verbosity(0) {}
std::string dbgOutputPath;
std::string solveMethod;
std::string shapeTripId;
@ -67,6 +68,7 @@ struct Config {
bool parseAdditionalGTFSFields;
double gridSize;
double gaussianNoise;
uint8_t verbosity;
std::string toString() {
std::stringstream ss;
@ -88,6 +90,7 @@ struct Config {
<< "no-a-star: " << noAStar << "\n"
<< "no-trie: " << noTrie << "\n"
<< "no-hop-cache: " << noHopCache << "\n"
<< "verbosity: " << verbosity << "\n"
<< "parse-additional-gtfs-fields: " << parseAdditionalGTFSFields << "\n"
<< "write-stats: " << writeStats << "\n"
<< "feed-paths: ";