Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 7:04:09 PM (16 years ago)
Author:
landauf
Message:

merged objecthierarchy branch back to trunk

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util

  • code/trunk/src/util/MultiType.cc

    r1791 r2087  
    3939    @param type The type
    4040*/
    41 void MultiType::convert(MT_Type type)
     41bool MultiType::convert(MT_Type type)
    4242{
    4343    switch (type)
    4444    {
    4545        case MT_char:
    46             this->convert<char>(); break;
     46            return this->convert<char>(); break;
    4747        case MT_uchar:
    48             this->convert<unsigned char>(); break;
     48            return this->convert<unsigned char>(); break;
    4949        case MT_short:
    50             this->convert<short>(); break;
     50            return this->convert<short>(); break;
    5151        case MT_ushort:
    52             this->convert<unsigned short>(); break;
     52            return this->convert<unsigned short>(); break;
    5353        case MT_int:
    54             this->convert<int>(); break;
     54            return this->convert<int>(); break;
    5555        case MT_uint:
    56             this->convert<unsigned int>(); break;
     56            return this->convert<unsigned int>(); break;
    5757        case MT_long:
    58             this->convert<long>(); break;
     58            return this->convert<long>(); break;
    5959        case MT_ulong:
    60             this->convert<unsigned long>(); break;
     60            return this->convert<unsigned long>(); break;
    6161        case MT_longlong:
    62             this->convert<long long>(); break;
     62            return this->convert<long long>(); break;
    6363        case MT_ulonglong:
    64             this->convert<unsigned long long>(); break;
     64            return this->convert<unsigned long long>(); break;
    6565        case MT_float:
    66             this->convert<float>(); break;
     66            return this->convert<float>(); break;
    6767        case MT_double:
    68             this->convert<double>(); break;
     68            return this->convert<double>(); break;
    6969        case MT_longdouble:
    70             this->convert<long double>(); break;
     70            return this->convert<long double>(); break;
    7171        case MT_bool:
    72             this->convert<bool>(); break;
     72            return this->convert<bool>(); break;
    7373        case MT_void:
    74             this->convert<void*>(); break;
     74            return this->convert<void*>(); break;
    7575        case MT_string:
    76             this->convert<std::string>(); break;
     76            return this->convert<std::string>(); break;
    7777        case MT_vector2:
    78             this->convert<orxonox::Vector2>(); break;
     78            return this->convert<orxonox::Vector2>(); break;
    7979        case MT_vector3:
    80             this->convert<orxonox::Vector3>(); break;
     80            return this->convert<orxonox::Vector3>(); break;
    8181        case MT_vector4:
    82             this->convert<orxonox::Vector4>(); break;
     82            return this->convert<orxonox::Vector4>(); break;
    8383        case MT_colourvalue:
    84             this->convert<orxonox::ColourValue>(); break;
     84            return this->convert<orxonox::ColourValue>(); break;
    8585        case MT_quaternion:
    86             this->convert<orxonox::Quaternion>(); break;
     86            return this->convert<orxonox::Quaternion>(); break;
    8787        case MT_radian:
    88             this->convert<orxonox::Radian>(); break;
     88            return this->convert<orxonox::Radian>(); break;
    8989        case MT_degree:
    90             this->convert<orxonox::Degree>(); break;
     90            return this->convert<orxonox::Degree>(); break;
    9191        default:
    92             this->reset(); break;
     92            this->reset(); return false; break;
    9393    };
    9494}
     
    168168MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_double     ) ? ((MT_Value<double>              *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
    169169MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_longdouble ) ? ((MT_Value<long double>         *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
    170 MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_bool       ) ? ((MT_Value<bool>                *)this->value_)->value_ : (*this->value_)) : false;                  } /** @brief Returns the current value, converted to the requested type. */
    171 MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_void       ) ? ((MT_Value<void*>               *)this->value_)->value_ : (*this->value_)) : (void*)0;               } /** @brief Returns the current value, converted to the requested type. */
    172 MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_string     ) ? ((MT_Value<std::string>         *)this->value_)->value_ : (*this->value_)) : std::string();          } /** @brief Returns the current value, converted to the requested type. */
    173 MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_vector2    ) ? ((MT_Value<orxonox::Vector2>    *)this->value_)->value_ : (*this->value_)) : orxonox::Vector2();     } /** @brief Returns the current value, converted to the requested type. */
    174 MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_vector3    ) ? ((MT_Value<orxonox::Vector3>    *)this->value_)->value_ : (*this->value_)) : orxonox::Vector3();     } /** @brief Returns the current value, converted to the requested type. */
    175 MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_vector4    ) ? ((MT_Value<orxonox::Vector4>    *)this->value_)->value_ : (*this->value_)) : orxonox::Vector4();     } /** @brief Returns the current value, converted to the requested type. */
    176 MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ((MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : orxonox::ColourValue(); } /** @brief Returns the current value, converted to the requested type. */
    177 MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ((MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : orxonox::Quaternion();  } /** @brief Returns the current value, converted to the requested type. */
    178 MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_radian     ) ? ((MT_Value<orxonox::Radian>     *)this->value_)->value_ : (*this->value_)) : orxonox::Radian();      } /** @brief Returns the current value, converted to the requested type. */
    179 MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_degree     ) ? ((MT_Value<orxonox::Degree>     *)this->value_)->value_ : (*this->value_)) : orxonox::Degree();      } /** @brief Returns the current value, converted to the requested type. */
     170MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_bool       ) ? ((MT_Value<bool>                *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
     171MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_void       ) ? ((MT_Value<void*>               *)this->value_)->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
     172MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_string     ) ? ((MT_Value<std::string>         *)this->value_)->value_ : (*this->value_)) : zeroise<std::string>();          } /** @brief Returns the current value, converted to the requested type. */
     173MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_vector2    ) ? ((MT_Value<orxonox::Vector2>    *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector2>();     } /** @brief Returns the current value, converted to the requested type. */
     174MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_vector3    ) ? ((MT_Value<orxonox::Vector3>    *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector3>();     } /** @brief Returns the current value, converted to the requested type. */
     175MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_vector4    ) ? ((MT_Value<orxonox::Vector4>    *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Vector4>();     } /** @brief Returns the current value, converted to the requested type. */
     176MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? ((MT_Value<orxonox::ColourValue>*)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */
     177MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? ((MT_Value<orxonox::Quaternion> *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Quaternion>();  } /** @brief Returns the current value, converted to the requested type. */
     178MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_radian     ) ? ((MT_Value<orxonox::Radian>     *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Radian>();      } /** @brief Returns the current value, converted to the requested type. */
     179MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_degree     ) ? ((MT_Value<orxonox::Degree>     *)this->value_)->value_ : (*this->value_)) : zeroise<orxonox::Degree>();      } /** @brief Returns the current value, converted to the requested type. */
    180180
    181181template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_char       ); } /** @brief Creates a new value container for the given type. */
Note: See TracChangeset for help on using the changeset viewer.