22#include <boost/program_options.hpp>
23namespace po = boost::program_options;
31#define gQwOptions QwOptions::Instance()
54#define default_bool_value(b) default_value(b)->implicit_value(true)
169 po::options_description_easy_init
170 AddOptions(
const std::string& blockname =
"Specialized options") {
179 fOptionBlock.push_back(
new po::options_description(blockname));
195 void SetCommandLine(
int argc,
char* argv[],
bool default_config_file =
true);
205 for (
size_t i = 0; i < configfiles.size(); i++)
const char * getenv_safe(const char *name)
const std::string getenv_safe_string(const char *name)
const TString getenv_safe_TString(const char *name)
A logfile class, based on an identical class in the Hermes analyzer.
#define QwVerbose
Predefined log drain for verbose messages.
#define QwError
Predefined log drain for errors.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
static std::ostream & endl(std::ostream &)
End of the line.
Command-line and configuration file options processor.
void ParseCommandLine()
Parse the command line arguments.
static void DefineOptions(QwOptions &options)
Define the options.
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
static QwOptions & Instance()
Get instance.
QwOptions()
Private default constructor.
virtual ~QwOptions()
Default destructor.
void ParseConfigFile()
Parse the configuration file.
int GetArgc()
Get the number of command line arguments.
void SetConfigFile(const std::string &configfile)
Set a configuration file.
static QwOptions * fInstance
QwOptions(QwOptions const &)
Private copy constructor, not implemented.
int GetIntValuePairFirst(const std::string &key)
Get the first of a pair of integer values.
std::vector< std::string > fOptionBlockName
int fArgc
Command line arguments.
std::pair< int, int > GetIntValuePair(const std::string &key)
Get a pair of integer values.
void SetCommandLine(int argc, char *argv[], bool default_config_file=true)
Set the command line arguments.
po::options_description_easy_init AddDefaultOptions()
Add a default option.
po::options_description * CombineOptions()
Combine the various option description in one.
void AddConfigFile(const std::string &configfile)
Add a configuration file.
void AddConfigFile(std::vector< std::string > configfiles)
Add some configuration files.
T GetValue(const std::string &key)
Get a templated value.
int GetIntValuePairLast(const std::string &key)
Get the last of a pair of integer values.
void Usage()
Print usage information.
void Parse(bool force=false)
Parse all sources of options.
void Version()
Print version string.
void ParseEnvironment()
Parse the environment variables.
po::variables_map fVariablesMap
QwOptions & operator=(QwOptions const &)
Private assignment operator, not implemented.
std::vector< std::string > fConfigFiles
Configuration file.
void ListConfigFiles()
List the configuration files.
bool HasValue(const std::string &key)
Has this key been defined.
void Clear()
Clear the parsed variables.
char ** GetArgv()
Get the vector of command line arguments.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
std::vector< po::options_description * > fOptionBlock