Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 26, 2008, 12:35:58 AM (17 years ago)
Author:
rgrieder
Message:

Added convert test for gcc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/util/MathConvert.h

    r1779 r2014  
    3737
    3838#include "UtilPrereqs.h"
     39#include "Math.h"
    3940#include "Convert.h"
    40 #include "Math.h"
    4141
    4242
     
    153153// From Radian
    154154template <class ToType>
    155 inline bool fallbackConversion(ToType* output, const orxonox::Radian input)
    156 {
    157     return convertValue<ToType, Ogre::Real>(output, input.valueRadians());
    158 }
     155struct ConverterFallback<ToType, orxonox::Radian>
     156{
     157    static bool convert(ToType* output, const orxonox::Radian& input)
     158    {
     159        return convertValue<ToType, Ogre::Real>(output, input.valueRadians());
     160    }
     161};
    159162
    160163// From Degree
    161164template <class ToType>
    162 inline bool fallbackConversion(ToType* output, const orxonox::Degree input)
    163 {
    164     return convertValue<ToType, Ogre::Real>(output, input.valueDegrees());
    165 }
     165struct ConverterFallback<ToType, orxonox::Degree>
     166{
     167    static bool convert(ToType* output, const orxonox::Degree& input)
     168    {
     169        return convertValue<ToType, Ogre::Real>(output, input.valueDegrees());
     170    }
     171};
    166172
    167173// To Radian
    168174template <class FromType>
    169 inline bool fallbackConversion(orxonox::Radian* output, const FromType input)
    170 {
    171     float temp;
    172     if (convertValue(&temp, input))
    173     {
    174         *output = temp;
    175         return true;
    176     }
    177     else
    178         return false;
    179 }
     175struct ConverterFallback<orxonox::Radian, FromType>
     176{
     177    static bool convert(orxonox::Radian* output, const FromType& input)
     178    {
     179        float temp;
     180        if (convertValue(&temp, input))
     181        {
     182            *output = temp;
     183            return true;
     184        }
     185        else
     186            return false;
     187    }
     188};
    180189
    181190// To Degree
    182191template <class FromType>
    183 inline bool fallbackConversion(orxonox::Degree* output, const FromType input)
    184 {
    185     float temp;
    186     if (convertValue(&temp, input))
    187     {
    188         *output = temp;
    189         return true;
    190     }
    191     else
    192         return false;
    193 }
     192struct ConverterFallback<orxonox::Degree, FromType>
     193{
     194    static bool convert(orxonox::Degree* output, const FromType& input)
     195    {
     196        float temp;
     197        if (convertValue(&temp, input))
     198        {
     199            *output = temp;
     200            return true;
     201        }
     202        else
     203            return false;
     204    }
     205};
    194206
    195207#endif /* _MathConvert_H__ */
Note: See TracChangeset for help on using the changeset viewer.