JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
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
 Command-line and configuration file options processor. More...
 

Macros

#define gQwOptions   QwOptions::Instance()
 
#define default_bool_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)
 

Detailed Description

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

Command-line options processing using Boost.Program_options.

Author
Wouter Deconinck
Date
2009-12-01

Definition in file QwOptions.h.

Macro Definition Documentation

◆ default_bool_value

#define default_bool_value ( b)
Value:
default_value(b)->implicit_value(true)

Definition at line 54 of file QwOptions.h.

◆ gQwOptions

#define gQwOptions   QwOptions::Instance()

Function Documentation

◆ getenv_safe()

const char * getenv_safe ( const char * name)
inline

Definition at line 34 of file QwOptions.h.

34 {
35 if (getenv(name))
36 return getenv(name);
37 else {
38 QwError << "Environment variable " << name << " undefined!" << QwLog::endl;
39 QwWarning << "Using current directory instead." << QwLog::endl;
40 return ".";
41 }
42}
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297

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

Referenced by getenv_safe_string(), and getenv_safe_TString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getenv_safe_string()

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

Definition at line 43 of file QwOptions.h.

43 {
44 return std::string(getenv_safe(name));
45}
const char * getenv_safe(const char *name)
Definition QwOptions.h:34

References getenv_safe().

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getenv_safe_TString()

const TString getenv_safe_TString ( const char * name)
inline

Definition at line 46 of file QwOptions.h.

46 {
47 return TString(getenv_safe(name));
48}

References getenv_safe().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: