Changeset 1001 for code/branches/core2/src/util/MultiTypeMath.cc
- Timestamp:
- Apr 8, 2008, 1:51:25 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/util/MultiTypeMath.cc
r960 r1001 89 89 90 90 MultiTypeMath::operator void*() const 91 { return (this->type_ == MT_void) ? this->value_.void_ : ConvertValueAndReturn<MultiTypeMath, void*>(*this, 0); }91 { return (this->type_ == MT_void) ? this->value_.void_ : getConvertedValue<MultiTypeMath, void*>(*this, 0); } 92 92 MultiTypeMath::operator int() const 93 { return (this->type_ == MT_int) ? this->value_.int_ : ConvertValueAndReturn<MultiTypeMath, int>(*this, 0); }93 { return (this->type_ == MT_int) ? this->value_.int_ : getConvertedValue<MultiTypeMath, int>(*this, 0); } 94 94 MultiTypeMath::operator unsigned int() const 95 { return (this->type_ == MT_uint) ? this->value_.uint_ : ConvertValueAndReturn<MultiTypeMath, unsigned int>(*this, 0); }95 { return (this->type_ == MT_uint) ? this->value_.uint_ : getConvertedValue<MultiTypeMath, unsigned int>(*this, 0); } 96 96 MultiTypeMath::operator char() const 97 { return (this->type_ == MT_char) ? this->value_.char_ : ConvertValueAndReturn<MultiTypeMath, char>(*this, 0); }97 { return (this->type_ == MT_char) ? this->value_.char_ : getConvertedValue<MultiTypeMath, char>(*this, 0); } 98 98 MultiTypeMath::operator unsigned char() const 99 { return (this->type_ == MT_uchar) ? this->value_.uchar_ : ConvertValueAndReturn<MultiTypeMath, unsigned char>(*this, 0); }99 { return (this->type_ == MT_uchar) ? this->value_.uchar_ : getConvertedValue<MultiTypeMath, unsigned char>(*this, 0); } 100 100 MultiTypeMath::operator short() const 101 { return (this->type_ == MT_short) ? this->value_.short_ : ConvertValueAndReturn<MultiTypeMath, short>(*this, 0); }101 { return (this->type_ == MT_short) ? this->value_.short_ : getConvertedValue<MultiTypeMath, short>(*this, 0); } 102 102 MultiTypeMath::operator unsigned short() const 103 { return (this->type_ == MT_ushort) ? this->value_.ushort_ : ConvertValueAndReturn<MultiTypeMath, unsigned short>(*this, 0); }103 { return (this->type_ == MT_ushort) ? this->value_.ushort_ : getConvertedValue<MultiTypeMath, unsigned short>(*this, 0); } 104 104 MultiTypeMath::operator long() const 105 { return (this->type_ == MT_long) ? this->value_.long_ : ConvertValueAndReturn<MultiTypeMath, long>(*this, 0); }105 { return (this->type_ == MT_long) ? this->value_.long_ : getConvertedValue<MultiTypeMath, long>(*this, 0); } 106 106 MultiTypeMath::operator unsigned long() const 107 { return (this->type_ == MT_ulong) ? this->value_.ulong_ : ConvertValueAndReturn<MultiTypeMath, unsigned long>(*this, 0); }107 { return (this->type_ == MT_ulong) ? this->value_.ulong_ : getConvertedValue<MultiTypeMath, unsigned long>(*this, 0); } 108 108 MultiTypeMath::operator float() const 109 { return (this->type_ == MT_float) ? this->value_.float_ : ConvertValueAndReturn<MultiTypeMath, float>(*this, 0); }109 { return (this->type_ == MT_float) ? this->value_.float_ : getConvertedValue<MultiTypeMath, float>(*this, 0); } 110 110 MultiTypeMath::operator double() const 111 { return (this->type_ == MT_double) ? this->value_.double_ : ConvertValueAndReturn<MultiTypeMath, double>(*this, 0); }111 { return (this->type_ == MT_double) ? this->value_.double_ : getConvertedValue<MultiTypeMath, double>(*this, 0); } 112 112 MultiTypeMath::operator long double() const 113 { return (this->type_ == MT_longdouble) ? this->value_.longdouble_ : ConvertValueAndReturn<MultiTypeMath, long double>(*this, 0); }113 { return (this->type_ == MT_longdouble) ? this->value_.longdouble_ : getConvertedValue<MultiTypeMath, long double>(*this, 0); } 114 114 MultiTypeMath::operator bool() const 115 { return (this->type_ == MT_bool) ? this->value_.bool_ : ConvertValueAndReturn<MultiTypeMath, bool>(*this, 0); }115 { return (this->type_ == MT_bool) ? this->value_.bool_ : getConvertedValue<MultiTypeMath, bool>(*this, 0); } 116 116 MultiTypeMath::operator std::string() const 117 { return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypeMath, std::string>(*this); }117 { return (this->type_ == MT_string) ? this->string_ : getConvertedValue<MultiTypeMath, std::string>(*this); } 118 118 MultiTypeMath::operator const char*() const 119 { return ((this->type_ == MT_constchar) ? this->string_ : ConvertValueAndReturn<MultiTypeMath, std::string>(*this)).c_str(); }119 { return ((this->type_ == MT_constchar) ? this->string_ : getConvertedValue<MultiTypeMath, std::string>(*this)).c_str(); } 120 120 MultiTypeMath::operator orxonox::Vector2() const 121 { return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector2>(*this); } 122 MultiTypeMath::operator orxonox::Element() const 123 { return (this->type_ == MT_xmlelement) ? this->xmlelement_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Element>(*this); } 121 { return (this->type_ == MT_vector2) ? this->vector2_ : getConvertedValue<MultiTypeMath, orxonox::Vector2>(*this); } 124 122 MultiTypeMath::operator orxonox::Vector3() const 125 { return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this); }123 { return (this->type_ == MT_vector3) ? this->vector3_ : getConvertedValue<MultiTypeMath, orxonox::Vector3>(*this); } 126 124 MultiTypeMath::operator orxonox::Quaternion() const 127 { return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Quaternion>(*this); }125 { return (this->type_ == MT_quaternion) ? this->quaternion_ : getConvertedValue<MultiTypeMath, orxonox::Quaternion>(*this); } 128 126 MultiTypeMath::operator orxonox::ColourValue() const 129 { return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiTypeMath, orxonox::ColourValue>(*this); }127 { return (this->type_ == MT_colourvalue) ? this->colourvalue_ : getConvertedValue<MultiTypeMath, orxonox::ColourValue>(*this); } 130 128 MultiTypeMath::operator orxonox::Radian() const 131 { return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Radian>(*this); }129 { return (this->type_ == MT_radian) ? this->radian_ : getConvertedValue<MultiTypeMath, orxonox::Radian>(*this); } 132 130 MultiTypeMath::operator orxonox::Degree() const 133 { return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Degree>(*this); }131 { return (this->type_ == MT_degree) ? this->degree_ : getConvertedValue<MultiTypeMath, orxonox::Degree>(*this); } 134 132 135 133 void MultiTypeMath::setValue(const MultiTypeMath& mtm) … … 167 165 168 166 if (this->type_ == MT_vector2) 169 ConvertValue(&output, this->vector2_ );167 ConvertValue(&output, this->vector2_, CP_FromType); 170 168 else if (this->type_ == MT_vector3) 171 ConvertValue(&output, this->vector3_ );169 ConvertValue(&output, this->vector3_, CP_FromType); 172 170 else if (this->type_ == MT_colourvalue) 173 ConvertValue(&output, this->colourvalue_); 171 { std::cout << "3_1\n"; 172 ConvertValue(&output, this->colourvalue_, CP_FromType);} 174 173 else if (this->type_ == MT_quaternion) 175 ConvertValue(&output, this->quaternion_ );174 ConvertValue(&output, this->quaternion_, CP_FromType); 176 175 else if (this->type_ == MT_radian) 177 176 ConvertValue(&output, this->radian_); … … 187 186 { 188 187 if (this->type_ == MT_vector2) 189 return ConvertValue(&this->vector2_, value, orxonox::Vector2(0, 0) );188 return ConvertValue(&this->vector2_, value, orxonox::Vector2(0, 0), CP_FromType); 190 189 else if (this->type_ == MT_vector3) 191 return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0) );190 return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0), CP_FromType); 192 191 else if (this->type_ == MT_colourvalue) 193 return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0)); 192 { std::cout << "4_1\n"; 193 return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0), CP_FromType); } 194 194 else if (this->type_ == MT_quaternion) 195 return ConvertValue(&this->quaternion_, value, orxonox::Quaternion(1, 0, 0, 0) );195 return ConvertValue(&this->quaternion_, value, orxonox::Quaternion(1, 0, 0, 0), CP_FromType); 196 196 else if (this->type_ == MT_radian) 197 197 return ConvertValue(&this->radian_, value, orxonox::Radian(0));
Note: See TracChangeset
for help on using the changeset viewer.