diff --git a/decoder/src/macaon_decode.cpp b/decoder/src/macaon_decode.cpp index 6bb6bfcc65d5e43ad16edffd6a774a820d19f834..a253cc0fc0def64a32bbbc36d5da576576a9bd16 100644 --- a/decoder/src/macaon_decode.cpp +++ b/decoder/src/macaon_decode.cpp @@ -37,6 +37,7 @@ po::options_description getOptionsDescription() opt.add_options() ("help,h", "Produce this help message") ("debug,d", "Print infos on stderr") + ("delayedOutput", "Print the output only at the end") ("showActions", "Print actions predicted by each classifier") ("dicts", po::value<std::string>()->default_value(""), "The .dict file describing all the dictionaries to be used in the experiement. By default the filename specified in the .tm file will be used") @@ -140,6 +141,7 @@ int main(int argc, char * argv[]) ProgramParameters::input = vm["input"].as<std::string>(); ProgramParameters::mcdName = vm["mcd"].as<std::string>(); ProgramParameters::debug = vm.count("debug") == 0 ? false : true; + ProgramParameters::delayedOutput = vm.count("delayedOutput") == 0 ? false : true; ProgramParameters::showActions = vm.count("showActions") == 0 ? false : true; ProgramParameters::interactive = vm["interactive"].as<bool>(); ProgramParameters::errorAnalysis = vm.count("errorAnalysis") == 0 ? false : true; diff --git a/maca_common/include/ProgramParameters.hpp b/maca_common/include/ProgramParameters.hpp index f10dfb38bd5d95bccd19b8e8da1c1aa9d76ee65b..8d6df77eb4a010967d8be92459c3611f88d9bfdd 100644 --- a/maca_common/include/ProgramParameters.hpp +++ b/maca_common/include/ProgramParameters.hpp @@ -78,6 +78,7 @@ struct ProgramParameters static bool alwaysSave; static bool noNeuralNetwork; static bool showActions; + static bool delayedOutput; private : diff --git a/maca_common/src/ProgramOutput.cpp b/maca_common/src/ProgramOutput.cpp index 40a2102ada13c819d0e7de622072197e5674d24e..e9bde67e1d68c1afa92e4b7443d52635b37fed0a 100644 --- a/maca_common/src/ProgramOutput.cpp +++ b/maca_common/src/ProgramOutput.cpp @@ -6,6 +6,8 @@ ProgramOutput ProgramOutput::instance; void ProgramOutput::print(FILE * output) { + if (!ProgramParameters::delayedOutput) + return; for (auto & line : matrix) for (unsigned int i = 0; i < line.size(); i++) fprintf(output, "%s%s%s", ProgramParameters::printOutputEntropy ? ("<"+float2str(line[i].second,"%f")+">").c_str() : "", line[i].first.c_str(), i == line.size()-1 ? "\n" : "\t"); @@ -13,6 +15,14 @@ void ProgramOutput::print(FILE * output) void ProgramOutput::addLine(const std::vector< std::pair<std::string, float> > & line, unsigned int index) { + if (!ProgramParameters::delayedOutput) + { + for (unsigned int i = 0; i < line.size(); i++) + fprintf(stdout, "%s%s", line[i].first.c_str(), i == line.size()-1 ? "\n" : "\t"); + + return; + } + while (matrix.size() < index+1) matrix.emplace_back(); diff --git a/maca_common/src/ProgramParameters.cpp b/maca_common/src/ProgramParameters.cpp index 7eea51dd706cfde2f1b9d050be858bc4a6f4659b..e1a872165f94a1bc20da64bfe97590832c33f99e 100644 --- a/maca_common/src/ProgramParameters.cpp +++ b/maca_common/src/ProgramParameters.cpp @@ -72,3 +72,5 @@ float ProgramParameters::randomDebugProbability; bool ProgramParameters::alwaysSave; bool ProgramParameters::noNeuralNetwork; bool ProgramParameters::showActions; +bool ProgramParameters::delayedOutput; +