11 #ifndef ROOT_Math_GenAlgoOptions
12 #define ROOT_Math_GenAlgoOptions
30 class GenAlgoOptions :
public IOptions {
36 virtual ~GenAlgoOptions() {}
45 virtual IOptions * Clone()
const {
46 return new GenAlgoOptions(*
this);
52 virtual bool GetRealValue(
const char * name,
double & val)
const {
53 const double * pval = FindValue(name, fRealOpts);
54 if (!pval)
return false;
59 virtual bool GetIntValue(
const char * name,
int & val)
const {
60 const int * pval = FindValue(name, fIntOpts);
61 if (!pval)
return false;
66 virtual bool GetNamedValue(
const char * name, std::string & val)
const {
67 const std::string * pval = FindValue(name, fNamOpts);
68 if (!pval)
return false;
74 virtual void SetRealValue(
const char * name,
double val) {
75 InsertValue(name, fRealOpts, val);
78 virtual void SetIntValue(
const char * name ,
int val) {
79 InsertValue(name, fIntOpts, val);
82 virtual void SetNamedValue(
const char * name,
const char * val) {
83 InsertValue(name, fNamOpts, std::string(val));
88 virtual void Print(std::ostream & os = std::cout )
const {
99 static IOptions * FindDefault(
const char * algoname);
103 static IOptions & Default(
const char * algoname);
106 static void PrintAllDefault(std::ostream & os = std::cout);
116 static const typename M::mapped_type * FindValue(
const std::string & name,
const M & opts) {
117 typename M::const_iterator pos;
118 pos = opts.find(name);
119 if (pos == opts.end()) {
122 return &((*pos).second);
126 static void InsertValue(
const std::string &name, M & opts,
const typename M::mapped_type & value) {
127 typename M::iterator pos;
128 pos = opts.find(name);
129 if (pos != opts.end()) {
133 opts.insert(
typename M::value_type(name, value) );
138 static void Print(
const M & opts, std::ostream & os) {
140 for (
typename M::const_iterator pos = opts.begin(); pos != opts.end(); ++pos)
141 os << std::setw(25) << pos->first <<
" : " << std::setw(15) << pos->second << std::endl;
145 std::map<std::string, double> fRealOpts;
146 std::map<std::string, int> fIntOpts;
147 std::map<std::string, std::string> fNamOpts;