OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WPROPERTYTYPES_H 00026 #define WPROPERTYTYPES_H 00027 00028 #include <stdint.h> 00029 00030 #include <string> 00031 #include <vector> 00032 #include <utility> 00033 00034 #include <boost/filesystem.hpp> 00035 00036 #include "WStringUtils.h" 00037 #include "math/linearAlgebra/WMatrixFixed.h" 00038 #include "math/linearAlgebra/WPosition.h" 00039 #include "math/linearAlgebra/WVectorFixed.h" 00040 #include "math/WInterval.h" 00041 #include "WAssert.h" 00042 #include "WColor.h" 00043 #include "WItemSelector.h" 00044 00045 template < typename T > 00046 class WPropertyVariable; 00047 class WPropertyGroup; 00048 00049 class WTransferFunction; 00050 00051 //////////////////////////////////////////////////////////////////////////////////////////////////////// 00052 // NOTE: If you add new types here, please also add corresponding addProperty methods to WPropertyGroup 00053 //////////////////////////////////////////////////////////////////////////////////////////////////////// 00054 00055 //////////////////////////////////////////////////////////////////////////////////////////////////////// 00056 // NOTE: Always use the WPVBaseTypes in all your declarations to allow easy type modifications later on 00057 //////////////////////////////////////////////////////////////////////////////////////////////////////// 00058 00059 /** 00060 * Enum of all possible types, that can be used with WProperty. 00061 */ 00062 typedef enum 00063 { 00064 PV_UNKNOWN, //!< type not known 00065 PV_GROUP, //!< the group property 00066 PV_INT, //!< integer value 00067 PV_DOUBLE, //!< floating point value 00068 PV_BOOL, //!< boolean 00069 PV_STRING, //!< a string 00070 PV_PATH, //!< a Boost Path object denoting a filename/path 00071 PV_SELECTION, //!< a list of strings, selectable 00072 PV_POSITION, //!< a position property 00073 PV_COLOR, //!< a color property 00074 PV_TRIGGER, //!< for triggering an event 00075 PV_MATRIX4X4, //!< for 4x4 matrices 00076 PV_TRANSFERFUNCTION, //!< for transfer function textures 00077 PV_STRUCT, //!< for complex, structured properties (used by \ref WPropertyStruct) 00078 PV_LIST, //!< for a dynamic list of properties of the same type (see \ref WPropertyList) 00079 PV_INTERVAL //!< for defining intervals (min and max values) 00080 } 00081 PROPERTY_TYPE; 00082 00083 /** 00084 * Enum of all possible purpose of a property. The purpose describes which meaning a property has for the creator of it. A PP_PARAMETER is a 00085 * property which is meant to be modified to adopt the behaviour of the module (or whomever has created it). A PP_INFORMATION is only an output 00086 * from the creator who wants to inform the outside world about values, states or whatever. 00087 */ 00088 typedef enum 00089 { 00090 PV_PURPOSE_INFORMATION, //!< information property not meant to be modified from someone (except the creating object) 00091 PV_PURPOSE_PARAMETER //!< a parameter meant to be modified by others to manipulate the behaviour of the module (or whomever created 00092 //!< the property) 00093 } 00094 PROPERTY_PURPOSE; 00095 00096 /** 00097 * Namespace containing all base types of the WPropertyVariables. Use these types instead of issuing int32_t, double, bool, ... 00098 * directly. It also contains some user defined types including the needed operators. 00099 * 00100 * \note You can use only types which overwrite the << and >> operators! 00101 */ 00102 namespace WPVBaseTypes 00103 { 00104 typedef int32_t PV_INT; //!< base type used for every WPVInt 00105 typedef double PV_DOUBLE; //!< base type used for every WPVDouble 00106 typedef bool PV_BOOL; //!< base type used for every WPVBool 00107 typedef std::string PV_STRING; //!< base type used for every WPVString 00108 typedef boost::filesystem::path PV_PATH; //!< base type used for every WPVFilename 00109 typedef WItemSelector PV_SELECTION; //!< base type used for every WPVSelection 00110 typedef WPosition PV_POSITION; //!< base type used for every WPVPosition 00111 typedef WColor PV_COLOR; //!< base type used for every WPVColor 00112 typedef WMatrix4d PV_MATRIX4X4; //!< base type used for every WPVMatrix4X4 00113 typedef WTransferFunction PV_TRANSFERFUNCTION; //!< base type for every transfer function 00114 typedef WIntervalDouble PV_INTERVAL; //!< base type used for every PV_INTERVAL 00115 00116 /** 00117 * Enum denoting the possible trigger states. It is used for trigger properties. 00118 */ 00119 typedef enum 00120 { 00121 PV_TRIGGER_READY = 0, //!< Trigger property: is ready to be triggered (again) 00122 PV_TRIGGER_TRIGGERED //!< Trigger property: got triggered 00123 } 00124 PV_TRIGGER; //!< base type used for every WPVTrigger 00125 00126 /** 00127 * Checks which property types are derived from \ref WPropertyGroupBase. This, for example, is true for PV_GROUP and PV_STRUCT. 00128 * 00129 * \param type the type to check. 00130 * 00131 * \return true if cast-able \ref WPropertyGroupBase. 00132 */ 00133 bool isPropertyGroup( PROPERTY_TYPE type ); 00134 00135 /** 00136 * Write a PV_TRIGGER in string representation to the given output stream. 00137 * 00138 * \param out the output stream to print the value to 00139 * \param c the trigger value to output 00140 * 00141 * \return the output stream extended by the trigger value. 00142 */ 00143 std::ostream& operator<<( std::ostream& out, const PV_TRIGGER& c ); 00144 00145 /** 00146 * Write a PV_TRIGGER in string representation to the given input stream. 00147 * 00148 * \param in the input stream to read the value from 00149 * \param c set the value red to this 00150 * 00151 * \return the input stream. 00152 */ 00153 std::istream& operator>>( std::istream& in, PV_TRIGGER& c ); 00154 } 00155 00156 /** 00157 * Some convenience type alias for a even more easy usage of WPropertyVariable. 00158 * These typedefs are useful for casts, as they alias the PropertyVariable types. Please use these types instead of directly 00159 * int32_t, double, bool, ... so we are able to change the type later on without modifications of thousands of modules. 00160 */ 00161 00162 /** 00163 * Group properties. 00164 */ 00165 typedef WPropertyGroup WPVGroup; 00166 00167 /** 00168 * Int properties. 00169 */ 00170 typedef WPropertyVariable< WPVBaseTypes::PV_INT > WPVInt; 00171 00172 /** 00173 * Floating point properties. 00174 */ 00175 typedef WPropertyVariable< WPVBaseTypes::PV_DOUBLE > WPVDouble; 00176 00177 /** 00178 * Boolean properties. 00179 */ 00180 typedef WPropertyVariable< WPVBaseTypes::PV_BOOL > WPVBool; 00181 00182 /** 00183 * String properties. 00184 */ 00185 typedef WPropertyVariable< WPVBaseTypes::PV_STRING > WPVString; 00186 00187 /** 00188 * Filename properties. 00189 */ 00190 typedef WPropertyVariable< WPVBaseTypes::PV_PATH > WPVFilename; 00191 00192 /** 00193 * Selection properties 00194 */ 00195 typedef WPropertyVariable< WPVBaseTypes::PV_SELECTION > WPVSelection; 00196 00197 /** 00198 * position (vec3d) properties 00199 */ 00200 typedef WPropertyVariable< WPVBaseTypes::PV_POSITION > WPVPosition; 00201 00202 /** 00203 * Color properties 00204 */ 00205 typedef WPropertyVariable< WPVBaseTypes::PV_COLOR > WPVColor; 00206 00207 /** 00208 * Trigger properties 00209 */ 00210 typedef WPropertyVariable< WPVBaseTypes::PV_TRIGGER > WPVTrigger; 00211 00212 /** 00213 * Trigger properties 00214 */ 00215 typedef WPropertyVariable< WPVBaseTypes::PV_MATRIX4X4 > WPVMatrix4X4; 00216 00217 /** 00218 * Transfer Function properties 00219 */ 00220 typedef WPropertyVariable< WPVBaseTypes::PV_TRANSFERFUNCTION > WPVTransferFunction; 00221 00222 /** 00223 * Interval properties 00224 */ 00225 typedef WPropertyVariable< WPVBaseTypes::PV_INTERVAL > WPVInterval; 00226 00227 /** 00228 * Some convenience type alias for a even more easy usage of WPropertyVariable. 00229 * These typdefs define some pointer alias. 00230 */ 00231 00232 /** 00233 * Alias for int32_t property variables. 00234 */ 00235 typedef boost::shared_ptr< WPVInt > WPropInt; 00236 00237 /** 00238 * Alias for int32_t property variables. 00239 */ 00240 typedef boost::shared_ptr< WPVDouble > WPropDouble; 00241 00242 /** 00243 * Alias for bool property variables. 00244 */ 00245 typedef boost::shared_ptr< WPVBool > WPropBool; 00246 00247 /** 00248 * Alias for string property variables. 00249 */ 00250 typedef boost::shared_ptr< WPVString > WPropString; 00251 00252 /** 00253 * Alias for filename property variables. 00254 */ 00255 typedef boost::shared_ptr< WPVFilename > WPropFilename; 00256 00257 /** 00258 * Alias for string list property variables. 00259 */ 00260 typedef boost::shared_ptr< WPVSelection > WPropSelection; 00261 00262 /** 00263 * Alias for position property variables. 00264 */ 00265 typedef boost::shared_ptr< WPVPosition > WPropPosition; 00266 00267 /** 00268 * Alias for color property variables. 00269 */ 00270 typedef boost::shared_ptr< WPVColor > WPropColor; 00271 00272 /** 00273 * Alias for the group properties. 00274 */ 00275 typedef boost::shared_ptr< WPVGroup > WPropGroup; 00276 00277 /** 00278 * Alias for the trigger properties. 00279 */ 00280 typedef boost::shared_ptr< WPVTrigger > WPropTrigger; 00281 00282 /** 00283 * Alias for the 4x4 matrix properties. 00284 */ 00285 typedef boost::shared_ptr< WPVMatrix4X4 > WPropMatrix4X4; 00286 00287 /** 00288 * Alias for the transfer function properties 00289 */ 00290 typedef boost::shared_ptr< WPVTransferFunction > WPropTransferFunction; 00291 00292 /** 00293 * Alias for the interval properties 00294 */ 00295 typedef boost::shared_ptr< WPVInterval > WPropInterval; 00296 00297 /** 00298 * This namespace contains several helper classes which translate their template type to an enum. 00299 */ 00300 namespace PROPERTY_TYPE_HELPER 00301 { 00302 /** 00303 * Class helping to adapt types specified as template parameter into an enum. 00304 */ 00305 template< typename T > 00306 class WTypeIdentifier 00307 { 00308 public: 00309 /** 00310 * Get type identifier of the template type T. 00311 * 00312 * \return type identifier- 00313 */ 00314 PROPERTY_TYPE getType() 00315 { 00316 return PV_UNKNOWN; 00317 } 00318 }; 00319 00320 /** 00321 * Class helping to create a new instance of the property content from an old one. This might be needed by some types (some need to have a 00322 * predecessor for creation). 00323 * You only need to specialize this class for types not allowing the direct use of string_utils::fromString 00324 */ 00325 template< typename T > 00326 class WStringConversion 00327 { 00328 public: 00329 /** 00330 * Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here. 00331 * 00332 * \param str the new value as string 00333 * 00334 * \return the new instance 00335 */ 00336 T create( const T& /*old*/, const std::string str ) 00337 { 00338 return string_utils::fromString< T >( str ); 00339 } 00340 00341 /** 00342 * Creates a string from the specified value. 00343 * 00344 * \param v the value to convert 00345 * 00346 * \return the string representation 00347 */ 00348 std::string asString( const T& v ) 00349 { 00350 return string_utils::toString( v ); 00351 } 00352 }; 00353 00354 /** 00355 * Class helping to adapt types specified as template parameter into an enum. 00356 */ 00357 template<> 00358 class WTypeIdentifier< WPVBaseTypes::PV_BOOL > 00359 { 00360 public: 00361 /** 00362 * Get type identifier of the template type T. 00363 * 00364 * \return type identifier- 00365 */ 00366 PROPERTY_TYPE getType() 00367 { 00368 return PV_BOOL; 00369 } 00370 }; 00371 00372 /** 00373 * Class helping to adapt types specified as template parameter into an enum. 00374 */ 00375 template<> 00376 class WTypeIdentifier< WPVBaseTypes::PV_INT > 00377 { 00378 public: 00379 /** 00380 * Get type identifier of the template type T. 00381 * 00382 * \return type identifier- 00383 */ 00384 PROPERTY_TYPE getType() 00385 { 00386 return PV_INT; 00387 } 00388 }; 00389 00390 /** 00391 * Class helping to adapt types specified as template parameter into an enum. 00392 */ 00393 template<> 00394 class WTypeIdentifier< WPVBaseTypes::PV_DOUBLE > 00395 { 00396 public: 00397 /** 00398 * Get type identifier of the template type T. 00399 * 00400 * \return type identifier- 00401 */ 00402 PROPERTY_TYPE getType() 00403 { 00404 return PV_DOUBLE; 00405 } 00406 }; 00407 00408 /** 00409 * Class helping to adapt types specified as template parameter into an enum. 00410 */ 00411 template<> 00412 class WTypeIdentifier< WPVBaseTypes::PV_STRING > 00413 { 00414 public: 00415 /** 00416 * Get type identifier of the template type T. 00417 * 00418 * \return type identifier- 00419 */ 00420 PROPERTY_TYPE getType() 00421 { 00422 return PV_STRING; 00423 } 00424 }; 00425 00426 /** 00427 * Class helping to adapt types specified as template parameter into an enum. 00428 */ 00429 template<> 00430 class WTypeIdentifier< WPVBaseTypes::PV_PATH > 00431 { 00432 public: 00433 /** 00434 * Get type identifier of the template type T. 00435 * 00436 * \return type identifier- 00437 */ 00438 PROPERTY_TYPE getType() 00439 { 00440 return PV_PATH; 00441 } 00442 }; 00443 00444 /** 00445 * Class helping to adapt types specified as template parameter into an enum. 00446 */ 00447 template<> 00448 class WTypeIdentifier< WPVBaseTypes::PV_SELECTION > 00449 { 00450 public: 00451 /** 00452 * Get type identifier of the template type T. 00453 * 00454 * \return type identifier- 00455 */ 00456 PROPERTY_TYPE getType() 00457 { 00458 return PV_SELECTION; 00459 } 00460 }; 00461 00462 /** 00463 * Class helping to create a new instance of the property content from an old one. Selections need this special care since they contain not 00464 * serializable content which needs to be acquired from its predecessor instance. 00465 */ 00466 template<> 00467 class WStringConversion< WPVBaseTypes::PV_SELECTION > 00468 { 00469 public: 00470 /** 00471 * Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here. 00472 * 00473 * \param old the old value 00474 * \param str the new value as string 00475 * 00476 * \return the new instance 00477 */ 00478 WPVBaseTypes::PV_SELECTION create( const WPVBaseTypes::PV_SELECTION& old, const std::string str ) 00479 { 00480 return old.newSelector( str ); 00481 } 00482 00483 /** 00484 * Creates a string from the specified value. 00485 * 00486 * \param v the value to convert 00487 * 00488 * \return the string representation 00489 */ 00490 std::string asString( const WPVBaseTypes::PV_SELECTION& v ) 00491 { 00492 return string_utils::toString( v ); 00493 } 00494 }; 00495 00496 /** 00497 * Class helping to adapt types specified as template parameter into an enum. 00498 */ 00499 template<> 00500 class WTypeIdentifier< WPVBaseTypes::PV_POSITION > 00501 { 00502 public: 00503 /** 00504 * Get type identifier of the template type T. 00505 * 00506 * \return type identifier- 00507 */ 00508 PROPERTY_TYPE getType() 00509 { 00510 return PV_POSITION; 00511 } 00512 }; 00513 00514 /** 00515 * Class helping to adapt types specified as template parameter into an enum. 00516 */ 00517 template<> 00518 class WTypeIdentifier< WPVBaseTypes::PV_COLOR > 00519 { 00520 public: 00521 /** 00522 * Get type identifier of the template type T. 00523 * 00524 * \return type identifier- 00525 */ 00526 PROPERTY_TYPE getType() 00527 { 00528 return PV_COLOR; 00529 } 00530 }; 00531 00532 /** 00533 * Class helping to adapt types specified as template parameter into an enum. 00534 */ 00535 template<> 00536 class WTypeIdentifier< WPVBaseTypes::PV_TRIGGER > 00537 { 00538 public: 00539 /** 00540 * Get type identifier of the template type T. 00541 * 00542 * \return type identifier- 00543 */ 00544 PROPERTY_TYPE getType() 00545 { 00546 return PV_TRIGGER; 00547 } 00548 }; 00549 00550 /** 00551 * Class helping to adapt types specified as template parameter into an enum. 00552 */ 00553 template<> 00554 class WTypeIdentifier< WPVBaseTypes::PV_MATRIX4X4 > 00555 { 00556 public: 00557 /** 00558 * Get type identifier of the template type T. 00559 * 00560 * \return type identifier- 00561 */ 00562 PROPERTY_TYPE getType() 00563 { 00564 return PV_MATRIX4X4; 00565 } 00566 }; 00567 00568 /** 00569 * Class helping to adapt types specified as template parameter into an enum. 00570 */ 00571 template<> 00572 class WTypeIdentifier< WPVBaseTypes::PV_INTERVAL > 00573 { 00574 public: 00575 /** 00576 * Get type identifier of the template type T. 00577 * 00578 * \return type identifier- 00579 */ 00580 PROPERTY_TYPE getType() 00581 { 00582 return PV_INTERVAL; 00583 } 00584 }; 00585 00586 /** 00587 * Class helping to create a new instance of the property content from an old one. Selections need this special care since they contain not 00588 * serializable content which needs to be acquired from its predecessor instance. 00589 */ 00590 template<> 00591 class WStringConversion< WPVBaseTypes::PV_MATRIX4X4 > 00592 { 00593 public: 00594 /** 00595 * Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here. 00596 * 00597 * \param str the new value as string 00598 * 00599 * \return the new instance 00600 */ 00601 WPVBaseTypes::PV_MATRIX4X4 create( const WPVBaseTypes::PV_MATRIX4X4& /*old*/, const std::string str ) 00602 { 00603 WMatrix4d c; 00604 std::vector< std::string > tokens; 00605 tokens = string_utils::tokenize( str, ";" ); 00606 WAssert( tokens.size() >= 16, "There weren't 16 values for a 4x4 Matrix" ); 00607 00608 size_t idx = 0; 00609 for( size_t row = 0; row < 4; ++row ) 00610 { 00611 for( size_t col = 0; col < 4; ++col ) 00612 { 00613 c( row, col ) = string_utils::fromString< double >( tokens[ idx ] ); 00614 idx++; 00615 } 00616 } 00617 00618 return c; 00619 } 00620 00621 /** 00622 * Creates a string from the specified value. 00623 * 00624 * \param v the value to convert 00625 * 00626 * \return the string representation 00627 */ 00628 std::string asString( const WPVBaseTypes::PV_MATRIX4X4& v ) 00629 { 00630 std::ostringstream out; 00631 for( size_t row = 0; row < 4; ++row ) 00632 { 00633 for( size_t col = 0; col < 4; ++col ) 00634 { 00635 out << v( row, col ) << ";"; 00636 } 00637 } 00638 return out.str(); 00639 } 00640 }; 00641 00642 /** 00643 * Class helping to adapt types specified as template parameter into an enum. 00644 */ 00645 template<> 00646 class WTypeIdentifier< WPVBaseTypes::PV_TRANSFERFUNCTION > 00647 { 00648 public: 00649 /** 00650 * Get type identifier of the template type T. 00651 * 00652 * \return type identifier- 00653 */ 00654 PROPERTY_TYPE getType() 00655 { 00656 return PV_TRANSFERFUNCTION; 00657 } 00658 }; 00659 00660 /** 00661 * Class helping to create a new instance of the property content from an old one. Selections need this special care since they contain not 00662 * serializable content which needs to be acquired from its predecessor instance. 00663 */ 00664 template<> 00665 class WStringConversion< WPVBaseTypes::PV_TRANSFERFUNCTION > 00666 { 00667 public: 00668 /** 00669 * Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here. 00670 * 00671 * \param str the new value as string 00672 * 00673 * \return the new instance 00674 */ 00675 WPVBaseTypes::PV_TRANSFERFUNCTION create( const WPVBaseTypes::PV_TRANSFERFUNCTION& /*old*/, const std::string str ); 00676 00677 /** 00678 * Creates a string from the specified value. 00679 * 00680 * \param tf the value to convert 00681 * 00682 * \return the string representation 00683 */ 00684 std::string asString( const WPVBaseTypes::PV_TRANSFERFUNCTION& tf ); 00685 }; 00686 00687 /** 00688 * Class helping to create a new instance of the property content from an old one. Selections need this special care since they contain not 00689 * serializable content which needs to be acquired from its predecessor instance. 00690 */ 00691 template<> 00692 class WStringConversion< WPVBaseTypes::PV_POSITION > 00693 { 00694 public: 00695 /** 00696 * Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here. 00697 * 00698 * \param str the new value as string 00699 * 00700 * \return the new instance 00701 */ 00702 WPVBaseTypes::PV_POSITION create( const WPVBaseTypes::PV_POSITION& /*old*/, const std::string str ) 00703 { 00704 WPVBaseTypes::PV_POSITION c; 00705 std::vector< std::string > tokens; 00706 tokens = string_utils::tokenize( str, ";" ); 00707 WAssert( tokens.size() >= 3, "There weren't 3 values for a 3D vector" ); 00708 00709 size_t idx = 0; 00710 for( size_t col = 0; col < 3; ++col ) 00711 { 00712 c[ col ] = string_utils::fromString< double >( tokens[ idx ] ); 00713 idx++; 00714 } 00715 return c; 00716 } 00717 00718 /** 00719 * Creates a string from the specified value. 00720 * 00721 * \param v the value to convert 00722 * 00723 * \return the string representation 00724 */ 00725 std::string asString( const WPVBaseTypes::PV_POSITION& v ) 00726 { 00727 std::ostringstream out; 00728 for( size_t col = 0; col < 3; ++col ) 00729 { 00730 out << v[ col ] << ";"; 00731 } 00732 return out.str(); 00733 } 00734 }; 00735 00736 /** 00737 * Class helping to create a new instance of the property content from an old one. Selections need this special care since they contain not 00738 * serializable content which needs to be acquired from its predecessor instance. 00739 */ 00740 template<> 00741 class WStringConversion< WPVBaseTypes::PV_INTERVAL > 00742 { 00743 public: 00744 /** 00745 * Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here. 00746 * 00747 * \param str the new value as string 00748 * 00749 * \return the new instance 00750 */ 00751 WPVBaseTypes::PV_INTERVAL create( const WPVBaseTypes::PV_INTERVAL& /*old*/, const std::string str ) 00752 { 00753 std::vector< std::string > tokens; 00754 tokens = string_utils::tokenize( str, ";" ); 00755 WAssert( tokens.size() >= 2, "There weren't 2 values for an interval" ); 00756 00757 WPVBaseTypes::PV_INTERVAL c( string_utils::fromString< double >( tokens[ 0 ] ), 00758 string_utils::fromString< double >( tokens[ 1 ] ) ); 00759 00760 return c; 00761 } 00762 00763 /** 00764 * Creates a string from the specified value. 00765 * 00766 * \param v the value to convert 00767 * 00768 * \return the string representation 00769 */ 00770 std::string asString( const WPVBaseTypes::PV_INTERVAL& v ) 00771 { 00772 std::ostringstream out; 00773 out << v.getLower() << ";" << v.getUpper(); 00774 return out.str(); 00775 } 00776 }; 00777 } 00778 00779 #endif // WPROPERTYTYPES_H