29#ifndef ROOT_TMVA_Option
30#define ROOT_TMVA_Option
74 virtual void Print( std::ostream&,
Int_t levelofdetail=0 )
const = 0;
116 virtual void Print ( std::ostream&,
Int_t levelofdetail=0 )
const;
140 std::stringstream str;
141 str << std::scientific <<
Value(i);
149 virtual void Print( std::ostream&,
Int_t levelofdetail=0 )
const;
176 std::stringstream str;
177 str << std::scientific << this->
Value();
183 return Value() ?
"True" :
"False";
188 return Value(i) ?
"True" :
"False";
196 std::stringstream str(val.
Data());
198 return IsPreDefinedValLocal(tmpVal);
205 if (fPreDefs.size()==0)
return kTRUE;
207 typename std::vector<T>::const_iterator predefIt;
208 predefIt = fPreDefs.begin();
209 for (;predefIt!=fPreDefs.end(); predefIt++)
210 if ( (*predefIt)==val )
return kTRUE;
221 if (fPreDefs.size()==0)
return kFALSE;
223 std::vector<TString>::const_iterator predefIt;
224 predefIt = fPreDefs.begin();
225 for (;predefIt!=fPreDefs.end(); predefIt++) {
228 if (s==tVal) { foundPreDef =
kTRUE;
break; }
238 fPreDefs.push_back(val);
245 Log() << kFATAL <<
"<AddPreDefVal> predefined values for Option<Bool_t> don't make sense"
253 Log() << kFATAL <<
"<AddPreDefVal> predefined values for Option<Float_t> don't make sense"
261 os << TheName() <<
": " <<
"\"" << GetValue() <<
"\"" <<
" [" << Description() <<
"]";
262 this->PrintPreDefs(os,levelofdetail);
271 os << this->TheName() <<
"[" << i <<
"]: " <<
"\"" << this->GetValue(i) <<
"\"" <<
" [" << this->Description() <<
"]";
273 os <<
" " << this->TheName() <<
"[" << i <<
"]: " <<
"\"" << this->GetValue(i) <<
"\"";
274 if (i!=
fSize-1) os << std::endl;
276 this->PrintPreDefs(os,levelofdetail);
284 if (HasPreDefinedVal() && levelofdetail>0) {
285 os << std::endl <<
"PreDefined - possible values are:" << std::endl;
286 typename std::vector<T>::const_iterator predefIt;
287 predefIt = fPreDefs.begin();
288 for (;predefIt!=fPreDefs.end(); predefIt++) {
290 os <<
" - " << (*predefIt) << std::endl;
301 std::stringstream str(val.
Data());
316 std::stringstream str(val.
Data());
325 if (fPreDefs.size()!=0) {
328 std::vector<TString>::const_iterator predefIt;
329 predefIt = fPreDefs.begin();
330 for (;predefIt!=fPreDefs.end(); predefIt++) {
333 if (s==tVal) { valToSet = *predefIt;
break; }
337 std::stringstream str(valToSet.
Data());
347 if (valToSet==
"1" || valToSet==
"true" || valToSet==
"ktrue" || valToSet==
"t") {
348 this->
Value() =
true;
350 else if (valToSet==
"0" || valToSet==
"false" || valToSet==
"kfalse" || valToSet==
"f") {
351 this->
Value() =
false;
354 Log() << kFATAL <<
"<SetValueLocal> value \'" << val
355 <<
"\' can not be interpreted as boolean" <<
Endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDef(name, id)
ostringstream derivative to redirect and format output
Class for TMVA-option handling.
virtual const char * TheName() const
virtual Bool_t SetValue(const TString &vs, Int_t i=-1)
set value for option
virtual Bool_t IsPreDefinedVal(const TString &) const =0
virtual Bool_t IsArrayOpt() const =0
const TString fDescription
virtual void SetValueLocal(const TString &vs, Int_t i=-1)=0
virtual Bool_t HasPreDefinedVal() const =0
const TString & Description() const
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetArraySize() const =0
virtual void Print(std::ostream &, Int_t levelofdetail=0) const =0
virtual TString GetValue(Int_t i=-1) const =0
Option(T *&ref, Int_t size, const TString &name, const TString &desc)
TString GetValue(Int_t i) const
virtual Int_t GetArraySize() const
const T & Value(Int_t i) const
virtual Bool_t IsArrayOpt() const
virtual void PrintPreDefs(std::ostream &, Int_t levelofdetail=0) const
virtual Bool_t HasPreDefinedVal() const
virtual void SetValueLocal(const TString &val, Int_t i=-1)
virtual Bool_t IsPreDefinedVal(const TString &) const
virtual TString GetValue(Int_t i=-1) const
std::vector< T > fPreDefs
virtual void AddPreDefVal(const T &)
virtual void Print(std::ostream &, Int_t levelofdetail=0) const
Option(T &ref, const TString &name, const TString &desc)
virtual Int_t GetArraySize() const
virtual Bool_t IsArrayOpt() const
virtual const T & Value(Int_t i=-1) const
virtual Bool_t IsPreDefinedValLocal(const T &) const
Mother of all ROOT objects.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
void ToLower()
Change string to lower-case.
const char * Data() const
create variable transformations
MsgLogger & Endl(MsgLogger &ml)