9 #if __STDC_VERSION__ < 199901L
11 # define __func__ __FUNCTION__
13 # define __func__ "<unknown>"
32 #include "QwSVNVersion.h"
61 AddDefaultOptions()(
"config,c", po::value<std::string>(),
"read ONLY this config file\n(will override default config files)");
62 AddDefaultOptions()(
"add-config,a", po::value<std::vector<std::string> >(),
"read ALSO this config file\n(will keep the default config files)");
119 for (
int i = 0; i < argc; i++) {
128 if (
fArgc > 0 && default_config_file) {
129 std::string path =
fArgv[0];
132 size_t pos = path.find_last_of(
'/');
133 if (pos != std::string::npos)
154 po::options_description* options =
new po::options_description(
"options");
169 #if BOOST_VERSION >= 103300
174 po::store(po::command_line_parser(
fArgc,
fArgv).options(*command_line_options).allow_unregistered().run(),
fVariablesMap);
175 delete command_line_options;
176 }
catch (std::exception
const&
e) {
182 #if BOOST_VERSION < 103300
189 delete command_line_options;
190 }
catch (std::exception
const& e) {
214 QwWarning <<
"Overriding the default configuration files with "
215 <<
"user-defined configuration file "
233 po::store(po::parse_environment(*environment_options,
"Qw"),
fVariablesMap);
234 delete environment_options;
235 }
catch (std::exception
const&
e) {
251 std::stringstream configstream;
252 configstream << configfile.
rdbuf();
255 #if BOOST_VERSION >= 103500
259 po::store(po::parse_config_file(configstream, *config_file_options,
true),
261 delete config_file_options;
266 po::store(po::parse_config_file(configstream, *config_file_options),
268 delete config_file_options;
270 }
catch (std::exception
const&
e) {
271 QwWarning << e.what() <<
" while parsing configuration file "
273 #if BOOST_VERSION < 103500
303 TString root_version = gROOT->GetVersion();
304 root_version +=
", Date : ";
305 root_version += gROOT->GetVersionDate();
306 #if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
307 root_version +=
", SVN : ";
308 root_version += gROOT->GetSvnRevision();
310 root_version += gROOT->GetSvnBranch();
311 #else // ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
312 root_version +=
", GIT : ";
313 root_version += gROOT->GetGitCommit();
315 root_version += gROOT->GetGitBranch();
334 std::pair<int, int> mypair;
#define QwMessage
Predefined log drain for regular messages.
void ParseCommandLine()
Parse the command line arguments.
std::vector< po::options_description * > fOptionBlock
#define QWANA_SVN_REVISION
std::streambuf * rdbuf() const
Access the streambuf pointer in the same way as on a std::ifstream.
std::vector< std::string > fOptionBlockName
static void DefineOptions(QwOptions &options)
Define the configuration options.
po::options_description_easy_init AddDefaultOptions()
Add a default option.
void ParseConfigFile()
Parse the configuration file.
QwOptions()
Default constructor.
A class for handling connections to the Qweak database.
virtual ~QwOptions()
Default destructor.
#define QWANA_SVN_LASTCHANGEDREVISION
std::vector< std::string > fConfigFiles
Configuration file.
void ParseEnvironment()
Parse the environment variables.
void Usage()
Print usage information.
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.
#define QwDebug
Predefined log drain for debugging output.
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.
static void DefineOptions(QwOptions *options)
Define available class options for QwOptions.
void Parse(bool force=false)
Parse all sources of options.
static void DefineOptions(QwOptions &options)
Define the configuration options.
static void DefineOptions(QwOptions &options)
po::options_description * CombineOptions()
Combine the various option description in one.
static std::pair< int, int > ParseIntRange(const std::string &separatorchars, const std::string &range)
Parse a range of integers as #:# where either can be missing.
static void DefineOptions(QwOptions &options)
Define configuration options for global array.
static std::ostream & endl(std::ostream &)
End of the line.
An options class which parses command line, config file and environment.
#define QwWarning
Predefined log drain for warnings.
static void DefineOptions(QwOptions &options)
Defines available class options for QwOptions.
static void DefineOptions(QwOptions &options)
Define the options.
static int fArgc
Command line arguments.
po::variables_map fVariablesMap
static void DefineOptions(QwOptions &options)
Define the configuration options.
void SetCommandLine(int argc, char *argv[], bool default_config_file=true)
Set the command line arguments.