18#ifndef __FPSDK_COMMON_APP_HPP__
19#define __FPSDK_COMMON_APP_HPP__
175 " -h -- Print program help screen, and exit\n"
176 " -V -- Print program, version and license information, and exit\n"
177 " -v / -q -- Increase / decrease logging verbosity, multiple flags accumulate\n";
184 std::vector<Option> options_;
std::vector< std::string > argv_
argv[] of program
virtual void PrintHelp()=0
Print the help screen and exit(0)
std::string app_name_
App name.
ProgramOptions(const std::string &app_name, const std::vector< Option > &options)
Constructor.
virtual bool CheckOptions(const std::vector< std::string > &args)
Check options, and handle non-flag arguments.
bool LoadFromArgv(int argc, char **argv)
Load arguments from argv[].
static constexpr const char * COMMON_FLAGS_HELP
Help screen for common options.
virtual bool HandleOption(const Option &option, const std::string &argument)=0
Handle a command-line flag argument.
logging::LoggingLevel logging_
Logging verbosity level.
virtual ~ProgramOptions()
Destructor.
Helper to catch SIGINT (CTRL-c)
bool ShouldAbort()
Check if signal was raised and we should abort.
bool WaitAbort(const uint32_t millis=0)
Wait (block) until signal is raised and we should abort.
Helper to print a strack trace on SIGSEGV and SIGABRT.
Fixposition SDK: Logging.
void PrintStacktrace()
Prints a stacktrace to stderr.
LoggingLevel
Logging verbosity levels, default is INFO.
@ INFO
[6/info] Interesting stuff, the default level (for apps)
bool has_argument
True if flag requires an an argument, false if not.
char flag
The flag (reserved: 'h', 'V', 'v', 'q', '?', '*', ':')