25 #ifndef __ParamTypes_hh__
26 #define __ParamTypes_hh__
28 #include <Base/Common/BIASpragmaStart.hh>
30 #include <Base/Debug/Error.hh>
31 #include <Base/Math/Vector.hh>
32 #include <Base/Common/FileHandling.hh>
65 virtual int SetFromString(
const std::string &s);
69 virtual std::string GetHint(){
return "NOVAL";};
116 else if ((s==
"1") || (s==
"=1"))
126 virtual std::string
GetHint(){
return "true / false";};
152 int newval = atoi(s.c_str());
153 if ( newval < min_ ){
154 BIASWARN(
"Value for '"<<Name_<<
"' clipped to "<<min_<<std::endl);
157 else if (newval > max_ ) {
158 BIASWARN(
"Value for '"<<Name_<<
"' clipped to "<<max_<<std::endl);
161 else value_ = newval;
168 std::ostringstream oss;oss<<value_;
return oss.str();
173 std::ostringstream oss;oss<<
"[ "<<min_<<
" .. "<<max_<<
" ]";
197 double newval = atof(s.c_str());
198 if ( newval < min_ ){
199 BIASWARN(
"Value for '"<<Name_<<
"' clipped to "<<min_<<std::endl);
202 else if (newval > max_ ) {
203 BIASWARN(
"Value for '"<<Name_<<
"' clipped to "<<max_<<std::endl);
206 else value_ = newval;
211 std::ostringstream oss;oss<<value_;
return oss.str();};
213 std::ostringstream oss;oss<<
"[ "<<min_<<
" .. "<<max_<<
" ]";
239 std::ostringstream oss;oss<<
" def: "<<default_;
259 std::istringstream iss(s);
268 value_.newsize(length);
270 std::istringstream iss2(s);
271 for(
unsigned int i=0; i<value_.Size(); i++) {
272 iss2 >> x; value_[i] = x;
279 std::ostringstream oss; oss<<
"\"";
280 for (
int i=0;i<value_.size(); i++) {
282 if (i<value_.size()-1) oss <<
" ";
306 std::istringstream iss(s);
315 value_.newsize(length);
317 std::istringstream iss2(s);
318 for(
unsigned int i=0; i<value_.Size(); i++) {
319 iss2 >> x; value_[i] = x;
325 std::ostringstream oss; oss<<
"\"";
326 for (
int i=0;i<value_.size(); i++) {
328 if (i<value_.size()-1) oss <<
" ";
349 std::map<std::string,int>
Map_;
353 std::map<std::string,int>::iterator it;
354 if ( (it=Map_.find(s)) ==Map_.end() ) {
355 BIASERR(
"Identifier for '" <<Name_<<
"' is not valid. Using default.")
358 else value_ = it->second;
363 std::ostringstream oss;
364 std::map<std::string,int>::iterator it;
365 for (it=Map_.begin();it!=Map_.end(); it++)
366 if ( it->second == value_ ) oss<<it->first;
370 std::ostringstream oss;
371 std::map<std::string,int>::iterator it;
372 for (it=Map_.begin();it!=Map_.end(); it++){
373 if (it!=Map_.begin()) oss<<
", ";
381 #include <Base/Common/BIASpragmaEnd.hh>
virtual std::string GetValueString()
bool Enhanced_
hide this parameter from the 'naive' user
bool WriteToFile_
is only written to parameter file if true
virtual std::string GetValueString()
virtual std::string GetTypeName()
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
void SetDefault()
resets to default value
virtual std::string GetHint()
ParamCallbackInterface * CallbackObject_
if some one changed a parameter, we should call CallbackObject_->ParameterChanged(Name_); ...
virtual void SetDefault()
BIAS::Vector< int > value_
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
This file holds the definitions of the parameter types used by BIAS::Param.
virtual std::string GetHint()
virtual std::string GetValueString()
std::map< std::string, int > Map_
virtual std::string GetValueString()
virtual std::string GetHint()
virtual std::string GetHint()
This class provides an interface to be called if parameter changes occured.
virtual std::string GetTypeName()
virtual ~ParamTypeVecDbl()
virtual std::string GetValueString()
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
BIAS::Vector< int > default_
virtual std::string GetTypeName()
virtual std::string GetValueString()
virtual ~ParamTypeVecInt()
virtual std::string GetValueString()
virtual std::string GetTypeName()
virtual ~ParamTypeString()
BIAS::Vector< double > default_
BIAS::Vector< double > value_
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
void SetDefault()
resets to default value
virtual std::string GetHint()
virtual std::string GetValueString()
virtual std::string GetTypeName()
void SetDefault()
resets to default value
void SetDefault()
resets to default value
virtual std::string GetTypeName()
bool Hidden_
hide this parameter from all users
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
void SetDefault()
resets to default value
void SetDefault()
resets to default value
static std::string LowerCase(const std::string &input)
Return lower case string of input.
void SetDefault()
resets to default value
virtual int SetFromString(const std::string &s)
This is a common interface to let a specialized instance read its data from a string.
virtual ~ParamTypeDouble()
virtual std::string GetTypeName()
virtual std::string GetTypeName()