SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ProgressReporterFactory.cpp
Go to the documentation of this file.
1
20
21namespace SourceXtractor {
22
23namespace po = boost::program_options;
24
25static const std::string PROGRESS_MIN_INTERVAL{"progress-min-interval"};
26static const std::string PROGRESS_BAR {"progress-bar"};
27
30
31void ProgressReporterFactory::addOptions(boost::program_options::options_description& options) const {
32 options.add_options() (PROGRESS_MIN_INTERVAL.c_str(), po::value<int>()->default_value(5),
33 "Minimal interval to wait before printing a new log entry with the progress report");
34 options.add_options() (PROGRESS_BAR.c_str(), po::value<bool>()->default_value(true),
35 "Show/Hide progress bar display");
36}
37
40 m_disable_progress_bar = !args.at(PROGRESS_BAR).as<bool>();
41 // If the output is written to stdout, we can't use the terminal for the fancy ncurses interface
42 if (args.at("output-catalog-filename").as<std::string>().empty()) {
44 }
45}
46
48 auto mediator = std::make_shared<ProgressMediator>();
49
50#ifndef WITHOUT_NCURSES
52 auto progress_bar = std::make_shared<ProgressNCurses>();
53 mediator->ProgressObservable::addObserver(progress_bar);
54 mediator->DoneObservable::addObserver(progress_bar);
55 }
56#endif
57 // Always register the logger
59 mediator->ProgressObservable::addObserver(logger);
60 mediator->DoneObservable::addObserver(logger);
61 return mediator;
62}
63
64} // end SourceXtractor
T at(T... args)
std::shared_ptr< ProgressMediator > createProgressMediator(void) const
void addOptions(boost::program_options::options_description &options) const
void configure(const std::map< std::string, boost::program_options::variable_value > &args)
std::chrono::steady_clock::duration m_min_interval
T empty(T... args)
T make_shared(T... args)
static Elements::Logging logger
static const std::string PROGRESS_BAR
static const std::string PROGRESS_MIN_INTERVAL
STL namespace.