GEAR  1.6.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
GearParametersImpl.cc
1 #include "gearimpl/GearParametersImpl.h"
2 
3 #include <algorithm>
4 
5 namespace gear{
6 
8 
9  int GearParametersImpl::getIntVal(const std::string & key) const throw (UnknownParameterException, std::exception ) {
10 
11  IntMap::const_iterator it = _intMap.find( key ) ;
12  if( it == _intMap.end() )
13  throw UnknownParameterException( key ) ;
14  return it->second ;
15  }
16 
17  double GearParametersImpl::getDoubleVal(const std::string & key) const throw (UnknownParameterException, std::exception ) {
18 
19  DoubleMap::const_iterator it = _doubleMap.find( key ) ;
20  if( it == _doubleMap.end() )
21  throw UnknownParameterException( key ) ;
22  return it->second ;
23  }
24 
25  const std::string & GearParametersImpl::getStringVal(const std::string & key) const
26  throw (UnknownParameterException, std::exception ) {
27 
28  StringMap::const_iterator it = _stringMap.find( key ) ;
29  if( it == _stringMap.end() )
30  throw UnknownParameterException( key ) ;
31  return it->second ;
32  }
33 
34  const std::vector<int> & GearParametersImpl::getIntVals(const std::string & key) const
35  throw (UnknownParameterException, std::exception ) {
36 
37  IntVecMap::const_iterator it = _intVecMap.find( key ) ;
38  if( it == _intVecMap.end() )
39  throw UnknownParameterException( key ) ;
40  return it->second ;
41  }
42 
43  const std::vector<double> & GearParametersImpl::getDoubleVals(const std::string & key) const
44  throw (UnknownParameterException, std::exception ) {
45 
46  DoubleVecMap::const_iterator it = _doubleVecMap.find( key ) ;
47  if( it == _doubleVecMap.end() )
48  throw UnknownParameterException( key ) ;
49  return it->second ;
50  }
51 
52  const std::vector<std::string> & GearParametersImpl::getStringVals(const std::string & key) const
53  throw (UnknownParameterException, std::exception ) {
54 
55  StringVecMap::const_iterator it = _stringVecMap.find( key ) ;
56  if( it == _stringVecMap.end() )
57  throw UnknownParameterException( key ) ;
58  return it->second ;
59  }
60 
61  void GearParametersImpl::setIntVal(const std::string & key , int val ) {
62  _intMap[ key ] = val ;
63  }
64 
65  void GearParametersImpl::setDoubleVal(const std::string & key, double val ) {
66  _doubleMap[ key ] = val ;
67  }
68 
69 
70  void GearParametersImpl::setStringVal(const std::string & key , const std::string & val) {
71  _stringMap[ key ] = val ;
72  }
73 
74 
75  void GearParametersImpl::setIntVals(const std::string & key, const std::vector<int>& vals) {
76  _intVecMap[ key ] = vals ;
77  }
78 
79 
80  void GearParametersImpl::setDoubleVals(const std::string & key, const std::vector<double>& vals) {
81  _doubleVecMap[ key ] = vals ;
82  }
83 
84 
85  void GearParametersImpl::setStringVals(const std::string & key, const std::vector<std::string>& vals) {
86  _stringVecMap[ key ] = vals ;
87  }
88 
89  const std::vector<std::string>& GearParametersImpl::getIntKeys() const {
90 
91  _intKeys.clear() ;
92  _intKeys.reserve( _intMap.size() ) ;
93 
94  for( IntMap::const_iterator it = _intMap.begin() ; it != _intMap.end() ; ++it ){
95  _intKeys.push_back( it->first ) ;
96  }
97  return _intKeys ;
98  }
99 
100  const std::vector<std::string>& GearParametersImpl::getDoubleKeys() const {
101 
102  _doubleKeys.clear() ;
103  _doubleKeys.reserve( _doubleMap.size() ) ;
104 
105  for( DoubleMap::const_iterator it = _doubleMap.begin() ; it != _doubleMap.end() ; ++it ){
106  _doubleKeys.push_back( it->first ) ;
107  }
108  return _doubleKeys ;
109  }
110 
111 
112 
113  const std::vector<std::string>& GearParametersImpl::getStringKeys() const {
114 
115  _stringKeys.clear() ;
116  _stringKeys.reserve( _stringMap.size() ) ;
117 
118  for( StringMap::const_iterator it = _stringMap.begin() ; it != _stringMap.end() ; ++it ){
119  _stringKeys.push_back( it->first ) ;
120  }
121  return _stringKeys ;
122  }
123 
124  const std::vector<std::string>& GearParametersImpl::getIntVecKeys() const {
125 
126  _intVecKeys.clear() ;
127  _intVecKeys.reserve( _intVecMap.size() ) ;
128 
129  for( IntVecMap::const_iterator it = _intVecMap.begin() ; it != _intVecMap.end() ; ++it ){
130  _intVecKeys.push_back( it->first ) ;
131  }
132  return _intVecKeys ;
133  }
134 
135  const std::vector<std::string>& GearParametersImpl::getDoubleVecKeys() const {
136 
137  _doubleVecKeys.clear() ;
138  _doubleVecKeys.reserve( _doubleVecMap.size() ) ;
139 
140  for( DoubleVecMap::const_iterator it = _doubleVecMap.begin() ; it != _doubleVecMap.end() ; ++it ){
141  _doubleVecKeys.push_back( it->first ) ;
142  }
143  return _doubleVecKeys ;
144  }
145 
146 
147  const std::vector<std::string>& GearParametersImpl::getStringVecKeys() const {
148 
149  _stringVecKeys.clear() ;
150  _stringVecKeys.reserve( _stringVecMap.size() ) ;
151 
152  for( StringVecMap::const_iterator it = _stringVecMap.begin() ; it != _stringVecMap.end() ; ++it ){
153  _stringVecKeys.push_back( it->first ) ;
154  }
155  return _stringVecKeys ;
156  }
157 
158 }
virtual const std::string & getStringVal(const std::string &key) const
String value for key.
virtual const std::vector< std::string > & getStringVecKeys() const
All keys of StringVec variables.
virtual const std::vector< int > & getIntVals(const std::string &key) const
Integer values for key.
virtual void setIntVals(const std::string &key, const std::vector< int > &vals)
Integer values for key.
virtual void setDoubleVals(const std::string &key, const std::vector< double > &vals)
Double values for key.
virtual ~GearParametersImpl()
Destructor.
virtual const std::vector< std::string > & getStringKeys() const
All keys of string variables.
virtual void setStringVals(const std::string &key, const std::vector< std::string > &vals)
String values for key.
virtual int getIntVal(const std::string &key) const
Integer value for key.
virtual const std::vector< std::string > & getDoubleKeys() const
All keys of double variables.
UnknownParameterException call Processor::end().
Definition: GEAR.h:99
virtual double getDoubleVal(const std::string &key) const
Double value for key.
virtual const std::vector< std::string > & getDoubleVecKeys() const
All keys of DoubleVec variables.
virtual void setIntVal(const std::string &key, int val)
Set Integer value for key.
virtual const std::vector< double > & getDoubleVals(const std::string &key) const
Double values for key.
virtual const std::vector< std::string > & getIntVecKeys() const
All keys of IntVec variables.
virtual const std::vector< std::string > & getStringVals(const std::string &key) const
String values for key.
virtual void setStringVal(const std::string &key, const std::string &val)
String value for key.
virtual const std::vector< std::string > & getIntKeys() const
All keys of int variables.
virtual void setDoubleVal(const std::string &key, double val)
Double value for key.