Changeset 3196 for code/trunk/src/util/MultiTypeValue.h
- Timestamp:
- Jun 20, 2009, 9:20:47 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pch (added) merged: 3114-3118,3124-3125,3127-3131,3133,3138-3194
- Property svn:mergeinfo changed
-
code/trunk/src/util/MultiTypeValue.h
r3084 r3196 38 38 39 39 #include "UtilPrereqs.h" 40 41 #include <cassert> 40 42 #include "MathConvert.h" 41 43 #include "MultiType.h" 42 44 #include "Serialise.h" 43 #include <cassert>44 45 45 46 namespace orxonox … … 75 76 } 76 77 77 inline bool getValue(char* value) const { return ConvertValue<T, char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */78 inline bool getValue(unsigned char* value) const { return ConvertValue<T, unsigned char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */79 inline bool getValue(short* value) const { return ConvertValue<T, short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */80 inline bool getValue(unsigned short* value) const { return ConvertValue<T, unsigned short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */81 inline bool getValue(int* value) const { return ConvertValue<T, int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */82 inline bool getValue(unsigned int* value) const { return ConvertValue<T, unsigned int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */83 inline bool getValue(long* value) const { return ConvertValue<T, long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */84 inline bool getValue(unsigned long* value) const { return ConvertValue<T, unsigned long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */85 inline bool getValue(long long* value) const { return ConvertValue<T, long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */86 inline bool getValue(unsigned long long* value) const { return ConvertValue<T, unsigned long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */87 inline bool getValue(float* value) const { return ConvertValue<T, float >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */88 inline bool getValue(double* value) const { return ConvertValue<T, double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */89 inline bool getValue(long double* value) const { return ConvertValue<T, long double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */90 inline bool getValue(bool* value) const { return ConvertValue<T, bool >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */91 inline bool getValue(void** value) const { return ConvertValue<T, void* >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */92 inline bool getValue(std::string* value) const { return ConvertValue<T, std::string >(value, value_, zeroise<std::string> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */93 inline bool getValue(orxonox::Vector2* value) const { return ConvertValue<T, orxonox::Vector2 >(value, value_, zeroise<orxonox::Vector2> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */94 inline bool getValue(orxonox::Vector3* value) const { return ConvertValue<T, orxonox::Vector3 >(value, value_, zeroise<orxonox::Vector3> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */95 inline bool getValue(orxonox::Vector4* value) const { return ConvertValue<T, orxonox::Vector4 >(value, value_, zeroise<orxonox::Vector4> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */96 inline bool getValue(orxonox::ColourValue* value) const { return ConvertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */97 inline bool getValue(orxonox::Quaternion* value) const { return ConvertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */98 inline bool getValue(orxonox::Radian* value) const { return ConvertValue<T, orxonox::Radian >(value, value_, zeroise<orxonox::Radian> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */99 inline bool getValue(orxonox::Degree* value) const { return ConvertValue<T, orxonox::Degree >(value, value_, zeroise<orxonox::Degree> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */100 101 inline bool setValue(const char& value) { return !(bHasDefaultValue_ = ! ConvertValue<char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */102 inline bool setValue(const unsigned char& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */103 inline bool setValue(const short& value) { return !(bHasDefaultValue_ = ! ConvertValue<short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */104 inline bool setValue(const unsigned short& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */105 inline bool setValue(const int& value) { return !(bHasDefaultValue_ = ! ConvertValue<int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */106 inline bool setValue(const unsigned int& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */107 inline bool setValue(const long& value) { return !(bHasDefaultValue_ = ! ConvertValue<long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */108 inline bool setValue(const unsigned long& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */109 inline bool setValue(const long long& value) { return !(bHasDefaultValue_ = ! ConvertValue<long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */110 inline bool setValue(const unsigned long long& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */111 inline bool setValue(const float& value) { return !(bHasDefaultValue_ = ! ConvertValue<float , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */112 inline bool setValue(const double& value) { return !(bHasDefaultValue_ = ! ConvertValue<double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */113 inline bool setValue(const long double& value) { return !(bHasDefaultValue_ = ! ConvertValue<long double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */114 inline bool setValue(const bool& value) { return !(bHasDefaultValue_ = ! ConvertValue<bool , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */115 inline bool setValue( void* const& value) { return !(bHasDefaultValue_ = ! ConvertValue<void* , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */116 inline bool setValue(const std::string& value) { return !(bHasDefaultValue_ = ! ConvertValue<std::string , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */117 inline bool setValue(const orxonox::Vector2& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Vector2 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */118 inline bool setValue(const orxonox::Vector3& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Vector3 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */119 inline bool setValue(const orxonox::Vector4& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Vector4 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */120 inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */121 inline bool setValue(const orxonox::Quaternion& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */122 inline bool setValue(const orxonox::Radian& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Radian , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */123 inline bool setValue(const orxonox::Degree& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Degree , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */78 inline bool getValue(char* value) const { return convertValue<T, char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 79 inline bool getValue(unsigned char* value) const { return convertValue<T, unsigned char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 80 inline bool getValue(short* value) const { return convertValue<T, short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 81 inline bool getValue(unsigned short* value) const { return convertValue<T, unsigned short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 82 inline bool getValue(int* value) const { return convertValue<T, int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 83 inline bool getValue(unsigned int* value) const { return convertValue<T, unsigned int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 84 inline bool getValue(long* value) const { return convertValue<T, long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 85 inline bool getValue(unsigned long* value) const { return convertValue<T, unsigned long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 86 inline bool getValue(long long* value) const { return convertValue<T, long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 87 inline bool getValue(unsigned long long* value) const { return convertValue<T, unsigned long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 88 inline bool getValue(float* value) const { return convertValue<T, float >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 89 inline bool getValue(double* value) const { return convertValue<T, double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 90 inline bool getValue(long double* value) const { return convertValue<T, long double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 91 inline bool getValue(bool* value) const { return convertValue<T, bool >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 92 inline bool getValue(void** value) const { return convertValue<T, void* >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 93 inline bool getValue(std::string* value) const { return convertValue<T, std::string >(value, value_, zeroise<std::string> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 94 inline bool getValue(orxonox::Vector2* value) const { return convertValue<T, orxonox::Vector2 >(value, value_, zeroise<orxonox::Vector2> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 95 inline bool getValue(orxonox::Vector3* value) const { return convertValue<T, orxonox::Vector3 >(value, value_, zeroise<orxonox::Vector3> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 96 inline bool getValue(orxonox::Vector4* value) const { return convertValue<T, orxonox::Vector4 >(value, value_, zeroise<orxonox::Vector4> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 97 inline bool getValue(orxonox::ColourValue* value) const { return convertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 98 inline bool getValue(orxonox::Quaternion* value) const { return convertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 99 inline bool getValue(orxonox::Radian* value) const { return convertValue<T, orxonox::Radian >(value, value_, zeroise<orxonox::Radian> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 100 inline bool getValue(orxonox::Degree* value) const { return convertValue<T, orxonox::Degree >(value, value_, zeroise<orxonox::Degree> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 101 102 inline bool setValue(const char& value) { return !(bHasDefaultValue_ = !convertValue<char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 103 inline bool setValue(const unsigned char& value) { return !(bHasDefaultValue_ = !convertValue<unsigned char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 104 inline bool setValue(const short& value) { return !(bHasDefaultValue_ = !convertValue<short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 105 inline bool setValue(const unsigned short& value) { return !(bHasDefaultValue_ = !convertValue<unsigned short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 106 inline bool setValue(const int& value) { return !(bHasDefaultValue_ = !convertValue<int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 107 inline bool setValue(const unsigned int& value) { return !(bHasDefaultValue_ = !convertValue<unsigned int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 108 inline bool setValue(const long& value) { return !(bHasDefaultValue_ = !convertValue<long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 109 inline bool setValue(const unsigned long& value) { return !(bHasDefaultValue_ = !convertValue<unsigned long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 110 inline bool setValue(const long long& value) { return !(bHasDefaultValue_ = !convertValue<long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 111 inline bool setValue(const unsigned long long& value) { return !(bHasDefaultValue_ = !convertValue<unsigned long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 112 inline bool setValue(const float& value) { return !(bHasDefaultValue_ = !convertValue<float , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 113 inline bool setValue(const double& value) { return !(bHasDefaultValue_ = !convertValue<double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 114 inline bool setValue(const long double& value) { return !(bHasDefaultValue_ = !convertValue<long double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 115 inline bool setValue(const bool& value) { return !(bHasDefaultValue_ = !convertValue<bool , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 116 inline bool setValue( void* const& value) { return !(bHasDefaultValue_ = !convertValue<void* , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 117 inline bool setValue(const std::string& value) { return !(bHasDefaultValue_ = !convertValue<std::string , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 118 inline bool setValue(const orxonox::Vector2& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector2 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 119 inline bool setValue(const orxonox::Vector3& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector3 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 120 inline bool setValue(const orxonox::Vector4& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector4 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 121 inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 122 inline bool setValue(const orxonox::Quaternion& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 123 inline bool setValue(const orxonox::Radian& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Radian , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 124 inline bool setValue(const orxonox::Degree& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Degree , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 124 125 125 126 inline operator char() const { return getConvertedValue<T, char> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */ … … 194 195 saveAndIncrease( this->value_.z, mem ); 195 196 saveAndIncrease( this->value_.w, mem ); 196 }template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const 197 } 198 template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const 197 199 { 198 200 return 4*returnSize(this->value_.x);
Note: See TracChangeset
for help on using the changeset viewer.