Changeset 845 for code/branches/core/src/util
- Timestamp:
- Mar 1, 2008, 9:29:23 PM (17 years ago)
- Location:
- code/branches/core/src/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/util/Convert.h
r827 r845 41 41 // DEFAULT CLASS 42 42 template <typename FromType, typename ToType> 43 class _UtilExportConverter43 class Converter 44 44 { 45 45 public: … … 52 52 // PARTIAL SPECIALIZATION TO CONVERT TO STRINGS 53 53 template<typename FromType> 54 class _UtilExportConverter<FromType, std::string>54 class Converter<FromType, std::string> 55 55 { 56 56 public: … … 70 70 // PARTIAL SPECIALIZATION TO CONVERT FROM STRING 71 71 template<typename ToType> 72 class _UtilExportConverter<std::string, ToType>72 class Converter<std::string, ToType> 73 73 { 74 74 public: … … 85 85 // FUNCTION SO WE DO NOT HAVE TO TELL THE COMPILER ABOUT THE TYPE 86 86 template<typename FromType, typename ToType> 87 static _UtilExportbool ConvertValue(ToType* output, const FromType& input)87 static bool ConvertValue(ToType* output, const FromType& input) 88 88 { 89 89 Converter<FromType, ToType> converter; … … 93 93 // THE SAME, BUT WITH DEFAULT VALUE 94 94 template<typename FromType, typename ToType> 95 static _UtilExportbool ConvertValue(ToType* output, const FromType& input, const ToType& fallback)95 static bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback) 96 96 { 97 97 Converter<FromType, ToType> converter; … … 108 108 // Vector2 to std::string 109 109 template <> 110 class _UtilExportConverter<orxonox::Vector2, std::string>110 class Converter<orxonox::Vector2, std::string> 111 111 { 112 112 public: … … 126 126 // Vector3 to std::string 127 127 template <> 128 class _UtilExportConverter<orxonox::Vector3, std::string>128 class Converter<orxonox::Vector3, std::string> 129 129 { 130 130 public: … … 144 144 // Vector4 to std::string 145 145 template <> 146 class _UtilExportConverter<orxonox::Vector4, std::string>146 class Converter<orxonox::Vector4, std::string> 147 147 { 148 148 public: … … 162 162 // Quaternion to std::string 163 163 template <> 164 class _UtilExportConverter<orxonox::Quaternion, std::string>164 class Converter<orxonox::Quaternion, std::string> 165 165 { 166 166 public: … … 180 180 // ColourValue to std::string 181 181 template <> 182 class _UtilExportConverter<orxonox::ColourValue, std::string>182 class Converter<orxonox::ColourValue, std::string> 183 183 { 184 184 public: -
code/branches/core/src/util/Math.h
r792 r845 59 59 60 60 template <typename T> 61 inline _UtilExportT sgn(T x)61 inline T sgn(T x) 62 62 { 63 63 return (x >= 0) ? 1 : -1; … … 65 65 66 66 template <typename T> 67 inline _UtilExportT min(T a, T b)67 inline T min(T a, T b) 68 68 { 69 69 return (a <= b) ? a : b; … … 71 71 72 72 template <typename T> 73 inline _UtilExportT max(T a, T b)73 inline T max(T a, T b) 74 74 { 75 75 return (a >= b) ? a : b; … … 77 77 78 78 template <typename T> 79 inline _UtilExportT clamp(T x, T min, T max)79 inline T clamp(T x, T min, T max) 80 80 { 81 81 if (x < min) … … 89 89 90 90 template <typename T> 91 inline _UtilExportT square(T x)91 inline T square(T x) 92 92 { 93 93 return x*x; … … 95 95 96 96 template <typename T> 97 inline _UtilExportT cube(T x)97 inline T cube(T x) 98 98 { 99 99 return x*x*x; … … 101 101 102 102 template <typename T> 103 inline _UtilExportint floor(T x)103 inline int floor(T x) 104 104 { 105 105 return (int)(x); … … 107 107 108 108 template <typename T> 109 inline _UtilExportint ceil(T x)109 inline int ceil(T x) 110 110 { 111 111 int temp = floor(x); … … 114 114 115 115 template <typename T> 116 inline _UtilExportint round(T x)116 inline int round(T x) 117 117 { 118 118 return (int)(x + 0.5); … … 120 120 121 121 template <typename T> 122 _UtilExportT interpolate(float time, const T& start, const T& end)122 T interpolate(float time, const T& start, const T& end) 123 123 { 124 124 return time * (end - start) + start; … … 126 126 127 127 template <typename T> 128 _UtilExportT interpolateSmooth(float time, const T& start, const T& end)128 T interpolateSmooth(float time, const T& start, const T& end) 129 129 { 130 130 return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start; -
code/branches/core/src/util/String2Number.h
r792 r845 24 24 25 25 template <class T> 26 class _UtilExportString2Number26 class String2Number 27 27 { 28 28 private:
Note: See TracChangeset
for help on using the changeset viewer.