00001 #ifndef OMKParametersAccessorHEADER 00002 #define OMKParametersAccessorHEADER 00003 00004 #include "OMKOpenMASK.h" 00005 #include "vector" 00006 #include "map" 00007 #include "list" 00008 #include "string" 00009 00010 namespace OMK 00011 { 00012 class ConfigurationParameterDescriptor ; 00013 class SimulatedObject ; 00014 class Controller ; 00015 class Name ; 00016 template< typename T >class IAttributeBaseT ; 00017 namespace Type 00018 { 00019 class Color ; 00020 class Transform ; 00021 } 00022 00218 class OMK_API ParametersAccessor 00219 { 00220 public: 00221 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 template < typename T > 00234 static bool get( 00235 const ConfigurationParameterDescriptor * node, 00236 const std::string & name, 00237 T & value, 00238 SimulatedObject* object = 0 00239 ); 00240 public: 00241 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 template < typename T > 00258 static bool get( 00259 const ConfigurationParameterDescriptor * node, 00260 const std::string & name, 00261 T & value, 00262 const std::map< std::string, T >& mapping, 00263 SimulatedObject* object = 0 00264 ); 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 static bool getAndCheckObject( 00279 const ConfigurationParameterDescriptor * node, 00280 const std::string & name, 00281 Name & objectName, 00282 Controller & controller, 00283 SimulatedObject * object = 0 ) ; 00285 protected: 00288 00289 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00290 bool & value, 00291 std::string& errorStr ); 00292 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00293 Type::Color & value, 00294 std::string& errorStr ); 00295 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00296 Type::Transform & value, 00297 std::string& errorStr ); 00298 template < typename T > 00299 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00300 IAttributeBaseT< T > & value, 00301 std::string& errorStr ); 00302 template < typename T > 00303 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00304 std::vector< T > & value, 00305 std::string& errorStr ); 00306 template < typename T > 00307 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00308 std::list< T > & value, 00309 std::string& errorStr ); 00310 template < typename T1, typename T2 > 00311 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00312 std::pair< T1, T2 > & value, 00313 std::string& errorStr ) ; 00314 template < typename TK, typename TD > 00315 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00316 std::map< TK, TD > & value, 00317 std::string& errorStr ) ; 00318 template < typename T > 00319 static bool getValue( const ConfigurationParameterDescriptor * nodeValue, 00320 T & value, 00321 std::string& errorStr ); 00323 00324 00325 00326 00327 00328 template < typename T > 00329 static bool getTxtValue( const std::string & textValue, T & value ); 00331 static const ConfigurationParameterDescriptor * getNodeValue( 00332 const ConfigurationParameterDescriptor * node, 00333 const std::string & name, 00334 std::string & errorStr ) ; 00345 static bool displayError( 00346 const std::string & name, 00347 const std::string & functionName, 00348 SimulatedObject* object, 00349 const std::string & errorStr ) ; 00351 public: 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 template < typename T > 00365 static ConfigurationParameterDescriptor * set( ConfigurationParameterDescriptor *& node, 00366 const std::string& name, 00367 const T & value ) ; 00371 static ConfigurationParameterDescriptor * set( ConfigurationParameterDescriptor *& node, 00372 const std::string& name, 00373 ConfigurationParameterDescriptor * newNode ) ; 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 template < typename T > 00385 static ConfigurationParameterDescriptor * set( ConfigurationParameterDescriptor *& node, 00386 const std::string& name, 00387 const T & value, 00388 const std::map< T, std::string >& mapping ) ; 00390 protected: 00392 00393 00394 00395 00396 template < typename T > 00397 static bool setTxtValue( std::string & textValue, const T& value ) ; 00399 00400 00401 00402 template < typename T > 00403 static ConfigurationParameterDescriptor *setValue( const T& value, 00404 std::string& errorStr ) ; 00405 static ConfigurationParameterDescriptor *setValue( const bool& value, 00406 std::string& errorStr ) ; 00407 static ConfigurationParameterDescriptor *setValue( const Type::Color& value, 00408 std::string& errorStr ) ; 00409 static ConfigurationParameterDescriptor *setValue( const Type::Transform& value, 00410 std::string& errorStr ) ; 00411 template < typename T > 00412 static ConfigurationParameterDescriptor *setValue( const IAttributeBaseT< T >& values, 00413 std::string& errorStr ) ; 00414 template < typename T > 00415 static ConfigurationParameterDescriptor *setValue( const std::vector< T >& values, 00416 std::string& errorStr ) ; 00417 template < typename T > 00418 static ConfigurationParameterDescriptor *setValue( const std::list< T >& value, 00419 std::string& errorStr ) ; 00420 template < typename TK, typename TD > 00421 static ConfigurationParameterDescriptor *setValue( const std::map< TK, TD >& value, 00422 std::string& errorStr ) ; 00423 template < typename T1, typename T2 > 00424 static ConfigurationParameterDescriptor *setValue( const std::pair< T1, T2 >& value, 00425 std::string& errorStr ) ; 00427 }; 00428 } // namespace OMK 00429 #endif
Documentation generated on Mon Jun 9 11:45:57 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |