9#if __STDC_VERSION__ < 199901L
11# define __func__ __FUNCTION__
13# define __func__ "<unknown>"
32#ifdef __USE_DATABASE__
59 AddDefaultOptions()(
"config,c", po::value<std::string>(),
"read ONLY this config file\n(will override default config files)");
60 AddDefaultOptions()(
"add-config,a", po::value<std::vector<std::string> >()->composing(),
"read ALSO this config file\n(will keep the default config files)");
74#ifdef __USE_DATABASE__
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)
149 QwWarning <<
"Overriding the default configuration files with "
150 <<
"user-defined configuration file "
163 Bool_t notfound = kTRUE;
171 QwMessage <<
"Adding user-defined configuration file "
188 po::options_description* options =
new po::options_description(
"options");
207 po::store(po::command_line_parser(
fArgc,
fArgv).options(*command_line_options).allow_unregistered().run(),
fVariablesMap);
208 delete command_line_options;
209 }
catch (std::exception
const& e) {
246 name_mapper(
const std::string& prefix,
const std::string& ignore)
247 : prefix(prefix),ignore(ignore) { }
248 std::string operator()(
const std::string& s) {
250 if (s.find(prefix) == 0) {
251 for(string::size_type n = prefix.size(); n < s.size(); ++n) {
252 lc +=
static_cast<char>(tolower(s[n]));
255 if (ignore.find(lc) == std::string::npos)
return lc;
259 std::string prefix, ignore;
260 } qw_name_mapper(
"QW_",
"bin fieldmap lib lookup prminput searchtree tmp");
264 po::store(po::parse_environment(*environment_options, qw_name_mapper),
fVariablesMap);
265 delete environment_options;
266 }
catch (std::exception
const& e) {
282 std::stringstream configstream;
283 configstream << configfile.
rdbuf();
289 po::store(po::parse_config_file(configstream, *config_file_options,
true),
291 delete config_file_options;
292 }
catch (std::exception
const& e) {
293 QwWarning << e.what() <<
" while parsing configuration file "
327 TString root_version = gROOT->GetVersion();
328 root_version +=
", Date : ";
329 root_version += gROOT->GetVersionDate();
330#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0)
331 root_version +=
", SVN : ";
332 root_version += gROOT->GetSvnRevision();
334 root_version += gROOT->GetSvnBranch();
336 root_version +=
", GIT : ";
337 root_version += gROOT->GetGitCommit();
339 root_version += gROOT->GetGitBranch();
359 std::pair<int, int> mypair;
A class for handling connections to the Qweak database.
Helper functions and utilities for ROOT histogram management.
An options class which parses command line, config file and environment.
A logfile class, based on an identical class in the Hermes analyzer.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
#define QwDebug
Predefined log drain for debugging output.
Array container for managing multiple subsystems.
ROOT file and tree management wrapper classes.
Parameter file parsing and management.
EPICS data event handling and storage.
Event buffer management for reading and processing CODA data.
const char *const gGitInfo
static void DefineOptions(QwOptions &options)
Defines available class options for QwOptions.
static void DefineOptions(QwOptions &options)
Define the configuration options.
static void DefineOptions(QwOptions &options)
static void DefineOptions(QwOptions &options)
Define the configuration options.
static std::ostream & endl(std::ostream &)
End of the line.
static void DefineOptions(QwOptions *options)
Define available class options for QwOptions.
Command-line and configuration file options processor.
void ParseCommandLine()
Parse the command line arguments.
static void DefineOptions(QwOptions &options)
Define the options.
QwOptions()
Private default constructor.
virtual ~QwOptions()
Default destructor.
void ParseConfigFile()
Parse the configuration file.
void SetConfigFile(const std::string &configfile)
Set a configuration file.
static QwOptions * fInstance
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 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
std::vector< std::string > fConfigFiles
Configuration file.
std::vector< po::options_description * > fOptionBlock
Configuration file parser with flexible tokenization and search capabilities.
std::streambuf * rdbuf() const
Access the streambuf pointer in the same way as on a std::ifstream.
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 the configuration options.
static void DefineOptions(QwOptions &options)
Define configuration options for global array.