18 #include <boost/program_options.hpp>
48 #if BOOST_VERSION >= 103500
49 #define default_bool_value(b) default_value(b)->implicit_value(true)
51 #define default_bool_value(b) default_value(b)
149 QwOptions(
int argc,
char* argv[],
const std::string& configfile) {
163 po::options_description_easy_init
164 AddOptions(
const std::string& blockname =
"Specialized options") {
173 fOptionBlock.push_back(
new po::options_description(blockname));
189 void SetCommandLine(
int argc,
char* argv[],
bool default_config_file =
true);
200 QwMessage <<
"Adding user-defined configuration file "
208 for (
size_t i = 0; i < configfiles.size(); i++)
327 #endif // QWOPTIONS_H
int GetIntValuePairFirst(const std::string &key)
Get the first of a pair of integer values.
#define QwMessage
Predefined log drain for regular messages.
QwOptions(int argc, char *argv[])
Constructor with command line arguments.
void ParseCommandLine()
Parse the command line arguments.
std::vector< po::options_description * > fOptionBlock
std::vector< std::string > fOptionBlockName
const TString getenv_safe_TString(const char *name)
bool HasValue(const std::string &key)
Has this key been defined.
po::options_description_easy_init AddDefaultOptions()
Add a default option.
void ParseConfigFile()
Parse the configuration file.
QwOptions()
Default constructor.
std::vector< T > GetValueVector(const std::string &key)
Get a list of templated values.
QwOptions(const std::string &configfile)
Constructor with configuration file.
virtual ~QwOptions()
Default destructor.
#define QwVerbose
Predefined log drain for verbose messages.
char ** GetArgv()
Get the vector of command line arguments.
std::vector< std::string > fConfigFiles
Configuration file.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
void ParseEnvironment()
Parse the environment variables.
T GetValue(const std::string &key)
Get a templated value.
void Usage()
Print usage information.
void ListConfigFiles()
List the configuration files.
std::pair< int, int > GetIntValuePair(const std::string &key)
Get a pair of integer values.
void SetConfigFile(const std::string &configfile)
Set a configuration file.
const char * getenv_safe(const char *name)
A logfile class, based on an identical class in the Hermes analyzer.
void Version()
Print version string.
void AddConfigFile(const std::string &configfile)
Add a configuration file.
QwOptions(int argc, char *argv[], const std::string &configfile)
Constructor with command line arguments and configuration file.
void Parse(bool force=false)
Parse all sources of options.
void AddConfigFile(std::vector< std::string > configfiles)
Add some configuration files.
po::options_description * CombineOptions()
Combine the various option description in one.
static const double T
Magnetic field: base unit is T.
int GetArgc()
Get the number of command line arguments.
void Clear()
Clear the parsed variables.
static std::ostream & endl(std::ostream &)
End of the line.
const std::string getenv_safe_string(const char *name)
#define QwWarning
Predefined log drain for warnings.
static void DefineOptions(QwOptions &options)
Define the options.
static int fArgc
Command line arguments.
int GetIntValuePairLast(const std::string &key)
Get the last of a pair of integer values.
po::variables_map fVariablesMap
#define QwError
Predefined log drain for errors.
void SetCommandLine(int argc, char *argv[], bool default_config_file=true)
Set the command line arguments.