Changeset 1791 for code/trunk/src/util/MultiType.h
- Timestamp:
- Sep 16, 2008, 3:46:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/util/MultiType.h
r1757 r1791 27 27 */ 28 28 29 /** 30 @file MultiType.h 31 @brief Declaration of the MultiType and some helper constructs. 32 33 The MultiType can hold a value of one of the following types: 34 - all primitives 35 - all pointers 36 - string 37 - Vector2, Vector3, Vector4 38 - Quaternion 39 - ColourValue 40 - Radian, Degree 41 42 The MultiType has a "type" determined by the first assigned value, either through 43 - the constructor, 44 - the assignment operator= or 45 - setValue(value). 46 If you assign another value of another type, the MultiType keeps "it's" type and 47 converts the new value to this type. 48 49 If you want to change the type, there are three possibilities: 50 - convert<T>() set's the type to T and converts the currently assigned value 51 - setType<T>() set's the type to T and resets the value 52 - setValue<T>(value) assigns a new value and changes the type to T. 53 54 @example 55 MultiType a = 10;; // a has now the type int and the value 10 56 a.setValue("3.14"); // a has still the type int and "3.14" gets converted, therefore the value is now 3 57 a.setValue<float>("3.14"); // a has now the type float and "3.14" gets converted to 3.14 58 a.convert<bool>(); // converts 3.14 to bool, which is true 59 a = false; // assigns false, this is equivalent to a.setValue(false) 60 */ 61 29 62 #ifndef _MultiType_H__ 30 63 #define _MultiType_H__ … … 36 69 #include "Math.h" 37 70 71 /** 72 @brief Enum of all possible types of a MultiType. 73 */ 38 74 enum MT_Type 39 75 { … … 64 100 }; 65 101 102 /** 103 @brief The MultiType can hold a value of many possible types and convert them to other types. 104 105 The following types are supported by the MultiType: 106 - all primitves 107 - all pointers 108 - string 109 - Vector2, Vector3, Vector4 110 - Quaternion 111 - ColourValue 112 - Radian, Degree 113 114 The internal type of a MultiType is determined by the first assigned value, but can be 115 changed by using setType<T>(), convert<T>() or setValue<T>(value). If a value gets assigned 116 the normal way (operator=, setValue(value)), the value gets converted to the current internal 117 type of the MultiType. 118 */ 66 119 class _UtilExport MultiType 67 120 { … … 69 122 template <typename T> friend struct MT_Value; 70 123 124 /** 125 @brief MT_ValueBase is an almost pure virtual baseclass of MT_Value<T>, which holds the value of the MultiType. 126 This class is only used within the MultiType. 127 */ 71 128 struct _UtilExport MT_ValueBase 72 129 { … … 78 135 virtual void reset() = 0; 79 136 virtual void assimilate(const MultiType& other) = 0; 137 138 /** @brief Returns the type of the current value. */ 80 139 const MT_Type& getType() const { return this->type_; } 81 140 … … 130 189 virtual void toString(std::ostream& outstream) const = 0; 131 190 132 MT_Type type_; 191 MT_Type type_; //! The type of the current value 133 192 }; 134 193 135 194 public: 136 inline MultiType() : value_(0) {} 137 inline MultiType(const char& value) : value_(0) { this->assignValue(value); } 138 inline MultiType(const unsigned char& value) : value_(0) { this->assignValue(value); } 139 inline MultiType(const short& value) : value_(0) { this->assignValue(value); } 140 inline MultiType(const unsigned short& value) : value_(0) { this->assignValue(value); } 141 inline MultiType(const int& value) : value_(0) { this->assignValue(value); } 142 inline MultiType(const unsigned int& value) : value_(0) { this->assignValue(value); } 143 inline MultiType(const long& value) : value_(0) { this->assignValue(value); } 144 inline MultiType(const unsigned long& value) : value_(0) { this->assignValue(value); } 145 inline MultiType(const long long& value) : value_(0) { this->assignValue(value); } 146 inline MultiType(const unsigned long long& value) : value_(0) { this->assignValue(value); } 147 inline MultiType(const float& value) : value_(0) { this->assignValue(value); } 148 inline MultiType(const double& value) : value_(0) { this->assignValue(value); } 149 inline MultiType(const long double& value) : value_(0) { this->assignValue(value); } 150 inline MultiType(const bool& value) : value_(0) { this->assignValue(value); } 151 inline MultiType( void* const& value) : value_(0) { this->assignValue(value); } 152 inline MultiType(const std::string& value) : value_(0) { this->assignValue(value); } 153 inline MultiType(const orxonox::Vector2& value) : value_(0) { this->assignValue(value); } 154 inline MultiType(const orxonox::Vector3& value) : value_(0) { this->assignValue(value); } 155 inline MultiType(const orxonox::Vector4& value) : value_(0) { this->assignValue(value); } 156 inline MultiType(const orxonox::ColourValue& value) : value_(0) { this->assignValue(value); } 157 inline MultiType(const orxonox::Quaternion& value) : value_(0) { this->assignValue(value); } 158 inline MultiType(const orxonox::Radian& value) : value_(0) { this->assignValue(value); } 159 inline MultiType(const orxonox::Degree& value) : value_(0) { this->assignValue(value); } 160 inline MultiType(const char* value) : value_(0) { this->setValue(std::string(value)); } 161 inline MultiType(const MultiType& other) : value_(0) { this->setValue(other); } 162 inline MultiType(MT_Type type) : value_(0) { this->setType(type); } 163 195 inline MultiType() : value_(0) {} /** @brief Default constructor: Assigns no value and no type. The type will be determined by the first assignment of a value. */ 196 inline MultiType(const char& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 197 inline MultiType(const unsigned char& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 198 inline MultiType(const short& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 199 inline MultiType(const unsigned short& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 200 inline MultiType(const int& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 201 inline MultiType(const unsigned int& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 202 inline MultiType(const long& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 203 inline MultiType(const unsigned long& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 204 inline MultiType(const long long& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 205 inline MultiType(const unsigned long long& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 206 inline MultiType(const float& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 207 inline MultiType(const double& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 208 inline MultiType(const long double& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 209 inline MultiType(const bool& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 210 inline MultiType( void* const& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 211 inline MultiType(const std::string& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 212 inline MultiType(const orxonox::Vector2& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 213 inline MultiType(const orxonox::Vector3& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 214 inline MultiType(const orxonox::Vector4& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 215 inline MultiType(const orxonox::ColourValue& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 216 inline MultiType(const orxonox::Quaternion& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 217 inline MultiType(const orxonox::Radian& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 218 inline MultiType(const orxonox::Degree& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 219 inline MultiType(const char* value) : value_(0) { this->setValue(std::string(value)); } /** @brief Constructor: Converts the char array to a std::string, assigns the value and sets the type. */ 220 inline MultiType(const MultiType& other) : value_(0) { this->setValue(other); } /** @brief Copyconstructor: Assigns value and type of the other MultiType. */ 221 inline MultiType(MT_Type type) : value_(0) { this->setType(type); } /** @brief Constructor: Sets the type, the next assignment will determine the value. */ 222 223 /** @brief Destructor: Deletes the MT_Value. */ 164 224 inline ~MultiType() { if (this->value_) { delete this->value_; } } 165 225 166 template <typename V> inline const MultiType& operator=(const V& value) { this->setValue(value); return (*this); } 167 inline const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } 168 inline const MultiType& operator=(MT_Type type) { this->setType(type); return (*this); } 226 template <typename V> inline const MultiType& operator=(const V& value) { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */ 227 template <typename V> inline const MultiType& operator=(V* value) { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */ 228 inline const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */ 229 inline const MultiType& operator=(MT_Type type) { this->setType(type); return (*this); } /** @brief Resets the value and changes the type. */ 169 230 170 231 inline void setValue(const char& value); … … 191 252 inline void setValue(const orxonox::Radian& value); 192 253 inline void setValue(const orxonox::Degree& value); 254 inline void setValue(const char* value); 255 /** @brief Assigns a pointer. */ 193 256 template <typename V> inline void setValue(V* value) { if (this->value_) { this->value_->setValue((void*)value); } else { this->assignValue((void*)value); } } 257 /** @brief Assigns the value of the other MultiType and converts it to the current type. */ 194 258 void setValue(const MultiType& other) { if (this->value_) { this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } } } 259 /** @brief Changes the type to T and assigns the new value (which might be of another type than T - it gets converted). */ 195 260 template <typename T, typename V> inline void setValue(const V& value) { this->setType<T>(); this->setValue(value); } 196 inline void setValue(const char* value); 197 261 262 263 /** @brief Copies the other MultiType by assigning value and type. */ 198 264 inline void copy(const MultiType& other) { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; } 199 265 200 template <typename T> inline void convert() { this->setValue<T>((T)(*this)); } 201 inline void convert(const MultiType& other) { this->convert(other.getType()); } 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. */ 202 268 void convert(MT_Type type); 203 269 270 /** @brief Resets the value to the defaultvalue of the current type. */ 204 271 inline void reset() { if (this->value_) { delete this->value_; this->value_ = 0; } } 205 272 206 template <typename T> inline void setType() { this->assignValue(T()); } 207 inline void setType(const MultiType& other) { this->setType(other.getType()); } 208 inline void setType(MT_Type type) { this->reset(); this->convert(type); } 209 273 template <typename T> inline void setType() { this->assignValue(T()); } /** @brief Resets the value and changes the internal type to T. */ 274 inline void setType(const MultiType& other) { this->setType(other.getType()); } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */ 275 inline void setType(MT_Type type) { this->reset(); this->convert(type); this->reset(); } /** @brief Resets the value and changes the internal type to the given type. */ 276 277 /** @brief Returns the current type. */ 210 278 inline MT_Type getType() const { return (this->value_) ? this->value_->type_ : MT_null; } 279 /** @brief Returns true if the current type equals the given type. */ 211 280 inline bool isType(MT_Type type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_null); } 212 template <typename T> inline bool isType() const { return false; } 281 /** @brief Returns true if the current type is T. */ 282 template <typename T> inline bool isType() const { return false; } // Only works for specialized values - see below 213 283 std::string getTypename() const; 214 284 … … 236 306 operator orxonox::Radian() const; 237 307 operator orxonox::Degree() const; 308 /** @brief Returns the current value, converted to a T* pointer. */ 238 309 template <class T> operator T*() const { return ((T*)this->operator void*()); } 239 310 240 inline void getValue(char* value) const { if (this->value_) { (*value) = (*this->value_); } } 241 inline void getValue(unsigned char* value) const { if (this->value_) { (*value) = (*this->value_); } } 242 inline void getValue(short* value) const { if (this->value_) { (*value) = (*this->value_); } } 243 inline void getValue(unsigned short* value) const { if (this->value_) { (*value) = (*this->value_); } } 244 inline void getValue(int* value) const { if (this->value_) { (*value) = (*this->value_); } } 245 inline void getValue(unsigned int* value) const { if (this->value_) { (*value) = (*this->value_); } } 246 inline void getValue(long* value) const { if (this->value_) { (*value) = (*this->value_); } } 247 inline void getValue(unsigned long* value) const { if (this->value_) { (*value) = (*this->value_); } } 248 inline void getValue(long long* value) const { if (this->value_) { (*value) = (*this->value_); } } 249 inline void getValue(unsigned long long* value) const { if (this->value_) { (*value) = (*this->value_); } } 250 inline void getValue(float* value) const { if (this->value_) { (*value) = (*this->value_); } } 251 inline void getValue(double* value) const { if (this->value_) { (*value) = (*this->value_); } } 252 inline void getValue(long double* value) const { if (this->value_) { (*value) = (*this->value_); } } 253 inline void getValue(bool* value) const { if (this->value_) { (*value) = (*this->value_); } } 254 inline void getValue(void* value) const { if (this->value_) { value = (*this->value_); } } 255 inline void getValue(std::string* value) const { if (this->value_) { (*value) = this->value_->operator std::string(); } } 256 inline void getValue(orxonox::Vector2* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector2(); } } 257 inline void getValue(orxonox::Vector3* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector3(); } } 258 inline void getValue(orxonox::Vector4* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector4(); } } 259 inline void getValue(orxonox::ColourValue* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::ColourValue(); } } 260 inline void getValue(orxonox::Quaternion* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Quaternion(); } } 261 inline void getValue(orxonox::Radian* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Radian(); } } 262 inline void getValue(orxonox::Degree* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Degree(); } } 263 264 inline char getChar() const { return this->operator char(); } 265 inline unsigned char getUnsignedChar() const { return this->operator unsigned char(); } 266 inline short getShort() const { return this->operator short(); } 267 inline unsigned short getUnsignedShort() const { return this->operator unsigned short(); } 268 inline int getInt() const { return this->operator int(); } 269 inline unsigned int getUnsignedInt() const { return this->operator unsigned int(); } 270 inline long getLong() const { return this->operator long(); } 271 inline unsigned long getUnsignedLong() const { return this->operator unsigned long(); } 272 inline long long getLongLong() const { return this->operator long long(); } 273 inline unsigned long long getUnsignedLongLong() const { return this->operator unsigned long long(); } 274 inline float getFloat() const { return this->operator float(); } 275 inline double getDouble() const { return this->operator double(); } 276 inline long double getLongDouble() const { return this->operator long double(); } 277 inline bool getBool() const { return this->operator bool(); } 278 inline void* getVoid() const { return this->operator void*(); } 279 inline std::string getString() const { return this->operator std::string(); } 280 inline orxonox::Vector2 getVector2() const { return this->operator orxonox::Vector2(); } 281 inline orxonox::Vector3 getVector3() const { return this->operator orxonox::Vector3(); } 282 inline orxonox::Vector4 getVector4() const { return this->operator orxonox::Vector4(); } 283 inline orxonox::ColourValue getColourValue() const { return this->operator orxonox::ColourValue(); } 284 inline orxonox::Quaternion getQuaternion() const { return this->operator orxonox::Quaternion(); } 285 inline orxonox::Radian getRadian() const { return this->operator orxonox::Radian(); } 286 inline orxonox::Degree getDegree() const { return this->operator orxonox::Degree(); } 287 template <typename T> inline T* getPointer() const { return ((T*)this->getVoid()); } 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. */ 334 335 inline char getChar() const { return this->operator char(); } /** @brief Returns the current value, converted to the requested type. */ 336 inline unsigned char getUnsignedChar() const { return this->operator unsigned char(); } /** @brief Returns the current value, converted to the requested type. */ 337 inline short getShort() const { return this->operator short(); } /** @brief Returns the current value, converted to the requested type. */ 338 inline unsigned short getUnsignedShort() const { return this->operator unsigned short(); } /** @brief Returns the current value, converted to the requested type. */ 339 inline int getInt() const { return this->operator int(); } /** @brief Returns the current value, converted to the requested type. */ 340 inline unsigned int getUnsignedInt() const { return this->operator unsigned int(); } /** @brief Returns the current value, converted to the requested type. */ 341 inline long getLong() const { return this->operator long(); } /** @brief Returns the current value, converted to the requested type. */ 342 inline unsigned long getUnsignedLong() const { return this->operator unsigned long(); } /** @brief Returns the current value, converted to the requested type. */ 343 inline long long getLongLong() const { return this->operator long long(); } /** @brief Returns the current value, converted to the requested type. */ 344 inline unsigned long long getUnsignedLongLong() const { return this->operator unsigned long long(); } /** @brief Returns the current value, converted to the requested type. */ 345 inline float getFloat() const { return this->operator float(); } /** @brief Returns the current value, converted to the requested type. */ 346 inline double getDouble() const { return this->operator double(); } /** @brief Returns the current value, converted to the requested type. */ 347 inline long double getLongDouble() const { return this->operator long double(); } /** @brief Returns the current value, converted to the requested type. */ 348 inline bool getBool() const { return this->operator bool(); } /** @brief Returns the current value, converted to the requested type. */ 349 inline void* getVoid() const { return this->operator void*(); } /** @brief Returns the current value, converted to the requested type. */ 350 inline std::string getString() const { return this->operator std::string(); } /** @brief Returns the current value, converted to the requested type. */ 351 inline orxonox::Vector2 getVector2() const { return this->operator orxonox::Vector2(); } /** @brief Returns the current value, converted to the requested type. */ 352 inline orxonox::Vector3 getVector3() const { return this->operator orxonox::Vector3(); } /** @brief Returns the current value, converted to the requested type. */ 353 inline orxonox::Vector4 getVector4() const { return this->operator orxonox::Vector4(); } /** @brief Returns the current value, converted to the requested type. */ 354 inline orxonox::ColourValue getColourValue() const { return this->operator orxonox::ColourValue(); } /** @brief Returns the current value, converted to the requested type. */ 355 inline orxonox::Quaternion getQuaternion() const { return this->operator orxonox::Quaternion(); } /** @brief Returns the current value, converted to the requested type. */ 356 inline orxonox::Radian getRadian() const { return this->operator orxonox::Radian(); } /** @brief Returns the current value, converted to the requested type. */ 357 inline orxonox::Degree getDegree() const { return this->operator orxonox::Degree(); } /** @brief Returns the current value, converted to the requested type. */ 358 template <typename T> inline T* getPointer() const { return ((T*)this->getVoid()); } /** @brief Returns the current value, converted to a T* pointer. */ 288 359 289 360 private: 290 inline void assignValue(const char& value) { if (this->value_ && this->value_->type_ == MT_char) { this->value_->setValue(value); } else { this->changeValueContainer<char>(value); } } 291 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); } } 292 inline void assignValue(const short& value) { if (this->value_ && this->value_->type_ == MT_short) { this->value_->setValue(value); } else { this->changeValueContainer<short>(value); } } 293 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); } } 294 inline void assignValue(const int& value) { if (this->value_ && this->value_->type_ == MT_int) { this->value_->setValue(value); } else { this->changeValueContainer<int>(value); } } 295 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); } } 296 inline void assignValue(const long& value) { if (this->value_ && this->value_->type_ == MT_long) { this->value_->setValue(value); } else { this->changeValueContainer<long>(value); } } 297 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); } } 298 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); } } 299 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); } } 300 inline void assignValue(const float& value) { if (this->value_ && this->value_->type_ == MT_float) { this->value_->setValue(value); } else { this->changeValueContainer<float>(value); } } 301 inline void assignValue(const double& value) { if (this->value_ && this->value_->type_ == MT_double) { this->value_->setValue(value); } else { this->changeValueContainer<double>(value); } } 302 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); } } 303 inline void assignValue(const bool& value) { if (this->value_ && this->value_->type_ == MT_bool) { this->value_->setValue(value); } else { this->changeValueContainer<bool>(value); } } 304 inline void assignValue( void* const& value) { if (this->value_ && this->value_->type_ == MT_void) { this->value_->setValue(value); } else { this->changeValueContainer<void*>(value); } } 305 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); } } 306 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); } } 307 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); } } 308 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); } } 309 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); } } 310 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); } } 311 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); } } 312 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); } } 313 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. */ 384 385 /** @brief Changes the value container. */ 314 386 template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); } 387 /** @brief Creates a new value container (works only with specialized types). */ 315 388 template <typename T> void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); } 316 389 317 MT_ValueBase* value_; 390 MT_ValueBase* value_; //! A pointer to the value container 318 391 }; 319 392 393 /** @brief Puts the MultiType on a stream by using the native << operator of the current type. */ 320 394 _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; } 321 395 322 template <> inline bool MultiType::isType<char>() const { return (this->value_ && this->value_->type_ == MT_char); } 323 template <> inline bool MultiType::isType<unsigned char>() const { return (this->value_ && this->value_->type_ == MT_uchar); } 324 template <> inline bool MultiType::isType<short>() const { return (this->value_ && this->value_->type_ == MT_short); } 325 template <> inline bool MultiType::isType<unsigned short>() const { return (this->value_ && this->value_->type_ == MT_ushort); } 326 template <> inline bool MultiType::isType<int>() const { return (this->value_ && this->value_->type_ == MT_int); } 327 template <> inline bool MultiType::isType<unsigned int>() const { return (this->value_ && this->value_->type_ == MT_uint); } 328 template <> inline bool MultiType::isType<long>() const { return (this->value_ && this->value_->type_ == MT_long); } 329 template <> inline bool MultiType::isType<unsigned long>() const { return (this->value_ && this->value_->type_ == MT_ulong); } 330 template <> inline bool MultiType::isType<long long>() const { return (this->value_ && this->value_->type_ == MT_longlong); } 331 template <> inline bool MultiType::isType<unsigned long long>() const { return (this->value_ && this->value_->type_ == MT_ulonglong); } 332 template <> inline bool MultiType::isType<float>() const { return (this->value_ && this->value_->type_ == MT_float); } 333 template <> inline bool MultiType::isType<double>() const { return (this->value_ && this->value_->type_ == MT_double); } 334 template <> inline bool MultiType::isType<long double>() const { return (this->value_ && this->value_->type_ == MT_longdouble); } 335 template <> inline bool MultiType::isType<bool>() const { return (this->value_ && this->value_->type_ == MT_bool); } 336 template <> inline bool MultiType::isType<void*>() const { return (this->value_ && this->value_->type_ == MT_void); } 337 template <> inline bool MultiType::isType<std::string>() const { return (this->value_ && this->value_->type_ == MT_string); } 338 template <> inline bool MultiType::isType<orxonox::Vector2>() const { return (this->value_ && this->value_->type_ == MT_vector2); } 339 template <> inline bool MultiType::isType<orxonox::Vector3>() const { return (this->value_ && this->value_->type_ == MT_vector3); } 340 template <> inline bool MultiType::isType<orxonox::Vector4>() const { return (this->value_ && this->value_->type_ == MT_vector4); } 341 template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_colourvalue); } 342 template <> inline bool MultiType::isType<orxonox::Quaternion>() const { return (this->value_ && this->value_->type_ == MT_quaternion); } 343 template <> inline bool MultiType::isType<orxonox::Radian>() const { return (this->value_ && this->value_->type_ == MT_radian); } 344 template <> inline bool MultiType::isType<orxonox::Degree>() const { return (this->value_ && this->value_->type_ == MT_degree); } 345 346 template <> inline void MultiType::convert<std::string>() { this->setValue<std::string> (this->operator std::string()); } 347 template <> inline void MultiType::convert<orxonox::Vector2>() { this->setValue<orxonox::Vector2> (this->operator orxonox::Vector2()); } 348 template <> inline void MultiType::convert<orxonox::Vector3>() { this->setValue<orxonox::Vector3> (this->operator orxonox::Vector3()); } 349 template <> inline void MultiType::convert<orxonox::Vector4>() { this->setValue<orxonox::Vector4> (this->operator orxonox::Vector4()); } 350 template <> inline void MultiType::convert<orxonox::ColourValue>() { this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } 351 template <> inline void MultiType::convert<orxonox::Quaternion>() { this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion()); } 352 template <> inline void MultiType::convert<orxonox::Radian>() { this->setValue<orxonox::Radian> (this->operator orxonox::Radian()); } 353 template <> inline void MultiType::convert<orxonox::Degree>() { this->setValue<orxonox::Degree> (this->operator orxonox::Degree()); } 354 355 template <> inline void MultiType::convert<const std::string&>() { this->convert<std::string>(); } 356 template <> inline void MultiType::convert<const orxonox::Vector2&>() { this->convert<orxonox::Vector2>(); } 357 template <> inline void MultiType::convert<const orxonox::Vector3&>() { this->convert<orxonox::Vector3>(); } 358 template <> inline void MultiType::convert<const orxonox::Vector4&>() { this->convert<orxonox::Vector4>(); } 359 template <> inline void MultiType::convert<const orxonox::ColourValue&>() { this->convert<orxonox::ColourValue>(); } 360 template <> inline void MultiType::convert<const orxonox::Quaternion&>() { this->convert<orxonox::Quaternion>(); } 361 template <> inline void MultiType::convert<const orxonox::Radian&>() { this->convert<orxonox::Radian>(); } 362 template <> inline void MultiType::convert<const orxonox::Degree&>() { this->convert<orxonox::Degree>(); } 396 template <> inline bool MultiType::isType<char>() const { return (this->value_ && this->value_->type_ == MT_char); } /** @brief Returns true if the current type equals the given type. */ 397 template <> inline bool MultiType::isType<unsigned char>() const { return (this->value_ && this->value_->type_ == MT_uchar); } /** @brief Returns true if the current type equals the given type. */ 398 template <> inline bool MultiType::isType<short>() const { return (this->value_ && this->value_->type_ == MT_short); } /** @brief Returns true if the current type equals the given type. */ 399 template <> inline bool MultiType::isType<unsigned short>() const { return (this->value_ && this->value_->type_ == MT_ushort); } /** @brief Returns true if the current type equals the given type. */ 400 template <> inline bool MultiType::isType<int>() const { return (this->value_ && this->value_->type_ == MT_int); } /** @brief Returns true if the current type equals the given type. */ 401 template <> inline bool MultiType::isType<unsigned int>() const { return (this->value_ && this->value_->type_ == MT_uint); } /** @brief Returns true if the current type equals the given type. */ 402 template <> inline bool MultiType::isType<long>() const { return (this->value_ && this->value_->type_ == MT_long); } /** @brief Returns true if the current type equals the given type. */ 403 template <> inline bool MultiType::isType<unsigned long>() const { return (this->value_ && this->value_->type_ == MT_ulong); } /** @brief Returns true if the current type equals the given type. */ 404 template <> inline bool MultiType::isType<long long>() const { return (this->value_ && this->value_->type_ == MT_longlong); } /** @brief Returns true if the current type equals the given type. */ 405 template <> inline bool MultiType::isType<unsigned long long>() const { return (this->value_ && this->value_->type_ == MT_ulonglong); } /** @brief Returns true if the current type equals the given type. */ 406 template <> inline bool MultiType::isType<float>() const { return (this->value_ && this->value_->type_ == MT_float); } /** @brief Returns true if the current type equals the given type. */ 407 template <> inline bool MultiType::isType<double>() const { return (this->value_ && this->value_->type_ == MT_double); } /** @brief Returns true if the current type equals the given type. */ 408 template <> inline bool MultiType::isType<long double>() const { return (this->value_ && this->value_->type_ == MT_longdouble); } /** @brief Returns true if the current type equals the given type. */ 409 template <> inline bool MultiType::isType<bool>() const { return (this->value_ && this->value_->type_ == MT_bool); } /** @brief Returns true if the current type equals the given type. */ 410 template <> inline bool MultiType::isType<void*>() const { return (this->value_ && this->value_->type_ == MT_void); } /** @brief Returns true if the current type equals the given type. */ 411 template <> inline bool MultiType::isType<std::string>() const { return (this->value_ && this->value_->type_ == MT_string); } /** @brief Returns true if the current type equals the given type. */ 412 template <> inline bool MultiType::isType<orxonox::Vector2>() const { return (this->value_ && this->value_->type_ == MT_vector2); } /** @brief Returns true if the current type equals the given type. */ 413 template <> inline bool MultiType::isType<orxonox::Vector3>() const { return (this->value_ && this->value_->type_ == MT_vector3); } /** @brief Returns true if the current type equals the given type. */ 414 template <> inline bool MultiType::isType<orxonox::Vector4>() const { return (this->value_ && this->value_->type_ == MT_vector4); } /** @brief Returns true if the current type equals the given type. */ 415 template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_colourvalue); } /** @brief Returns true if the current type equals the given type. */ 416 template <> inline bool MultiType::isType<orxonox::Quaternion>() const { return (this->value_ && this->value_->type_ == MT_quaternion); } /** @brief Returns true if the current type equals the given type. */ 417 template <> inline bool MultiType::isType<orxonox::Radian>() const { return (this->value_ && this->value_->type_ == MT_radian); } /** @brief Returns true if the current type equals the given type. */ 418 template <> inline bool MultiType::isType<orxonox::Degree>() const { return (this->value_ && this->value_->type_ == MT_degree); } /** @brief Returns true if the current type equals the given type. */ 419 420 // 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. */ 429 430 // 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. */ 363 439 364 440 template <> void MultiType::createNewValueContainer(const char& value); … … 386 462 template <> void MultiType::createNewValueContainer(const orxonox::Degree& value); 387 463 388 inline void MultiType::setValue(const char& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 389 inline void MultiType::setValue(const unsigned char& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 390 inline void MultiType::setValue(const short& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 391 inline void MultiType::setValue(const unsigned short& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 392 inline void MultiType::setValue(const int& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 393 inline void MultiType::setValue(const unsigned int& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 394 inline void MultiType::setValue(const long& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 395 inline void MultiType::setValue(const unsigned long& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 396 inline void MultiType::setValue(const long long& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 397 inline void MultiType::setValue(const unsigned long long& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 398 inline void MultiType::setValue(const float& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 399 inline void MultiType::setValue(const double& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 400 inline void MultiType::setValue(const long double& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 401 inline void MultiType::setValue(const bool& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 402 inline void MultiType::setValue( void* const& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 403 inline void MultiType::setValue(const std::string& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 404 inline void MultiType::setValue(const orxonox::Vector2& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 405 inline void MultiType::setValue(const orxonox::Vector3& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 406 inline void MultiType::setValue(const orxonox::Vector4& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 407 inline void MultiType::setValue(const orxonox::ColourValue& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 408 inline void MultiType::setValue(const orxonox::Quaternion& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 409 inline void MultiType::setValue(const orxonox::Radian& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 410 inline void MultiType::setValue(const orxonox::Degree& value) { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } } 411 412 inline void MultiType::setValue(const char* value) { if (this->value_) { this->value_->setValue(std::string(value)); } else { this->assignValue(std::string(value)); } } 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. */ 413 489 414 490 #endif /* _MultiType_H__ */
Note: See TracChangeset
for help on using the changeset viewer.