QwAnalysis
QwOptions.h File Reference

An options class which parses command line, config file and environment. More...

#include <iostream>
#include <string>
#include <vector>
#include <boost/program_options.hpp>
#include <TString.h>
#include "QwLog.h"
+ Include dependency graph for QwOptions.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  QwOptions
 An options class. More...
 

Macros

#define default_bool_value(b)   default_value(b)
 

Functions

const char * getenv_safe (const char *name)
 
const std::string getenv_safe_string (const char *name)
 
const TString getenv_safe_TString (const char *name)
 

Variables

QwOptions gQwOptions
 

Detailed Description

An options class which parses command line, config file and environment.

Author
Wouter Deconinck
Date
2009-12-01

Definition in file QwOptions.h.

Macro Definition Documentation

Function Documentation

const char* getenv_safe ( const char *  name)
inline

Definition at line 28 of file QwOptions.h.

References QwLog::endl(), QwError, and QwWarning.

Referenced by getenv_safe_string(), getenv_safe_TString(), and main().

28  {
29  if (getenv(name))
30  return getenv(name);
31  else {
32  QwError << "Environment variable " << name << " undefined!" << QwLog::endl;
33  QwWarning << "Using current directory instead." << QwLog::endl;
34  return ".";
35  }
36 }
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::string getenv_safe_string ( const char *  name)
inline

Definition at line 37 of file QwOptions.h.

References getenv_safe().

Referenced by QwTrackingWorker::InitTree(), QwTreeEventBuffer::LoadDriftTimeDistance(), main(), QwComptonElectronDetector::PrintValue(), QwMagneticField::ReadFieldMap(), QwMagneticField::WriteBinaryFile(), and QwMagneticField::WriteTextFile().

37  {
38  return std::string(getenv_safe(name));
39 }
const char * getenv_safe(const char *name)
Definition: QwOptions.h:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const TString getenv_safe_TString ( const char *  name)
inline

Definition at line 40 of file QwOptions.h.

References getenv_safe().

Referenced by ClassImp(), main(), QwTreeEventBuffer::OpenFile(), and QwRootFile::QwRootFile().

40  {
41  return TString(getenv_safe(name));
42 }
const char * getenv_safe(const char *name)
Definition: QwOptions.h:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation