29 #ifndef ROOT_TMVA_Option 30 #define ROOT_TMVA_Option 53 #ifndef ROOT_TMVA_MsgLogger 83 virtual void Print( std::ostream&,
Int_t levelofdetail=0 )
const = 0;
123 virtual void AddPreDefVal(
const T&);
125 virtual void Print ( std::ostream&,
Int_t levelofdetail=0 )
const;
126 virtual void PrintPreDefs( std::ostream&,
Int_t levelofdetail=0 )
const;
133 virtual Bool_t IsPreDefinedValLocal(
const T& )
const;
145 Option<
T>(*ref,name, desc), fVRefPtr(&ref), fSize(size) {}
149 std::stringstream str;
150 str << std::scientific <<
Value(i);
158 virtual void Print( std::ostream&,
Int_t levelofdetail=0 )
const;
185 std::stringstream str;
186 str << std::scientific << this->
Value();
192 return Value() ?
"True" :
"False";
197 return Value(i) ?
"True" :
"False";
205 std::stringstream str(val.
Data());
207 return IsPreDefinedValLocal(tmpVal);
214 if (fPreDefs.size()==0)
return kTRUE;
216 typename std::vector<T>::const_iterator predefIt;
217 predefIt = fPreDefs.begin();
218 for (;predefIt!=fPreDefs.end(); predefIt++)
219 if ( (*predefIt)==val )
return kTRUE;
230 if (fPreDefs.size()==0)
return kFALSE;
232 std::vector<TString>::const_iterator predefIt;
233 predefIt = fPreDefs.begin();
234 for (;predefIt!=fPreDefs.end(); predefIt++) {
237 if (s==tVal) { foundPreDef =
kTRUE;
break; }
247 fPreDefs.push_back(val);
254 Log() <<
kFATAL <<
"<AddPreDefVal> predefined values for Option<Bool_t> don't make sense" 262 Log() <<
kFATAL <<
"<AddPreDefVal> predefined values for Option<Float_t> don't make sense" 271 this->PrintPreDefs(os,levelofdetail);
278 for (
Int_t i=0; i<fSize; i++) {
282 os <<
" " << this->
TheName() <<
"[" << i <<
"]: " <<
"\"" << this->
GetValue(i) <<
"\"";
283 if (i!=fSize-1) os << std::endl;
285 this->PrintPreDefs(os,levelofdetail);
294 os << std::endl <<
"PreDefined - possible values are:" << std::endl;
295 typename std::vector<T>::const_iterator predefIt;
296 predefIt = fPreDefs.begin();
297 for (;predefIt!=fPreDefs.end(); predefIt++) {
299 os <<
" - " << (*predefIt) << std::endl;
309 if (ind >= fSize)
return kFALSE;
310 std::stringstream str(val.
Data());
325 std::stringstream str(val.
Data());
334 if (fPreDefs.size()!=0) {
337 std::vector<TString>::const_iterator predefIt;
338 predefIt = fPreDefs.begin();
339 for (;predefIt!=fPreDefs.end(); predefIt++) {
342 if (s==tVal) { valToSet = *predefIt;
break; }
346 std::stringstream str(valToSet.
Data());
356 if (valToSet==
"1" || valToSet==
"true" || valToSet==
"ktrue" || valToSet==
"t") {
357 this->
Value() =
true;
359 else if (valToSet==
"0" || valToSet==
"false" || valToSet==
"kfalse" || valToSet==
"f") {
360 this->
Value() =
false;
363 Log() <<
kFATAL <<
"<SetValueLocal> value \'" << val
364 <<
"\' can not be interpreted as boolean" <<
Endl;
virtual Int_t GetArraySize() const
const T & Value(Int_t i) const
MsgLogger & Endl(MsgLogger &ml)
virtual const T & Value(Int_t i=-1) const
virtual void Print(std::ostream &, Int_t levelofdetail=0) const
virtual Bool_t IsPreDefinedValLocal(const T &) const
virtual void Print(std::ostream &, Int_t levelofdetail=0) const =0
const TString & Description() const
Option(T *&ref, Int_t size, const TString &name, const TString &desc)
virtual Bool_t IsArrayOpt() const =0
void ToLower()
Change string to lower-case.
virtual Int_t GetArraySize() const
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual TString GetValue(Int_t i=-1) const =0
virtual void AddPreDefVal(const T &)
#define ClassDef(name, id)
virtual Bool_t IsPreDefinedVal(const TString &) const
OptionBase(const TString &name, const TString &desc)
constructor
virtual void PrintPreDefs(std::ostream &, Int_t levelofdetail=0) const
virtual TString GetValue(Int_t i=-1) const
virtual void SetValueLocal(const TString &val, Int_t i=-1)
virtual Bool_t SetValue(const TString &vs, Int_t i=-1)
set value for option
TString GetValue(Int_t i) const
virtual Bool_t IsArrayOpt() const
virtual Bool_t HasPreDefinedVal() const =0
virtual Int_t GetArraySize() const =0
Option(T &ref, const TString &name, const TString &desc)
virtual Bool_t IsArrayOpt() const
const TString fDescription
virtual const char * GetName() const
Returns name of object.
virtual const char * TheName() const
virtual Bool_t HasPreDefinedVal() const
virtual Bool_t IsPreDefinedVal(const TString &) const =0
Mother of all ROOT objects.
Abstract ClassifierFactory template that handles arbitrary types.
virtual void SetValueLocal(const TString &vs, Int_t i=-1)=0
std::vector< T > fPreDefs
const char * Data() const