Marlin  01.17.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProcessorParameter.cc
Go to the documentation of this file.
2 #include <algorithm>
3 
4 namespace marlin {
5 
6 // const std::string ProcessorParameter::type() {
7 
8 // if( typeid( _this ) == typeid( StringVec ) )
9 // return "StringVec" ;
10 
11 // else
12 // return typeid( _parameter ).name() ;
13 
14 // }
15 
16 
17  void toStream( std::ostream& s, int i , int ) { s << i ; }
18  void toStream( std::ostream& s, float f , int ) { s << f ; }
19  void toStream( std::ostream& s, double d , int ) { s << d ; }
20  void toStream( std::ostream& s, const std::string& str , int ) { s << str ; }
21  void toStream( std::ostream& s, bool b , int ) { s << ( b ? "true":"false" ) ; }
22 
23  template<>
25  if( params->isParameterSet( procParam->name() ) ) {
26  procParam->_parameter = params->getIntVal( procParam->_name ) ;
27  procParam->_valueSet = true ;
28  }
29  }
30  template<>
32  if( params->isParameterSet( procParam->name() ) ) {
33  procParam->_parameter = params->getFloatVal( procParam->_name ) ;
34  procParam->_valueSet = true ;
35  }
36  }
37  template<>
39  if( params->isParameterSet( procParam->name() ) ) {
40  procParam->_parameter = params->getFloatVal( procParam->_name ) ;
41  procParam->_valueSet = true ;
42  }
43  }
44  template<>
45  void setProcessorParameter<std::string>( ProcessorParameter_t<std::string>* procParam , StringParameters* params ) {
46  if( params->isParameterSet( procParam->name() ) ) {
47  procParam->_parameter = params->getStringVal( procParam->_name ) ;
48  procParam->_valueSet = true ;
49  }
50  }
51  template<>
53  if( params->isParameterSet( procParam->name() ) ) {
54  procParam->_parameter.clear() ;
55  procParam->_valueSet = true ;
56  }
57  params->getIntVals( procParam->_name, procParam->_parameter ) ;
58  }
59  template<>
61  if( params->isParameterSet( procParam->name() ) ) {
62  procParam->_parameter.clear() ;
63  procParam->_valueSet = true ;
64  }
65  params->getFloatVals( procParam->_name, procParam->_parameter ) ;
66  }
67  template<>
69  if( params->isParameterSet( procParam->name() ) ) {
70  procParam->_parameter.clear() ;
71  procParam->_valueSet = true ;
72  }
73  params->getStringVals( procParam->_name, procParam->_parameter ) ;
74  }
75  template<>
77  {
78  if( params->isParameterSet( procParam->name() ) ) {
79  std::string param = params->getStringVal( procParam->_name );
80  std::transform( param.begin(),param.end(),param.begin(),
81  (int (*)(int)) std::tolower );
82  if ( param == "false" || param == "0" ) {
83  procParam->_parameter = false;
84  procParam->_valueSet = true;
85  }
86  else if ( param == "true" || param == "1" ) {
87  procParam->_parameter = true;
88  procParam->_valueSet = true;
89  }
90  else {
91  std::cerr << "Warning: Parameter ["<< procParam->name()
92  << "] is boolean but neither \"true\" nor \"false\"! "
93  << "Ignoring steering parameter" << std::endl;
94  procParam->_valueSet = false;
95  }
96  }
97  }
98 
99 
100 }
void setProcessorParameter< IntVec >(ProcessorParameter_t< IntVec > *procParam, StringParameters *params)
T endl(T...args)
T end(T...args)
Templated implementation of ProcessorParameter - automatically created by Processor::registerProcesso...
STL class.
void setProcessorParameter< FloatVec >(ProcessorParameter_t< FloatVec > *procParam, StringParameters *params)
void setProcessorParameter< float >(ProcessorParameter_t< float > *procParam, StringParameters *params)
T begin(T...args)
void setProcessorParameter< double >(ProcessorParameter_t< double > *procParam, StringParameters *params)
void toStream(std::ostream &s, int i, int N)
Helper function for printing parameter vectors.
T transform(T...args)
STL class.
void setProcessorParameter< StringVec >(ProcessorParameter_t< StringVec > *procParam, StringParameters *params)
void setProcessorParameter< bool >(ProcessorParameter_t< bool > *procParam, StringParameters *params)
Simple parameters class for Marlin.
void setProcessorParameter< int >(ProcessorParameter_t< int > *procParam, StringParameters *params)