29#ifndef ROOT_TMVA_Option
30#define ROOT_TMVA_Option
74 virtual void Print( std::ostream&,
Int_t levelofdetail=0 )
const = 0;
116 void Print ( std::ostream&,
Int_t levelofdetail=0 )
const override;
140 std::stringstream str;
141 str << std::scientific << Value(i);
144 const T&
Value(
Int_t i )
const override {
return (*fVRefPtr)[i]; }
149 void Print( std::ostream&,
Int_t levelofdetail=0 )
const override;
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());
304 for (
Int_t i=1; i<
fSize; i++) Value(i) = Value(0);
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
bool Bool_t
Boolean (0=false, 1=true) (bool)
float Float_t
Float 4 bytes (float)
#define ClassDefOverride(name, id)
ostringstream derivative to redirect and format output
Class for TMVA-option handling.
virtual const char * TheName() const
const char * GetName() const override
Returns name of object.
OptionBase(const TString &name, const TString &desc)
constructor
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 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)
Int_t GetArraySize() const override
Bool_t IsArrayOpt() const override
TString GetValue(Int_t i) const override
const T & Value(Int_t i) const override
virtual void PrintPreDefs(std::ostream &, Int_t levelofdetail=0) const
Bool_t IsArrayOpt() const override
TString GetValue(Int_t i=-1) const override
void Print(std::ostream &, Int_t levelofdetail=0) const override
std::vector< T > fPreDefs
virtual void AddPreDefVal(const T &)
Option(T &ref, const TString &name, const TString &desc)
void SetValueLocal(const TString &val, Int_t i=-1) override
Int_t GetArraySize() const override
virtual const T & Value(Int_t i=-1) const
Bool_t IsPreDefinedVal(const TString &) const override
virtual Bool_t IsPreDefinedValLocal(const T &) const
Bool_t HasPreDefinedVal() const override
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)