Changeset 3257 for code/branches/core4/src/util/MultiType.h
- Timestamp:
- Jun 30, 2009, 3:14:45 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/util/MultiType.h
r3196 r3257 82 82 @brief Enum of all possible types of a MultiType. 83 83 */ 84 enumMT_Type84 namespace MT_Type 85 85 { 86 MT_null=0, 87 MT_char=1, 88 MT_uchar=2, 89 MT_short=3, 90 MT_ushort=4, 91 MT_int=5, 92 MT_uint=6, 93 MT_long=7, 94 MT_ulong=8, 95 MT_longlong=9, 96 MT_ulonglong=10, 97 MT_float=11, 98 MT_double=12, 99 MT_longdouble=13, 100 MT_bool=14, 101 MT_void=15, 102 MT_string=16, 103 MT_vector2=17, 104 MT_vector3=18, 105 MT_vector4=19, 106 MT_colourvalue=20, 107 MT_quaternion=21, 108 MT_radian=22, 109 MT_degree=23 110 }; 86 enum Value 87 { 88 Null, 89 Char, 90 UnsignedChar, 91 Short, 92 UnsignedShort, 93 Int, 94 UnsignedInt, 95 Long, 96 UnsignedLong, 97 LongLong, 98 UnsignedLongLong, 99 Float, 100 Double, 101 LongDouble, 102 Bool, 103 VoidPointer, 104 String, 105 Vector2, 106 Vector3, 107 Vector4, 108 ColourValue, 109 Quaternion, 110 Radian, 111 Degree 112 }; 113 } 111 114 112 115 /** … … 140 143 { 141 144 public: 142 MT_ValueBase(MT_Type type) : type_(type), bHasDefaultValue_(false) {}145 MT_ValueBase(MT_Type::Value type) : type_(type), bHasDefaultValue_(false) {} 143 146 virtual ~MT_ValueBase() {} 144 147 … … 149 152 150 153 /** @brief Returns the type of the current value. */ 151 const MT_Type & getType() const { return this->type_; }154 const MT_Type::Value& getType() const { return this->type_; } 152 155 153 156 /** @brief Checks whether the value is a default one. */ … … 232 235 virtual uint8_t getSize() const=0; 233 236 234 MT_Type type_;//!< The type of the current value237 MT_Type::Value type_; //!< The type of the current value 235 238 bool bHasDefaultValue_; //!< True if the last conversion wasn't successful 236 239 }; … … 263 266 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. */ 264 267 inline MultiType(const MultiType& other) : value_(0) { this->setValue(other); } /** @brief Copyconstructor: Assigns value and type of the other MultiType. */ 265 inline MultiType(MT_Type type): value_(0) { this->setType(type); } /** @brief Constructor: Sets the type, the next assignment will determine the value. */268 inline MultiType(MT_Type::Value type) : value_(0) { this->setType(type); } /** @brief Constructor: Sets the type, the next assignment will determine the value. */ 266 269 267 270 /** @brief Destructor: Deletes the MT_Value. */ … … 271 274 template <typename V> inline const MultiType& operator=(V* value) { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */ 272 275 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. */ 273 inline const MultiType& operator=(MT_Type type){ this->setType(type); return (*this); } /** @brief Resets the value and changes the type. */276 inline const MultiType& operator=(MT_Type::Value type) { this->setType(type); return (*this); } /** @brief Resets the value and changes the type. */ 274 277 275 278 inline bool setValue(const char& value); … … 310 313 template <typename T> inline bool convert() { return this->setValue<T>((T)(*this)); } /** @brief Converts the current value to type T. */ 311 314 inline bool convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */ 312 bool convert(MT_Type type);313 314 /** @brief Current content gets deleted. New type is MT_ null */315 bool convert(MT_Type::Value type); 316 317 /** @brief Current content gets deleted. New type is MT_Type::Null */ 315 318 inline void reset() { if (this->value_) delete this->value_; this->value_ = 0; } 316 319 /** @brief Current content gets overridden with default zero value */ … … 319 322 template <typename T> inline void setType() { this->assignValue(T()); } /** @brief Resets the value and changes the internal type to T. */ 320 323 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. */ 321 inline void setType(MT_Type type){ this->reset(); this->convert(type); this->resetValue(); } /** @brief Resets the value and changes the internal type to the given type. */324 inline void setType(MT_Type::Value type) { this->reset(); this->convert(type); this->resetValue(); } /** @brief Resets the value and changes the internal type to the given type. */ 322 325 323 326 /** @brief Returns the current type. */ 324 inline MT_Type getType() const { return (this->value_) ? this->value_->type_ : MT_null; }327 inline MT_Type::Value getType() const { return (this->value_) ? this->value_->type_ : MT_Type::Null; } 325 328 /** @brief Returns true if the current type equals the given type. */ 326 inline bool isType(MT_Type type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_null); }329 inline bool isType(MT_Type::Value type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_Type::Null); } 327 330 /** @brief Returns true if the current type is T. */ 328 template <typename T> inline bool isType() const { return false; } // Only works for specialized values - see below329 std::string getTypename() const;331 template <typename T> inline bool isType() const { return false; } // Only works for specialized values - see below 332 std::string getTypename() const; 330 333 331 334 /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */ 332 inline void exportData(uint8_t*& mem) const { assert(sizeof(MT_Type )<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }335 inline void exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); } 333 336 /** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */ 334 inline void importData(uint8_t*& mem) { assert(sizeof(MT_Type )<=8); this->setType(static_cast<MT_Type>(*(uint8_t*)mem)); mem+=sizeof(uint8_t); this->value_->importData(mem); }337 inline void importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*(uint8_t*)mem)); mem+=sizeof(uint8_t); this->value_->importData(mem); } 335 338 /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */ 336 339 inline uint8_t*& operator << (uint8_t*& mem) { importData(mem); return mem; } … … 418 421 419 422 private: 420 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. */421 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. */422 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. */423 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. */424 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. */425 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. */426 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. */427 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. */428 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. */429 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. */430 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. */431 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. */432 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. */433 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. */434 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. */435 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. */436 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. */437 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. */438 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. */439 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. */440 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. */441 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. */442 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. */423 inline bool assignValue(const char& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 424 inline bool assignValue(const unsigned char& value) { if (this->value_ && this->value_->type_ == MT_Type::UnsignedChar) { 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. */ 425 inline bool assignValue(const short& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 426 inline bool assignValue(const unsigned short& value) { if (this->value_ && this->value_->type_ == MT_Type::UnsignedShort) { 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. */ 427 inline bool assignValue(const int& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 428 inline bool assignValue(const unsigned int& value) { if (this->value_ && this->value_->type_ == MT_Type::UnsignedInt) { 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. */ 429 inline bool assignValue(const long& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 430 inline bool assignValue(const unsigned long& value) { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLong) { 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. */ 431 inline bool assignValue(const long long& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 432 inline bool assignValue(const unsigned long long& value) { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong) { 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. */ 433 inline bool assignValue(const float& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 434 inline bool assignValue(const double& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 435 inline bool assignValue(const long double& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 436 inline bool assignValue(const bool& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 437 inline bool assignValue( void* const& value) { if (this->value_ && this->value_->type_ == MT_Type::VoidPointer) { 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. */ 438 inline bool assignValue(const std::string& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 439 inline bool assignValue(const orxonox::Vector2& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 440 inline bool assignValue(const orxonox::Vector3& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 441 inline bool assignValue(const orxonox::Vector4& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 442 inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 443 inline bool assignValue(const orxonox::Quaternion& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 444 inline bool assignValue(const orxonox::Radian& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 445 inline bool assignValue(const orxonox::Degree& value) { if (this->value_ && this->value_->type_ == MT_Type::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. */ 443 446 444 447 /** @brief Changes the value container. */ … … 453 456 _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; } 454 457 455 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. */456 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. */457 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. */458 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. */459 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. */460 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. */461 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. */462 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. */463 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. */464 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. */465 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. */466 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. */467 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. */468 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. */469 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. */470 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. */471 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. */472 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. */473 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. */474 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. */475 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. */476 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. */477 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. */458 template <> inline bool MultiType::isType<char>() const { return (this->value_ && this->value_->type_ == MT_Type::Char); } /** @brief Returns true if the current type equals the given type. */ 459 template <> inline bool MultiType::isType<unsigned char>() const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedChar); } /** @brief Returns true if the current type equals the given type. */ 460 template <> inline bool MultiType::isType<short>() const { return (this->value_ && this->value_->type_ == MT_Type::Short); } /** @brief Returns true if the current type equals the given type. */ 461 template <> inline bool MultiType::isType<unsigned short>() const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedShort); } /** @brief Returns true if the current type equals the given type. */ 462 template <> inline bool MultiType::isType<int>() const { return (this->value_ && this->value_->type_ == MT_Type::Int); } /** @brief Returns true if the current type equals the given type. */ 463 template <> inline bool MultiType::isType<unsigned int>() const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedInt); } /** @brief Returns true if the current type equals the given type. */ 464 template <> inline bool MultiType::isType<long>() const { return (this->value_ && this->value_->type_ == MT_Type::Long); } /** @brief Returns true if the current type equals the given type. */ 465 template <> inline bool MultiType::isType<unsigned long>() const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLong); } /** @brief Returns true if the current type equals the given type. */ 466 template <> inline bool MultiType::isType<long long>() const { return (this->value_ && this->value_->type_ == MT_Type::LongLong); } /** @brief Returns true if the current type equals the given type. */ 467 template <> inline bool MultiType::isType<unsigned long long>() const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong); } /** @brief Returns true if the current type equals the given type. */ 468 template <> inline bool MultiType::isType<float>() const { return (this->value_ && this->value_->type_ == MT_Type::Float); } /** @brief Returns true if the current type equals the given type. */ 469 template <> inline bool MultiType::isType<double>() const { return (this->value_ && this->value_->type_ == MT_Type::Double); } /** @brief Returns true if the current type equals the given type. */ 470 template <> inline bool MultiType::isType<long double>() const { return (this->value_ && this->value_->type_ == MT_Type::LongDouble); } /** @brief Returns true if the current type equals the given type. */ 471 template <> inline bool MultiType::isType<bool>() const { return (this->value_ && this->value_->type_ == MT_Type::Bool); } /** @brief Returns true if the current type equals the given type. */ 472 template <> inline bool MultiType::isType<void*>() const { return (this->value_ && this->value_->type_ == MT_Type::VoidPointer); } /** @brief Returns true if the current type equals the given type. */ 473 template <> inline bool MultiType::isType<std::string>() const { return (this->value_ && this->value_->type_ == MT_Type::String); } /** @brief Returns true if the current type equals the given type. */ 474 template <> inline bool MultiType::isType<orxonox::Vector2>() const { return (this->value_ && this->value_->type_ == MT_Type::Vector2); } /** @brief Returns true if the current type equals the given type. */ 475 template <> inline bool MultiType::isType<orxonox::Vector3>() const { return (this->value_ && this->value_->type_ == MT_Type::Vector3); } /** @brief Returns true if the current type equals the given type. */ 476 template <> inline bool MultiType::isType<orxonox::Vector4>() const { return (this->value_ && this->value_->type_ == MT_Type::Vector4); } /** @brief Returns true if the current type equals the given type. */ 477 template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_Type::ColourValue); } /** @brief Returns true if the current type equals the given type. */ 478 template <> inline bool MultiType::isType<orxonox::Quaternion>() const { return (this->value_ && this->value_->type_ == MT_Type::Quaternion); } /** @brief Returns true if the current type equals the given type. */ 479 template <> inline bool MultiType::isType<orxonox::Radian>() const { return (this->value_ && this->value_->type_ == MT_Type::Radian); } /** @brief Returns true if the current type equals the given type. */ 480 template <> inline bool MultiType::isType<orxonox::Degree>() const { return (this->value_ && this->value_->type_ == MT_Type::Degree); } /** @brief Returns true if the current type equals the given type. */ 478 481 479 482 // Specialization to avoid ambiguities with the conversion operator
Note: See TracChangeset
for help on using the changeset viewer.