Changeset 2002
- Timestamp:
- Oct 24, 2008, 12:37:54 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/util/Math.h
r1840 r2002 39 39 #include <ostream> 40 40 #include <string> 41 #include <boost/static_assert.hpp> 41 42 42 43 #include <OgreMath.h> … … 189 190 } 190 191 192 template <typename T> 193 inline T zeroise() 194 { 195 BOOST_STATIC_ASSERT(sizeof(T) == 0); 196 return T(); 197 } 198 199 template <> inline char zeroise<char>() { return 0; } 200 template <> inline unsigned char zeroise<unsigned char>() { return 0; } 201 template <> inline short zeroise<short>() { return 0; } 202 template <> inline unsigned short zeroise<unsigned short>() { return 0; } 203 template <> inline int zeroise<int>() { return 0; } 204 template <> inline unsigned int zeroise<unsigned int>() { return 0; } 205 template <> inline long zeroise<long>() { return 0; } 206 template <> inline unsigned long zeroise<unsigned long>() { return 0; } 207 template <> inline long long zeroise<long long>() { return 0; } 208 template <> inline unsigned long long zeroise<unsigned long long>() { return 0; } 209 template <> inline float zeroise<float>() { return 0; } 210 template <> inline double zeroise<double>() { return 0; } 211 template <> inline long double zeroise<long double>() { return 0; } 212 template <> inline bool zeroise<bool>() { return 0; } 213 template <> inline void* zeroise<void*>() { return 0; } 214 template <> inline std::string zeroise<std::string>() { return ""; } 215 template <> inline orxonox::Radian zeroise<orxonox::Radian>() { return orxonox::Radian(0.0f); } 216 template <> inline orxonox::Degree zeroise<orxonox::Degree>() { return orxonox::Degree(0.0f); } 217 template <> inline orxonox::Vector2 zeroise<orxonox::Vector2>() { return orxonox::Vector2 (0, 0) ; } 218 template <> inline orxonox::Vector3 zeroise<orxonox::Vector3>() { return orxonox::Vector3 (0, 0, 0) ; } 219 template <> inline orxonox::Vector4 zeroise<orxonox::Vector4>() { return orxonox::Vector4 (0, 0, 0, 0); } 220 template <> inline orxonox::ColourValue zeroise<orxonox::ColourValue>() { return orxonox::ColourValue(0, 0, 0, 0); } 221 template <> inline orxonox::Quaternion zeroise<orxonox::Quaternion>() { return orxonox::Quaternion (0, 0, 0, 0); } 222 191 223 /** 192 224 @brief Interpolates between two values for a time between 0 and 1. -
code/branches/objecthierarchy/src/util/MultiType.cc
r1791 r2002 39 39 @param type The type 40 40 */ 41 voidMultiType::convert(MT_Type type)41 bool MultiType::convert(MT_Type type) 42 42 { 43 43 switch (type) 44 44 { 45 45 case MT_char: 46 this->convert<char>(); break;46 return this->convert<char>(); break; 47 47 case MT_uchar: 48 this->convert<unsigned char>(); break;48 return this->convert<unsigned char>(); break; 49 49 case MT_short: 50 this->convert<short>(); break;50 return this->convert<short>(); break; 51 51 case MT_ushort: 52 this->convert<unsigned short>(); break;52 return this->convert<unsigned short>(); break; 53 53 case MT_int: 54 this->convert<int>(); break;54 return this->convert<int>(); break; 55 55 case MT_uint: 56 this->convert<unsigned int>(); break;56 return this->convert<unsigned int>(); break; 57 57 case MT_long: 58 this->convert<long>(); break;58 return this->convert<long>(); break; 59 59 case MT_ulong: 60 this->convert<unsigned long>(); break;60 return this->convert<unsigned long>(); break; 61 61 case MT_longlong: 62 this->convert<long long>(); break;62 return this->convert<long long>(); break; 63 63 case MT_ulonglong: 64 this->convert<unsigned long long>(); break;64 return this->convert<unsigned long long>(); break; 65 65 case MT_float: 66 this->convert<float>(); break;66 return this->convert<float>(); break; 67 67 case MT_double: 68 this->convert<double>(); break;68 return this->convert<double>(); break; 69 69 case MT_longdouble: 70 this->convert<long double>(); break;70 return this->convert<long double>(); break; 71 71 case MT_bool: 72 this->convert<bool>(); break;72 return this->convert<bool>(); break; 73 73 case MT_void: 74 this->convert<void*>(); break;74 return this->convert<void*>(); break; 75 75 case MT_string: 76 this->convert<std::string>(); break;76 return this->convert<std::string>(); break; 77 77 case MT_vector2: 78 this->convert<orxonox::Vector2>(); break;78 return this->convert<orxonox::Vector2>(); break; 79 79 case MT_vector3: 80 this->convert<orxonox::Vector3>(); break;80 return this->convert<orxonox::Vector3>(); break; 81 81 case MT_vector4: 82 this->convert<orxonox::Vector4>(); break;82 return this->convert<orxonox::Vector4>(); break; 83 83 case MT_colourvalue: 84 this->convert<orxonox::ColourValue>(); break;84 return this->convert<orxonox::ColourValue>(); break; 85 85 case MT_quaternion: 86 this->convert<orxonox::Quaternion>(); break;86 return this->convert<orxonox::Quaternion>(); break; 87 87 case MT_radian: 88 this->convert<orxonox::Radian>(); break;88 return this->convert<orxonox::Radian>(); break; 89 89 case MT_degree: 90 this->convert<orxonox::Degree>(); break;90 return this->convert<orxonox::Degree>(); break; 91 91 default: 92 this->reset(); break;92 this->reset(); return false; break; 93 93 }; 94 94 } … … 168 168 MultiType::operator double() const { return (this->value_) ? ((this->value_->type_ == MT_double ) ? ((MT_Value<double> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 169 169 MultiType::operator long double() const { return (this->value_) ? ((this->value_->type_ == MT_longdouble ) ? ((MT_Value<long double> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 170 MultiType::operator bool() const { return (this->value_) ? ((this->value_->type_ == MT_bool ) ? ((MT_Value<bool> *)this->value_)->value_ : (*this->value_)) : false;} /** @brief Returns the current value, converted to the requested type. */171 MultiType::operator void*() const { return (this->value_) ? ((this->value_->type_ == MT_void ) ? ((MT_Value<void*> *)this->value_)->value_ : (*this->value_)) : (void*)0;} /** @brief Returns the current value, converted to the requested type. */172 MultiType::operator std::string() const { return (this->value_) ? ((this->value_->type_ == MT_string ) ? ((MT_Value<std::string> *)this->value_)->value_ : (*this->value_)) : std::string(); } /** @brief Returns the current value, converted to the requested type. */173 MultiType::operator orxonox::Vector2() const { return (this->value_) ? ((this->value_->type_ == MT_vector2 ) ? ((MT_Value<orxonox::Vector2> *)this->value_)->value_ : (*this->value_)) : orxonox::Vector2(); } /** @brief Returns the current value, converted to the requested type. */174 MultiType::operator orxonox::Vector3() const { return (this->value_) ? ((this->value_->type_ == MT_vector3 ) ? ((MT_Value<orxonox::Vector3> *)this->value_)->value_ : (*this->value_)) : orxonox::Vector3(); } /** @brief Returns the current value, converted to the requested type. */175 MultiType::operator orxonox::Vector4() const { return (this->value_) ? ((this->value_->type_ == MT_vector4 ) ? ((MT_Value<orxonox::Vector4> *)this->value_)->value_ : (*this->value_)) : orxonox::Vector4(); } /** @brief Returns the current value, converted to the requested type. */176 MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ((MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : orxonox::ColourValue(); } /** @brief Returns the current value, converted to the requested type. */177 MultiType::operator orxonox::Quaternion() const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ((MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : orxonox::Quaternion(); } /** @brief Returns the current value, converted to the requested type. */178 MultiType::operator orxonox::Radian() const { return (this->value_) ? ((this->value_->type_ == MT_radian ) ? ((MT_Value<orxonox::Radian> *)this->value_)->value_ : (*this->value_)) : orxonox::Radian(); } /** @brief Returns the current value, converted to the requested type. */179 MultiType::operator orxonox::Degree() const { return (this->value_) ? ((this->value_->type_ == MT_degree ) ? ((MT_Value<orxonox::Degree> *)this->value_)->value_ : (*this->value_)) : orxonox::Degree(); } /** @brief Returns the current value, converted to the requested type. */170 MultiType::operator bool() const { return (this->value_) ? ((this->value_->type_ == MT_bool ) ? ((MT_Value<bool> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 171 MultiType::operator void*() const { return (this->value_) ? ((this->value_->type_ == MT_void ) ? ((MT_Value<void*> *)this->value_)->value_ : (*this->value_)) : 0; } /** @brief Returns the current value, converted to the requested type. */ 172 MultiType::operator std::string() const { return (this->value_) ? ((this->value_->type_ == MT_string ) ? ((MT_Value<std::string> *)this->value_)->value_ : (*this->value_)) : zeroise<std::string>(); } /** @brief Returns the current value, converted to the requested type. */ 173 MultiType::operator orxonox::Vector2() const { return (this->value_) ? ((this->value_->type_ == MT_vector2 ) ? ((MT_Value<orxonox::Vector2> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector2>(); } /** @brief Returns the current value, converted to the requested type. */ 174 MultiType::operator orxonox::Vector3() const { return (this->value_) ? ((this->value_->type_ == MT_vector3 ) ? ((MT_Value<orxonox::Vector3> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector3>(); } /** @brief Returns the current value, converted to the requested type. */ 175 MultiType::operator orxonox::Vector4() const { return (this->value_) ? ((this->value_->type_ == MT_vector4 ) ? ((MT_Value<orxonox::Vector4> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector4>(); } /** @brief Returns the current value, converted to the requested type. */ 176 MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ((MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */ 177 MultiType::operator orxonox::Quaternion() const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ((MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Quaternion>(); } /** @brief Returns the current value, converted to the requested type. */ 178 MultiType::operator orxonox::Radian() const { return (this->value_) ? ((this->value_->type_ == MT_radian ) ? ((MT_Value<orxonox::Radian> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Radian>(); } /** @brief Returns the current value, converted to the requested type. */ 179 MultiType::operator orxonox::Degree() const { return (this->value_) ? ((this->value_->type_ == MT_degree ) ? ((MT_Value<orxonox::Degree> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Degree>(); } /** @brief Returns the current value, converted to the requested type. */ 180 180 181 181 template <> void MultiType::createNewValueContainer(const char& value) { this->value_ = new MT_Value<char> (value, MT_char ); } /** @brief Creates a new value container for the given type. */ -
code/branches/objecthierarchy/src/util/MultiType.h
r1854 r2002 58 58 a.convert<bool>(); // converts 3.14 to bool, which is true 59 59 a = false; // assigns false, this is equivalent to a.setValue(false) 60 61 @note 62 Whenever a value gets converted, there is a boolean return value telling you whether it was 63 successful or not. If it wasn't a zero value is assigned with the help of zeroise<T>(). 60 64 */ 61 65 … … 128 132 struct _UtilExport MT_ValueBase 129 133 { 130 MT_ValueBase(MT_Type type) : type_(type) {}134 MT_ValueBase(MT_Type type) : type_(type), bHasDefaultValue_(false) {} 131 135 virtual ~MT_ValueBase() {} 132 136 … … 134 138 135 139 virtual void reset() = 0; 136 virtual voidassimilate(const MultiType& other) = 0;140 virtual bool assimilate(const MultiType& other) = 0; 137 141 138 142 /** @brief Returns the type of the current value. */ 139 143 const MT_Type& getType() const { return this->type_; } 140 144 141 virtual void setValue(const char& value) = 0; 142 virtual void setValue(const unsigned char& value) = 0; 143 virtual void setValue(const short& value) = 0; 144 virtual void setValue(const unsigned short& value) = 0; 145 virtual void setValue(const int& value) = 0; 146 virtual void setValue(const unsigned int& value) = 0; 147 virtual void setValue(const long& value) = 0; 148 virtual void setValue(const unsigned long& value) = 0; 149 virtual void setValue(const long long& value) = 0; 150 virtual void setValue(const unsigned long long& value) = 0; 151 virtual void setValue(const float& value) = 0; 152 virtual void setValue(const double& value) = 0; 153 virtual void setValue(const long double& value) = 0; 154 virtual void setValue(const bool& value) = 0; 155 virtual void setValue( void* const& value) = 0; 156 virtual void setValue(const std::string& value) = 0; 157 virtual void setValue(const orxonox::Vector2& value) = 0; 158 virtual void setValue(const orxonox::Vector3& value) = 0; 159 virtual void setValue(const orxonox::Vector4& value) = 0; 160 virtual void setValue(const orxonox::ColourValue& value) = 0; 161 virtual void setValue(const orxonox::Quaternion& value) = 0; 162 virtual void setValue(const orxonox::Radian& value) = 0; 163 virtual void setValue(const orxonox::Degree& value) = 0; 145 /** @brief Checks whether the value is a default one. */ 146 bool hasDefaultValue() const { return this->bHasDefaultValue_; } 147 148 virtual bool setValue(const char& value) = 0; 149 virtual bool setValue(const unsigned char& value) = 0; 150 virtual bool setValue(const short& value) = 0; 151 virtual bool setValue(const unsigned short& value) = 0; 152 virtual bool setValue(const int& value) = 0; 153 virtual bool setValue(const unsigned int& value) = 0; 154 virtual bool setValue(const long& value) = 0; 155 virtual bool setValue(const unsigned long& value) = 0; 156 virtual bool setValue(const long long& value) = 0; 157 virtual bool setValue(const unsigned long long& value) = 0; 158 virtual bool setValue(const float& value) = 0; 159 virtual bool setValue(const double& value) = 0; 160 virtual bool setValue(const long double& value) = 0; 161 virtual bool setValue(const bool& value) = 0; 162 virtual bool setValue( void* const& value) = 0; 163 virtual bool setValue(const std::string& value) = 0; 164 virtual bool setValue(const orxonox::Vector2& value) = 0; 165 virtual bool setValue(const orxonox::Vector3& value) = 0; 166 virtual bool setValue(const orxonox::Vector4& value) = 0; 167 virtual bool setValue(const orxonox::ColourValue& value) = 0; 168 virtual bool setValue(const orxonox::Quaternion& value) = 0; 169 virtual bool setValue(const orxonox::Radian& value) = 0; 170 virtual bool setValue(const orxonox::Degree& value) = 0; 171 172 virtual bool getValue(char* value) const = 0; 173 virtual bool getValue(unsigned char* value) const = 0; 174 virtual bool getValue(short* value) const = 0; 175 virtual bool getValue(unsigned short* value) const = 0; 176 virtual bool getValue(int* value) const = 0; 177 virtual bool getValue(unsigned int* value) const = 0; 178 virtual bool getValue(long* value) const = 0; 179 virtual bool getValue(unsigned long* value) const = 0; 180 virtual bool getValue(long long* value) const = 0; 181 virtual bool getValue(unsigned long long* value) const = 0; 182 virtual bool getValue(float* value) const = 0; 183 virtual bool getValue(double* value) const = 0; 184 virtual bool getValue(long double* value) const = 0; 185 virtual bool getValue(bool* value) const = 0; 186 virtual bool getValue(void** value) const = 0; 187 virtual bool getValue(std::string* value) const = 0; 188 virtual bool getValue(orxonox::Vector2* value) const = 0; 189 virtual bool getValue(orxonox::Vector3* value) const = 0; 190 virtual bool getValue(orxonox::Vector4* value) const = 0; 191 virtual bool getValue(orxonox::ColourValue* value) const = 0; 192 virtual bool getValue(orxonox::Quaternion* value) const = 0; 193 virtual bool getValue(orxonox::Radian* value) const = 0; 194 virtual bool getValue(orxonox::Degree* value) const = 0; 164 195 165 196 virtual operator char() const = 0; … … 189 220 virtual void toString(std::ostream& outstream) const = 0; 190 221 191 MT_Type type_; //!< The type of the current value 222 MT_Type type_; //!< The type of the current value 223 bool bHasDefaultValue_; //!< True if the last conversion wasn't successful 192 224 }; 193 225 … … 229 261 inline const MultiType& operator=(MT_Type type) { this->setType(type); return (*this); } /** @brief Resets the value and changes the type. */ 230 262 231 inline voidsetValue(const char& value);232 inline voidsetValue(const unsigned char& value);233 inline voidsetValue(const short& value);234 inline voidsetValue(const unsigned short& value);235 inline voidsetValue(const int& value);236 inline voidsetValue(const unsigned int& value);237 inline voidsetValue(const long& value);238 inline voidsetValue(const unsigned long& value);239 inline voidsetValue(const long long& value);240 inline voidsetValue(const unsigned long long& value);241 inline voidsetValue(const float& value);242 inline voidsetValue(const double& value);243 inline voidsetValue(const long double& value);244 inline voidsetValue(const bool& value);245 inline voidsetValue( void* const& value);246 inline voidsetValue(const std::string& value);247 inline voidsetValue(const orxonox::Vector2& value);248 inline voidsetValue(const orxonox::Vector3& value);249 inline voidsetValue(const orxonox::Vector4& value);250 inline voidsetValue(const orxonox::ColourValue& value);251 inline voidsetValue(const orxonox::Quaternion& value);252 inline voidsetValue(const orxonox::Radian& value);253 inline voidsetValue(const orxonox::Degree& value);254 inline voidsetValue(const char* value);263 inline bool setValue(const char& value); 264 inline bool setValue(const unsigned char& value); 265 inline bool setValue(const short& value); 266 inline bool setValue(const unsigned short& value); 267 inline bool setValue(const int& value); 268 inline bool setValue(const unsigned int& value); 269 inline bool setValue(const long& value); 270 inline bool setValue(const unsigned long& value); 271 inline bool setValue(const long long& value); 272 inline bool setValue(const unsigned long long& value); 273 inline bool setValue(const float& value); 274 inline bool setValue(const double& value); 275 inline bool setValue(const long double& value); 276 inline bool setValue(const bool& value); 277 inline bool setValue( void* const& value); 278 inline bool setValue(const std::string& value); 279 inline bool setValue(const orxonox::Vector2& value); 280 inline bool setValue(const orxonox::Vector3& value); 281 inline bool setValue(const orxonox::Vector4& value); 282 inline bool setValue(const orxonox::ColourValue& value); 283 inline bool setValue(const orxonox::Quaternion& value); 284 inline bool setValue(const orxonox::Radian& value); 285 inline bool setValue(const orxonox::Degree& value); 286 inline bool setValue(const char* value); 255 287 /** @brief Assigns a pointer. */ 256 template <typename V> inline void setValue(V* value) { if (this->value_) { this->value_->setValue((void*)value); } else {this->assignValue((void*)value); } }288 template <typename V> inline bool setValue(V* value) { if (this->value_) { return this->value_->setValue((void*)value); } else { return this->assignValue((void*)value); } } 257 289 /** @brief Assigns the value of the other MultiType and converts it to the current type. */ 258 void setValue(const MultiType& other) { if (this->value_) { this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); }} }290 bool setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } } 259 291 /** @brief Changes the type to T and assigns the new value (which might be of another type than T - it gets converted). */ 260 template <typename T, typename V> inline void setValue(const V& value) { this->setType<T>();this->setValue(value); }292 template <typename T, typename V> inline bool setValue(const V& value) { this->setType<T>(); return this->setValue(value); } 261 293 262 294 … … 264 296 inline void copy(const MultiType& other) { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; } 265 297 266 template <typename T> inline void convert() {this->setValue<T>((T)(*this)); } /** @brief Converts the current value to type T. */267 inline void convert(const MultiType& other) {this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */268 voidconvert(MT_Type type);269 270 /** @brief Resets the value to the defaultvalue of the current type.*/271 inline void reset() { if (this->value_) { delete this->value_; this->value_ = 0; }}298 template <typename T> inline bool convert() { return this->setValue<T>((T)(*this)); } /** @brief Converts the current value to type T. */ 299 inline bool convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */ 300 bool convert(MT_Type type); 301 302 /** @brief Current content gets deleted. New type is MT_null */ 303 inline void reset() { if (this->value_) this->value_->reset(); } 272 304 273 305 template <typename T> inline void setType() { this->assignValue(T()); } /** @brief Resets the value and changes the internal type to T. */ … … 282 314 template <typename T> inline bool isType() const { return false; } // Only works for specialized values - see below 283 315 std::string getTypename() const; 316 317 /** @brief Checks whether the value is a default one. */ 318 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } 284 319 285 320 operator char() const; … … 309 344 template <class T> operator T*() const { return ((T*)this->operator void*()); } 310 345 311 inline void getValue(char* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */312 inline void getValue(unsigned char* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */313 inline void getValue(short* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */314 inline void getValue(unsigned short* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */315 inline void getValue(int* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */316 inline void getValue(unsigned int* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */317 inline void getValue(long* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */318 inline void getValue(unsigned long* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */319 inline void getValue(long long* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */320 inline void getValue(unsigned long long* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */321 inline void getValue(float* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */322 inline void getValue(double* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */323 inline void getValue(long double* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */324 inline void getValue(bool* value) const { if (this->value_) { (*value) = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */325 inline void getValue(void* value) const { if (this->value_) { value = (*this->value_); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */326 inline void getValue(std::string* value) const { if (this->value_) { (*value) = this->value_->operator std::string(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */327 inline void getValue(orxonox::Vector2* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector2(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */328 inline void getValue(orxonox::Vector3* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector3(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */329 inline void getValue(orxonox::Vector4* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector4(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */330 inline void getValue(orxonox::ColourValue* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::ColourValue(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */331 inline void getValue(orxonox::Quaternion* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Quaternion(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */332 inline void getValue(orxonox::Radian* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Radian(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */333 inline void getValue(orxonox::Degree* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Degree(); }} /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */346 inline bool getValue(char* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 347 inline bool getValue(unsigned char* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 348 inline bool getValue(short* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 349 inline bool getValue(unsigned short* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 350 inline bool getValue(int* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 351 inline bool getValue(unsigned int* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 352 inline bool getValue(long* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 353 inline bool getValue(unsigned long* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 354 inline bool getValue(long long* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 355 inline bool getValue(unsigned long long* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 356 inline bool getValue(float* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 357 inline bool getValue(double* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 358 inline bool getValue(long double* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 359 inline bool getValue(bool* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 360 inline bool getValue(void** value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 361 inline bool getValue(std::string* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 362 inline bool getValue(orxonox::Vector2* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 363 inline bool getValue(orxonox::Vector3* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 364 inline bool getValue(orxonox::Vector4* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 365 inline bool getValue(orxonox::ColourValue* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 366 inline bool getValue(orxonox::Quaternion* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 367 inline bool getValue(orxonox::Radian* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 368 inline bool getValue(orxonox::Degree* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 334 369 335 370 inline char getChar() const { return this->operator char(); } /** @brief Returns the current value, converted to the requested type. */ … … 359 394 360 395 private: 361 inline void assignValue(const char& value) { if (this->value_ && this->value_->type_ == MT_char) { this->value_->setValue(value); } else { this->changeValueContainer<char>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */362 inline void assignValue(const unsigned char& value) { if (this->value_ && this->value_->type_ == MT_uchar) { this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */363 inline void assignValue(const short& value) { if (this->value_ && this->value_->type_ == MT_short) { this->value_->setValue(value); } else { this->changeValueContainer<short>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */364 inline void assignValue(const unsigned short& value) { if (this->value_ && this->value_->type_ == MT_ushort) { this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */365 inline void assignValue(const int& value) { if (this->value_ && this->value_->type_ == MT_int) { this->value_->setValue(value); } else { this->changeValueContainer<int>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */366 inline void assignValue(const unsigned int& value) { if (this->value_ && this->value_->type_ == MT_uint) { this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */367 inline void assignValue(const long& value) { if (this->value_ && this->value_->type_ == MT_long) { this->value_->setValue(value); } else { this->changeValueContainer<long>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */368 inline void assignValue(const unsigned long& value) { if (this->value_ && this->value_->type_ == MT_ulong) { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */369 inline void assignValue(const long long& value) { if (this->value_ && this->value_->type_ == MT_longlong) { this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */370 inline void assignValue(const unsigned long long& value) { if (this->value_ && this->value_->type_ == MT_ulonglong) { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */371 inline void assignValue(const float& value) { if (this->value_ && this->value_->type_ == MT_float) { this->value_->setValue(value); } else { this->changeValueContainer<float>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */372 inline void assignValue(const double& value) { if (this->value_ && this->value_->type_ == MT_double) { this->value_->setValue(value); } else { this->changeValueContainer<double>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */373 inline void assignValue(const long double& value) { if (this->value_ && this->value_->type_ == MT_longdouble) { this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */374 inline void assignValue(const bool& value) { if (this->value_ && this->value_->type_ == MT_bool) { this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */375 inline void assignValue( void* const& value) { if (this->value_ && this->value_->type_ == MT_void) { this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */376 inline void assignValue(const std::string& value) { if (this->value_ && this->value_->type_ == MT_string) { this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */377 inline void assignValue(const orxonox::Vector2& value) { if (this->value_ && this->value_->type_ == MT_vector2) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */378 inline void assignValue(const orxonox::Vector3& value) { if (this->value_ && this->value_->type_ == MT_vector3) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */379 inline void assignValue(const orxonox::Vector4& value) { if (this->value_ && this->value_->type_ == MT_vector4) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */380 inline void assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_colourvalue) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); } } /** @brief Assigns a new value by changing type and creating a new container. */381 inline void assignValue(const orxonox::Quaternion& value) { if (this->value_ && this->value_->type_ == MT_quaternion) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */382 inline void assignValue(const orxonox::Radian& value) { if (this->value_ && this->value_->type_ == MT_radian) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */383 inline void assignValue(const orxonox::Degree& value) { if (this->value_ && this->value_->type_ == MT_degree) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);} } /** @brief Assigns a new value by changing type and creating a new container. */396 inline bool assignValue(const char& value) { if (this->value_ && this->value_->type_ == MT_char) { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 397 inline bool assignValue(const unsigned char& value) { if (this->value_ && this->value_->type_ == MT_uchar) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 398 inline bool assignValue(const short& value) { if (this->value_ && this->value_->type_ == MT_short) { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 399 inline bool assignValue(const unsigned short& value) { if (this->value_ && this->value_->type_ == MT_ushort) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 400 inline bool assignValue(const int& value) { if (this->value_ && this->value_->type_ == MT_int) { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 401 inline bool assignValue(const unsigned int& value) { if (this->value_ && this->value_->type_ == MT_uint) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 402 inline bool assignValue(const long& value) { if (this->value_ && this->value_->type_ == MT_long) { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 403 inline bool assignValue(const unsigned long& value) { if (this->value_ && this->value_->type_ == MT_ulong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 404 inline bool assignValue(const long long& value) { if (this->value_ && this->value_->type_ == MT_longlong) { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 405 inline bool assignValue(const unsigned long long& value) { if (this->value_ && this->value_->type_ == MT_ulonglong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 406 inline bool assignValue(const float& value) { if (this->value_ && this->value_->type_ == MT_float) { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 407 inline bool assignValue(const double& value) { if (this->value_ && this->value_->type_ == MT_double) { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 408 inline bool assignValue(const long double& value) { if (this->value_ && this->value_->type_ == MT_longdouble) { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 409 inline bool assignValue(const bool& value) { if (this->value_ && this->value_->type_ == MT_bool) { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 410 inline bool assignValue( void* const& value) { if (this->value_ && this->value_->type_ == MT_void) { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 411 inline bool assignValue(const std::string& value) { if (this->value_ && this->value_->type_ == MT_string) { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 412 inline bool assignValue(const orxonox::Vector2& value) { if (this->value_ && this->value_->type_ == MT_vector2) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 413 inline bool assignValue(const orxonox::Vector3& value) { if (this->value_ && this->value_->type_ == MT_vector3) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 414 inline bool assignValue(const orxonox::Vector4& value) { if (this->value_ && this->value_->type_ == MT_vector4) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 415 inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_colourvalue) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 416 inline bool assignValue(const orxonox::Quaternion& value) { if (this->value_ && this->value_->type_ == MT_quaternion) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 417 inline bool assignValue(const orxonox::Radian& value) { if (this->value_ && this->value_->type_ == MT_radian) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 418 inline bool assignValue(const orxonox::Degree& value) { if (this->value_ && this->value_->type_ == MT_degree) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */ 384 419 385 420 /** @brief Changes the value container. */ 386 421 template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); } 387 422 /** @brief Creates a new value container (works only with specialized types). */ 388 template <typename T> void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }423 template <typename T> void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); return false; } 389 424 390 425 MT_ValueBase* value_; //!< A pointer to the value container … … 419 454 420 455 // Specialization to avoid ambiguities with the conversion operator 421 template <> inline void MultiType::convert<std::string>() {this->setValue<std::string> (this->operator std::string()); } /** @brief Converts the current value to the given type. */422 template <> inline void MultiType::convert<orxonox::Vector2>() {this->setValue<orxonox::Vector2> (this->operator orxonox::Vector2()); } /** @brief Converts the current value to the given type. */423 template <> inline void MultiType::convert<orxonox::Vector3>() {this->setValue<orxonox::Vector3> (this->operator orxonox::Vector3()); } /** @brief Converts the current value to the given type. */424 template <> inline void MultiType::convert<orxonox::Vector4>() {this->setValue<orxonox::Vector4> (this->operator orxonox::Vector4()); } /** @brief Converts the current value to the given type. */425 template <> inline void MultiType::convert<orxonox::ColourValue>() {this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } /** @brief Converts the current value to the given type. */426 template <> inline void MultiType::convert<orxonox::Quaternion>() {this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion()); } /** @brief Converts the current value to the given type. */427 template <> inline void MultiType::convert<orxonox::Radian>() {this->setValue<orxonox::Radian> (this->operator orxonox::Radian()); } /** @brief Converts the current value to the given type. */428 template <> inline void MultiType::convert<orxonox::Degree>() {this->setValue<orxonox::Degree> (this->operator orxonox::Degree()); } /** @brief Converts the current value to the given type. */456 template <> inline bool MultiType::convert<std::string>() { return this->setValue<std::string> (this->operator std::string()); } /** @brief Converts the current value to the given type. */ 457 template <> inline bool MultiType::convert<orxonox::Vector2>() { return this->setValue<orxonox::Vector2> (this->operator orxonox::Vector2()); } /** @brief Converts the current value to the given type. */ 458 template <> inline bool MultiType::convert<orxonox::Vector3>() { return this->setValue<orxonox::Vector3> (this->operator orxonox::Vector3()); } /** @brief Converts the current value to the given type. */ 459 template <> inline bool MultiType::convert<orxonox::Vector4>() { return this->setValue<orxonox::Vector4> (this->operator orxonox::Vector4()); } /** @brief Converts the current value to the given type. */ 460 template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } /** @brief Converts the current value to the given type. */ 461 template <> inline bool MultiType::convert<orxonox::Quaternion>() { return this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion()); } /** @brief Converts the current value to the given type. */ 462 template <> inline bool MultiType::convert<orxonox::Radian>() { return this->setValue<orxonox::Radian> (this->operator orxonox::Radian()); } /** @brief Converts the current value to the given type. */ 463 template <> inline bool MultiType::convert<orxonox::Degree>() { return this->setValue<orxonox::Degree> (this->operator orxonox::Degree()); } /** @brief Converts the current value to the given type. */ 429 464 430 465 // Specialization to avoid ambiguities with the conversion operator 431 template <> inline void MultiType::convert<const std::string&>() {this->convert<std::string>(); } /** @brief Converts the current value to the given type. */432 template <> inline void MultiType::convert<const orxonox::Vector2&>() {this->convert<orxonox::Vector2>(); } /** @brief Converts the current value to the given type. */433 template <> inline void MultiType::convert<const orxonox::Vector3&>() {this->convert<orxonox::Vector3>(); } /** @brief Converts the current value to the given type. */434 template <> inline void MultiType::convert<const orxonox::Vector4&>() {this->convert<orxonox::Vector4>(); } /** @brief Converts the current value to the given type. */435 template <> inline void MultiType::convert<const orxonox::ColourValue&>() {this->convert<orxonox::ColourValue>(); } /** @brief Converts the current value to the given type. */436 template <> inline void MultiType::convert<const orxonox::Quaternion&>() {this->convert<orxonox::Quaternion>(); } /** @brief Converts the current value to the given type. */437 template <> inline void MultiType::convert<const orxonox::Radian&>() {this->convert<orxonox::Radian>(); } /** @brief Converts the current value to the given type. */438 template <> inline void MultiType::convert<const orxonox::Degree&>() {this->convert<orxonox::Degree>(); } /** @brief Converts the current value to the given type. */466 template <> inline bool MultiType::convert<const std::string&>() { return this->convert<std::string>(); } /** @brief Converts the current value to the given type. */ 467 template <> inline bool MultiType::convert<const orxonox::Vector2&>() { return this->convert<orxonox::Vector2>(); } /** @brief Converts the current value to the given type. */ 468 template <> inline bool MultiType::convert<const orxonox::Vector3&>() { return this->convert<orxonox::Vector3>(); } /** @brief Converts the current value to the given type. */ 469 template <> inline bool MultiType::convert<const orxonox::Vector4&>() { return this->convert<orxonox::Vector4>(); } /** @brief Converts the current value to the given type. */ 470 template <> inline bool MultiType::convert<const orxonox::ColourValue&>() { return this->convert<orxonox::ColourValue>(); } /** @brief Converts the current value to the given type. */ 471 template <> inline bool MultiType::convert<const orxonox::Quaternion&>() { return this->convert<orxonox::Quaternion>(); } /** @brief Converts the current value to the given type. */ 472 template <> inline bool MultiType::convert<const orxonox::Radian&>() { return this->convert<orxonox::Radian>(); } /** @brief Converts the current value to the given type. */ 473 template <> inline bool MultiType::convert<const orxonox::Degree&>() { return this->convert<orxonox::Degree>(); } /** @brief Converts the current value to the given type. */ 439 474 440 475 template <> void MultiType::createNewValueContainer(const char& value); … … 462 497 template <> void MultiType::createNewValueContainer(const orxonox::Degree& value); 463 498 464 inline void MultiType::setValue(const char& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */465 inline void MultiType::setValue(const unsigned char& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */466 inline void MultiType::setValue(const short& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */467 inline void MultiType::setValue(const unsigned short& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */468 inline void MultiType::setValue(const int& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */469 inline void MultiType::setValue(const unsigned int& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */470 inline void MultiType::setValue(const long& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */471 inline void MultiType::setValue(const unsigned long& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */472 inline void MultiType::setValue(const long long& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */473 inline void MultiType::setValue(const unsigned long long& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */474 inline void MultiType::setValue(const float& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */475 inline void MultiType::setValue(const double& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */476 inline void MultiType::setValue(const long double& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */477 inline void MultiType::setValue(const bool& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */478 inline void MultiType::setValue( void* const& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */479 inline void MultiType::setValue(const std::string& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */480 inline void MultiType::setValue(const orxonox::Vector2& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */481 inline void MultiType::setValue(const orxonox::Vector3& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */482 inline void MultiType::setValue(const orxonox::Vector4& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */483 inline void MultiType::setValue(const orxonox::ColourValue& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */484 inline void MultiType::setValue(const orxonox::Quaternion& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */485 inline void MultiType::setValue(const orxonox::Radian& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */486 inline void MultiType::setValue(const orxonox::Degree& value) { if (this->value_) { this->value_->setValue(value); } else {this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */487 488 inline void MultiType::setValue(const char* value) { if (this->value_) { this->value_->setValue(std::string(value)); } else {this->assignValue(std::string(value)); } } /** @brief Assigns the given value and converts it to the current type. */499 inline bool MultiType::setValue(const char& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 500 inline bool MultiType::setValue(const unsigned char& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 501 inline bool MultiType::setValue(const short& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 502 inline bool MultiType::setValue(const unsigned short& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 503 inline bool MultiType::setValue(const int& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 504 inline bool MultiType::setValue(const unsigned int& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 505 inline bool MultiType::setValue(const long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 506 inline bool MultiType::setValue(const unsigned long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 507 inline bool MultiType::setValue(const long long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 508 inline bool MultiType::setValue(const unsigned long long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 509 inline bool MultiType::setValue(const float& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 510 inline bool MultiType::setValue(const double& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 511 inline bool MultiType::setValue(const long double& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 512 inline bool MultiType::setValue(const bool& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 513 inline bool MultiType::setValue( void* const& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 514 inline bool MultiType::setValue(const std::string& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 515 inline bool MultiType::setValue(const orxonox::Vector2& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 516 inline bool MultiType::setValue(const orxonox::Vector3& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 517 inline bool MultiType::setValue(const orxonox::Vector4& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 518 inline bool MultiType::setValue(const orxonox::ColourValue& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 519 inline bool MultiType::setValue(const orxonox::Quaternion& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 520 inline bool MultiType::setValue(const orxonox::Radian& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 521 inline bool MultiType::setValue(const orxonox::Degree& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */ 522 523 inline bool MultiType::setValue(const char* value) { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } } /** @brief Assigns the given value and converts it to the current type. */ 489 524 490 525 #endif /* _MultiType_H__ */ -
code/branches/objecthierarchy/src/util/MultiTypeValue.h
r1854 r2002 54 54 55 55 /** @brief Resets the current value to the default. */ 56 inline void reset() { this->value_ = T(); }56 inline void reset() { this->value_ = zeroise<T>(); bHasDefaultValue_ = true; } 57 57 58 58 /** @brief Assigns the value of the other MultiType, converted to T. @param other The other MultiType */ 59 inline void assimilate(const MultiType& other) { if (other.value_) { T temp; other.getValue(&temp); this->value_ = temp; } else { this->value_ = T(); } } 59 inline bool assimilate(const MultiType& other) 60 { 61 if (other.value_) 62 { 63 return !(bHasDefaultValue_ = !other.value_->getValue(&value_)); 64 } 65 else 66 { 67 this->value_ = zeroise<T>(); 68 return !(bHasDefaultValue_ = true); 69 } 70 } 60 71 61 inline void setValue(const char& value) { this->value_ = getConvertedValue<char, T>(value); } /** @brief Assigns the value by converting it to T. */ 62 inline void setValue(const unsigned char& value) { this->value_ = getConvertedValue<unsigned char, T>(value); } /** @brief Assigns the value by converting it to T. */ 63 inline void setValue(const short& value) { this->value_ = getConvertedValue<short, T>(value); } /** @brief Assigns the value by converting it to T. */ 64 inline void setValue(const unsigned short& value) { this->value_ = getConvertedValue<unsigned short, T>(value); } /** @brief Assigns the value by converting it to T. */ 65 inline void setValue(const int& value) { this->value_ = getConvertedValue<int, T>(value); } /** @brief Assigns the value by converting it to T. */ 66 inline void setValue(const unsigned int& value) { this->value_ = getConvertedValue<unsigned int, T>(value); } /** @brief Assigns the value by converting it to T. */ 67 inline void setValue(const long& value) { this->value_ = getConvertedValue<long, T>(value); } /** @brief Assigns the value by converting it to T. */ 68 inline void setValue(const unsigned long& value) { this->value_ = getConvertedValue<unsigned long, T>(value); } /** @brief Assigns the value by converting it to T. */ 69 inline void setValue(const long long& value) { this->value_ = getConvertedValue<long long, T>(value); } /** @brief Assigns the value by converting it to T. */ 70 inline void setValue(const unsigned long long& value) { this->value_ = getConvertedValue<unsigned long long, T>(value); } /** @brief Assigns the value by converting it to T. */ 71 inline void setValue(const float& value) { this->value_ = getConvertedValue<float, T>(value); } /** @brief Assigns the value by converting it to T. */ 72 inline void setValue(const double& value) { this->value_ = getConvertedValue<double, T>(value); } /** @brief Assigns the value by converting it to T. */ 73 inline void setValue(const long double& value) { this->value_ = getConvertedValue<long double, T>(value); } /** @brief Assigns the value by converting it to T. */ 74 inline void setValue(const bool& value) { this->value_ = getConvertedValue<bool, T>(value); } /** @brief Assigns the value by converting it to T. */ 75 inline void setValue( void* const& value) { this->value_ = getConvertedValue<void*, T>(value); } /** @brief Assigns the value by converting it to T. */ 76 inline void setValue(const std::string& value) { this->value_ = getConvertedValue<std::string, T>(value); } /** @brief Assigns the value by converting it to T. */ 77 inline void setValue(const orxonox::Vector2& value) { this->value_ = getConvertedValue<orxonox::Vector2, T>(value); } /** @brief Assigns the value by converting it to T. */ 78 inline void setValue(const orxonox::Vector3& value) { this->value_ = getConvertedValue<orxonox::Vector3, T>(value); } /** @brief Assigns the value by converting it to T. */ 79 inline void setValue(const orxonox::Vector4& value) { this->value_ = getConvertedValue<orxonox::Vector4, T>(value); } /** @brief Assigns the value by converting it to T. */ 80 inline void setValue(const orxonox::ColourValue& value) { this->value_ = getConvertedValue<orxonox::ColourValue, T>(value); } /** @brief Assigns the value by converting it to T. */ 81 inline void setValue(const orxonox::Quaternion& value) { this->value_ = getConvertedValue<orxonox::Quaternion, T>(value); } /** @brief Assigns the value by converting it to T. */ 82 inline void setValue(const orxonox::Radian& value) { this->value_ = getConvertedValue<orxonox::Radian, T>(value); } /** @brief Assigns the value by converting it to T. */ 83 inline void setValue(const orxonox::Degree& value) { this->value_ = getConvertedValue<orxonox::Degree, T>(value); } /** @brief Assigns the value by converting it to T. */ 72 inline bool getValue(char* value) const { return ConvertValue<T, char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 73 inline bool getValue(unsigned char* value) const { return ConvertValue<T, unsigned char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 74 inline bool getValue(short* value) const { return ConvertValue<T, short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 75 inline bool getValue(unsigned short* value) const { return ConvertValue<T, unsigned short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 76 inline bool getValue(int* value) const { return ConvertValue<T, int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 77 inline bool getValue(unsigned int* value) const { return ConvertValue<T, unsigned int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 78 inline bool getValue(long* value) const { return ConvertValue<T, long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 79 inline bool getValue(unsigned long* value) const { return ConvertValue<T, unsigned long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 80 inline bool getValue(long long* value) const { return ConvertValue<T, long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 81 inline bool getValue(unsigned long long* value) const { return ConvertValue<T, unsigned long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 82 inline bool getValue(float* value) const { return ConvertValue<T, float >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 83 inline bool getValue(double* value) const { return ConvertValue<T, double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 84 inline bool getValue(long double* value) const { return ConvertValue<T, long double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 85 inline bool getValue(bool* value) const { return ConvertValue<T, bool >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 86 inline bool getValue(void** value) const { return ConvertValue<T, void* >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 87 inline bool getValue(std::string* value) const { return ConvertValue<T, std::string >(value, value_, zeroise<std::string> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 88 inline bool getValue(orxonox::Vector2* value) const { return ConvertValue<T, orxonox::Vector2 >(value, value_, zeroise<orxonox::Vector2> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 89 inline bool getValue(orxonox::Vector3* value) const { return ConvertValue<T, orxonox::Vector3 >(value, value_, zeroise<orxonox::Vector3> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 90 inline bool getValue(orxonox::Vector4* value) const { return ConvertValue<T, orxonox::Vector4 >(value, value_, zeroise<orxonox::Vector4> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 91 inline bool getValue(orxonox::ColourValue* value) const { return ConvertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 92 inline bool getValue(orxonox::Quaternion* value) const { return ConvertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 93 inline bool getValue(orxonox::Radian* value) const { return ConvertValue<T, orxonox::Radian >(value, value_, zeroise<orxonox::Radian> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 94 inline bool getValue(orxonox::Degree* value) const { return ConvertValue<T, orxonox::Degree >(value, value_, zeroise<orxonox::Degree> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 95 96 inline bool setValue(const char& value) { return !(bHasDefaultValue_ = !ConvertValue<char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 97 inline bool setValue(const unsigned char& value) { return !(bHasDefaultValue_ = !ConvertValue<unsigned char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 98 inline bool setValue(const short& value) { return !(bHasDefaultValue_ = !ConvertValue<short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 99 inline bool setValue(const unsigned short& value) { return !(bHasDefaultValue_ = !ConvertValue<unsigned short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 100 inline bool setValue(const int& value) { return !(bHasDefaultValue_ = !ConvertValue<int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 101 inline bool setValue(const unsigned int& value) { return !(bHasDefaultValue_ = !ConvertValue<unsigned int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 102 inline bool setValue(const long& value) { return !(bHasDefaultValue_ = !ConvertValue<long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 103 inline bool setValue(const unsigned long& value) { return !(bHasDefaultValue_ = !ConvertValue<unsigned long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 104 inline bool setValue(const long long& value) { return !(bHasDefaultValue_ = !ConvertValue<long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 105 inline bool setValue(const unsigned long long& value) { return !(bHasDefaultValue_ = !ConvertValue<unsigned long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 106 inline bool setValue(const float& value) { return !(bHasDefaultValue_ = !ConvertValue<float , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 107 inline bool setValue(const double& value) { return !(bHasDefaultValue_ = !ConvertValue<double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 108 inline bool setValue(const long double& value) { return !(bHasDefaultValue_ = !ConvertValue<long double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 109 inline bool setValue(const bool& value) { return !(bHasDefaultValue_ = !ConvertValue<bool , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 110 inline bool setValue( void* const& value) { return !(bHasDefaultValue_ = !ConvertValue<void* , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 111 inline bool setValue(const std::string& value) { return !(bHasDefaultValue_ = !ConvertValue<std::string , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 112 inline bool setValue(const orxonox::Vector2& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Vector2 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 113 inline bool setValue(const orxonox::Vector3& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Vector3 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 114 inline bool setValue(const orxonox::Vector4& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Vector4 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 115 inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 116 inline bool setValue(const orxonox::Quaternion& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 117 inline bool setValue(const orxonox::Radian& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Radian , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 118 inline bool setValue(const orxonox::Degree& value) { return !(bHasDefaultValue_ = !ConvertValue<orxonox::Degree , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 84 119 85 120 inline operator char() const { return getConvertedValue<T, char> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */ … … 96 131 inline operator double() const { return getConvertedValue<T, double> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */ 97 132 inline operator long double() const { return getConvertedValue<T, long double> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */ 98 inline operator bool() const { return getConvertedValue<T, bool> (this->value_, false); }/** @brief Returns the current value, converted to the requested type. */133 inline operator bool() const { return getConvertedValue<T, bool> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */ 99 134 inline operator void*() const { return getConvertedValue<T, void*> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */ 100 inline operator std::string() const { return getConvertedValue<T, std::string> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */101 inline operator orxonox::Vector2() const { return getConvertedValue<T, orxonox::Vector2> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */102 inline operator orxonox::Vector3() const { return getConvertedValue<T, orxonox::Vector3> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */103 inline operator orxonox::Vector4() const { return getConvertedValue<T, orxonox::Vector4> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */104 inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_ ); }/** @brief Returns the current value, converted to the requested type. */105 inline operator orxonox::Quaternion() const { return getConvertedValue<T, orxonox::Quaternion> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */106 inline operator orxonox::Radian() const { return getConvertedValue<T, orxonox::Radian> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */107 inline operator orxonox::Degree() const { return getConvertedValue<T, orxonox::Degree> (this->value_ ); }/** @brief Returns the current value, converted to the requested type. */135 inline operator std::string() const { return getConvertedValue<T, std::string> (this->value_, zeroise<std::string >()); } /** @brief Returns the current value, converted to the requested type. */ 136 inline operator orxonox::Vector2() const { return getConvertedValue<T, orxonox::Vector2> (this->value_, zeroise<orxonox::Vector2 >()); } /** @brief Returns the current value, converted to the requested type. */ 137 inline operator orxonox::Vector3() const { return getConvertedValue<T, orxonox::Vector3> (this->value_, zeroise<orxonox::Vector3 >()); } /** @brief Returns the current value, converted to the requested type. */ 138 inline operator orxonox::Vector4() const { return getConvertedValue<T, orxonox::Vector4> (this->value_, zeroise<orxonox::Vector4 >()); } /** @brief Returns the current value, converted to the requested type. */ 139 inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_, zeroise<orxonox::ColourValue>()); } /** @brief Returns the current value, converted to the requested type. */ 140 inline operator orxonox::Quaternion() const { return getConvertedValue<T, orxonox::Quaternion> (this->value_, zeroise<orxonox::Quaternion >()); } /** @brief Returns the current value, converted to the requested type. */ 141 inline operator orxonox::Radian() const { return getConvertedValue<T, orxonox::Radian> (this->value_, zeroise<orxonox::Radian >()); } /** @brief Returns the current value, converted to the requested type. */ 142 inline operator orxonox::Degree() const { return getConvertedValue<T, orxonox::Degree> (this->value_, zeroise<orxonox::Degree >()); } /** @brief Returns the current value, converted to the requested type. */ 108 143 109 144 /** @brief Puts the current value on the stream */
Note: See TracChangeset
for help on using the changeset viewer.