Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core3/src/util/MultiType.h @ 1728

Last change on this file since 1728 was 1728, checked in by landauf, 16 years ago

Added getXXX() functions to MultiType, where XXX stands for any supported typename.
getString() replaces toString().
Like in getValue(type* pointer), the current value gets converted to the requested type. It's basically just a call to the convert-operator, so (1) "type a = mymultitype;", (2) "type a; mymultitype.getValue(&a);" and (3) "type a = get'Type'();" are equivalent, but the implicit cast (1) may be ambiguous.

  • Property svn:eol-style set to native
File size: 35.6 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _MultiType_H__
30#define _MultiType_H__
31
32#include "UtilPrereqs.h"
33
34#include <boost/static_assert.hpp>
35
36#include "Math.h"
37
38// disable annoying warning about multiple assignment operators
39#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
40#pragma warning(push)
41#pragma warning(disable:4522)
42#endif
43
44enum MT_Type
45{
46    MT_null,
47    MT_char,
48    MT_uchar,
49    MT_short,
50    MT_ushort,
51    MT_int,
52    MT_uint,
53    MT_long,
54    MT_ulong,
55    MT_longlong,
56    MT_ulonglong,
57    MT_float,
58    MT_double,
59    MT_longdouble,
60    MT_bool,
61    MT_void,
62    MT_string,
63    MT_vector2,
64    MT_vector3,
65    MT_vector4,
66    MT_colourvalue,
67    MT_quaternion,
68    MT_radian,
69    MT_degree
70};
71
72class _UtilExport MultiType
73{
74    _UtilExport friend std::ostream& operator<<(std::ostream& outstream, const MultiType& mt);
75    template <typename T> friend struct MT_Value;
76
77    struct _UtilExport MT_ValueBase
78    {
79        MT_ValueBase(MT_Type type) : type_(type) {}
80        virtual ~MT_ValueBase() {}
81
82        virtual MT_ValueBase* clone() const = 0;
83
84        virtual void reset() = 0;
85        virtual void assimilate(const MultiType& other) = 0;
86        const MT_Type& getType() const { return this->type_; }
87
88        virtual void setValue(const char& value)                 = 0;
89        virtual void setValue(const unsigned char& value)        = 0;
90        virtual void setValue(const short& value)                = 0;
91        virtual void setValue(const unsigned short& value)       = 0;
92        virtual void setValue(const int& value)                  = 0;
93        virtual void setValue(const unsigned int& value)         = 0;
94        virtual void setValue(const long& value)                 = 0;
95        virtual void setValue(const unsigned long& value)        = 0;
96        virtual void setValue(const long long& value)            = 0;
97        virtual void setValue(const unsigned long long& value)   = 0;
98        virtual void setValue(const float& value)                = 0;
99        virtual void setValue(const double& value)               = 0;
100        virtual void setValue(const long double& value)          = 0;
101        virtual void setValue(const bool& value)                 = 0;
102        virtual void setValue(      void* const& value)          = 0;
103        virtual void setValue(const std::string& value)          = 0;
104        virtual void setValue(const orxonox::Vector2& value)     = 0;
105        virtual void setValue(const orxonox::Vector3& value)     = 0;
106        virtual void setValue(const orxonox::Vector4& value)     = 0;
107        virtual void setValue(const orxonox::ColourValue& value) = 0;
108        virtual void setValue(const orxonox::Quaternion& value)  = 0;
109        virtual void setValue(const orxonox::Radian& value)      = 0;
110        virtual void setValue(const orxonox::Degree& value)      = 0;
111
112        virtual operator char()                 const = 0;
113        virtual operator unsigned char()        const = 0;
114        virtual operator short()                const = 0;
115        virtual operator unsigned short()       const = 0;
116        virtual operator int()                  const = 0;
117        virtual operator unsigned int()         const = 0;
118        virtual operator long()                 const = 0;
119        virtual operator unsigned long()        const = 0;
120        virtual operator long long()            const = 0;
121        virtual operator unsigned long long()   const = 0;
122        virtual operator float()                const = 0;
123        virtual operator double()               const = 0;
124        virtual operator long double()          const = 0;
125        virtual operator bool()                 const = 0;
126        virtual operator void*()                const = 0;
127        virtual operator std::string()          const = 0;
128        virtual operator orxonox::Vector2()     const = 0;
129        virtual operator orxonox::Vector3()     const = 0;
130        virtual operator orxonox::Vector4()     const = 0;
131        virtual operator orxonox::ColourValue() const = 0;
132        virtual operator orxonox::Quaternion()  const = 0;
133        virtual operator orxonox::Radian()      const = 0;
134        virtual operator orxonox::Degree()      const = 0;
135
136        virtual void toString(std::ostream& outstream) const = 0;
137
138        MT_Type type_;
139    };
140
141    public:
142        inline MultiType()                                  : value_(0) {}
143        inline MultiType(const char& value)                 : value_(0) { this->assignValue(value); }
144        inline MultiType(const unsigned char& value)        : value_(0) { this->assignValue(value); }
145        inline MultiType(const short& value)                : value_(0) { this->assignValue(value); }
146        inline MultiType(const unsigned short& value)       : value_(0) { this->assignValue(value); }
147        inline MultiType(const int& value)                  : value_(0) { this->assignValue(value); }
148        inline MultiType(const unsigned int& value)         : value_(0) { this->assignValue(value); }
149        inline MultiType(const long& value)                 : value_(0) { this->assignValue(value); }
150        inline MultiType(const unsigned long& value)        : value_(0) { this->assignValue(value); }
151        inline MultiType(const long long& value)            : value_(0) { this->assignValue(value); }
152        inline MultiType(const unsigned long long& value)   : value_(0) { this->assignValue(value); }
153        inline MultiType(const float& value)                : value_(0) { this->assignValue(value); }
154        inline MultiType(const double& value)               : value_(0) { this->assignValue(value); }
155        inline MultiType(const long double& value)          : value_(0) { this->assignValue(value); }
156        inline MultiType(const bool& value)                 : value_(0) { this->assignValue(value); }
157        inline MultiType(      void* const& value)          : value_(0) { this->assignValue(value); }
158        inline MultiType(const std::string& value)          : value_(0) { this->assignValue(value); }
159        inline MultiType(const orxonox::Vector2& value)     : value_(0) { this->assignValue(value); }
160        inline MultiType(const orxonox::Vector3& value)     : value_(0) { this->assignValue(value); }
161        inline MultiType(const orxonox::Vector4& value)     : value_(0) { this->assignValue(value); }
162        inline MultiType(const orxonox::ColourValue& value) : value_(0) { this->assignValue(value); }
163        inline MultiType(const orxonox::Quaternion& value)  : value_(0) { this->assignValue(value); }
164        inline MultiType(const orxonox::Radian& value)      : value_(0) { this->assignValue(value); }
165        inline MultiType(const orxonox::Degree& value)      : value_(0) { this->assignValue(value); }
166        inline MultiType(const char* value)                 : value_(0) { this->setValue(std::string(value)); }
167        inline MultiType(const MultiType& other)            : value_(0) { this->setValue(other); }
168        inline MultiType(MT_Type type)                      : value_(0) { this->setType(type); }
169
170        inline ~MultiType() { if (this->value_) { delete this->value_; } }
171
172        template <typename V> inline MultiType& operator=(const V& value)         { this->setValue(value); return (*this); }
173        inline                       MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); }
174        inline                       MultiType& operator=(MT_Type type)           { this->setType(type);   return (*this); }
175
176        inline void                                   setValue(const char& value);
177        inline void                                   setValue(const unsigned char& value);
178        inline void                                   setValue(const short& value);
179        inline void                                   setValue(const unsigned short& value);
180        inline void                                   setValue(const int& value);
181        inline void                                   setValue(const unsigned int& value);
182        inline void                                   setValue(const long& value);
183        inline void                                   setValue(const unsigned long& value);
184        inline void                                   setValue(const long long& value);
185        inline void                                   setValue(const unsigned long long& value);
186        inline void                                   setValue(const float& value);
187        inline void                                   setValue(const double& value);
188        inline void                                   setValue(const long double& value);
189        inline void                                   setValue(const bool& value);
190        inline void                                   setValue(      void* const& value);
191        inline void                                   setValue(const std::string& value);
192        inline void                                   setValue(const orxonox::Vector2& value);
193        inline void                                   setValue(const orxonox::Vector3& value);
194        inline void                                   setValue(const orxonox::Vector4& value);
195        inline void                                   setValue(const orxonox::ColourValue& value);
196        inline void                                   setValue(const orxonox::Quaternion& value);
197        inline void                                   setValue(const orxonox::Radian& value);
198        inline void                                   setValue(const orxonox::Degree& value);
199        template <typename V> inline void             setValue(V* value)               { if (this->value_) { this->value_->setValue((void*)value); } else { this->assignValue((void*)value); } }
200        void                                          setValue(const MultiType& other) { if (this->value_) { this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } } }
201        template <typename T, typename V> inline void setValue(const V& value)         { this->setType<T>(); this->setValue(value); }
202        inline void                                   setValue(const char* value);
203
204        inline void                       copy(const MultiType& other)    { if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
205
206        template <typename T> inline void convert()                       { this->setValue<T>((T)(*this));  }
207        inline void                       convert(const MultiType& other) { this->convert(other.getType()); }
208        void                              convert(MT_Type type);
209
210        inline void                       reset()                         { if (this->value_) { delete this->value_; this->value_ = 0; } }
211
212        template <typename T> inline void setType()                       { this->assignValue(T());             }
213        inline void                       setType(const MultiType& other) { this->setType(other.getType());     }
214        inline void                       setType(MT_Type type)           { this->reset(); this->convert(type); }
215
216        inline MT_Type                    getType()                 const { return (this->value_) ? this->value_->type_ : MT_null; }
217        inline bool                       isType(MT_Type type)      const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_null); }
218        template <typename T> inline bool isType()                  const { return false; }
219        std::string                       getTypename()             const;
220
221        operator char()                  const;
222        operator unsigned char()         const;
223        operator short()                 const;
224        operator unsigned short()        const;
225        operator int()                   const;
226        operator unsigned int()          const;
227        operator long()                  const;
228        operator unsigned long()         const;
229        operator long long()             const;
230        operator unsigned long long()    const;
231        operator float()                 const;
232        operator double()                const;
233        operator long double()           const;
234        operator bool()                  const;
235        operator void*()                 const;
236        operator std::string()           const;
237        operator orxonox::Vector2()      const;
238        operator orxonox::Vector3()      const;
239        operator orxonox::Vector4()      const;
240        operator orxonox::ColourValue()  const;
241        operator orxonox::Quaternion()   const;
242        operator orxonox::Radian()       const;
243        operator orxonox::Degree()       const;
244        template <class T> operator T*() const { return ((T*)this->operator void*()); }
245
246        inline void getValue(char*                 value) const { if (this->value_) { (*value) = (*this->value_); } }
247        inline void getValue(unsigned char*        value) const { if (this->value_) { (*value) = (*this->value_); } }
248        inline void getValue(short*                value) const { if (this->value_) { (*value) = (*this->value_); } }
249        inline void getValue(unsigned short*       value) const { if (this->value_) { (*value) = (*this->value_); } }
250        inline void getValue(int*                  value) const { if (this->value_) { (*value) = (*this->value_); } }
251        inline void getValue(unsigned int*         value) const { if (this->value_) { (*value) = (*this->value_); } }
252        inline void getValue(long*                 value) const { if (this->value_) { (*value) = (*this->value_); } }
253        inline void getValue(unsigned long*        value) const { if (this->value_) { (*value) = (*this->value_); } }
254        inline void getValue(long long*            value) const { if (this->value_) { (*value) = (*this->value_); } }
255        inline void getValue(unsigned long long*   value) const { if (this->value_) { (*value) = (*this->value_); } }
256        inline void getValue(float*                value) const { if (this->value_) { (*value) = (*this->value_); } }
257        inline void getValue(double*               value) const { if (this->value_) { (*value) = (*this->value_); } }
258        inline void getValue(long double*          value) const { if (this->value_) { (*value) = (*this->value_); } }
259        inline void getValue(bool*                 value) const { if (this->value_) { (*value) = (*this->value_); } }
260        inline void getValue(void*                 value) const { if (this->value_) {   value  = (*this->value_); } }
261        inline void getValue(std::string*          value) const { if (this->value_) { (*value) = this->value_->operator std::string();          } }
262        inline void getValue(orxonox::Vector2*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector2();     } }
263        inline void getValue(orxonox::Vector3*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector3();     } }
264        inline void getValue(orxonox::Vector4*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector4();     } }
265        inline void getValue(orxonox::ColourValue* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::ColourValue(); } }
266        inline void getValue(orxonox::Quaternion*  value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Quaternion();  } }
267        inline void getValue(orxonox::Radian*      value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Radian();      } }
268        inline void getValue(orxonox::Degree*      value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Degree();      } }
269
270        inline char                     getChar()             const { return this->operator char();                 }
271        inline unsigned char            getUnsignedChar()     const { return this->operator unsigned char();        }
272        inline short                    getShort()            const { return this->operator short();                }
273        inline unsigned short           getUnsignedShort()    const { return this->operator unsigned short();       }
274        inline int                      getInt()              const { return this->operator int();                  }
275        inline unsigned int             getUnsignedInt()      const { return this->operator unsigned int();         }
276        inline long                     getLong()             const { return this->operator long();                 }
277        inline unsigned long            getUnsignedLong()     const { return this->operator unsigned long();        }
278        inline long long                getLongLong()         const { return this->operator long long();            }
279        inline unsigned long long       getUnsignedLongLong() const { return this->operator unsigned long long();   }
280        inline float                    getFloat()            const { return this->operator float();                }
281        inline double                   getDouble()           const { return this->operator double();               }
282        inline long double              getLongDouble()       const { return this->operator long double();          }
283        inline bool                     getBool()             const { return this->operator bool();                 }
284        inline void*                    getVoid()             const { return this->operator void*();                }
285        inline std::string              getString()           const { return this->operator std::string();          }
286        inline orxonox::Vector2         getVector2()          const { return this->operator orxonox::Vector2();     }
287        inline orxonox::Vector3         getVector3()          const { return this->operator orxonox::Vector3();     }
288        inline orxonox::Vector4         getVector4()          const { return this->operator orxonox::Vector4();     }
289        inline orxonox::ColourValue     getColourValue()      const { return this->operator orxonox::ColourValue(); }
290        inline orxonox::Quaternion      getQuaternion()       const { return this->operator orxonox::Quaternion();  }
291        inline orxonox::Radian          getRadian()           const { return this->operator orxonox::Radian();      }
292        inline orxonox::Degree          getDegree()           const { return this->operator orxonox::Degree();      }
293        template <typename T> inline T* getPointer()          const { return ((T*)this->getVoid());                 }
294
295    private:
296        inline void assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_char)        { this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 } }
297        inline void assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_uchar)       { this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        } }
298        inline void assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_short)       { this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                } }
299        inline void assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_ushort)      { this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       } }
300        inline void assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_int)         { this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  } }
301        inline void assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_uint)        { this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         } }
302        inline void assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_long)        { this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 } }
303        inline void assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_ulong)       { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        } }
304        inline void assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_longlong)    { this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            } }
305        inline void assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_ulonglong)   { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   } }
306        inline void assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_float)       { this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                } }
307        inline void assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_double)      { this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               } }
308        inline void assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_longdouble)  { this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          } }
309        inline void assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_bool)        { this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 } }
310        inline void assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_void)        { this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                } }
311        inline void assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_string)      { this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          } }
312        inline void assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_vector2)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     } }
313        inline void assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_vector3)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     } }
314        inline void assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_vector4)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     } }
315        inline void assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_colourvalue) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); } }
316        inline void assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_quaternion)  { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  } }
317        inline void assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_radian)      { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      } }
318        inline void assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_degree)      { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      } }
319
320        template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
321        template <typename T>        void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
322
323        MT_ValueBase* value_;
324};
325
326_UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }
327
328template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == MT_char);        }
329template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == MT_uchar);       }
330template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == MT_short);       }
331template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == MT_ushort);      }
332template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == MT_int);         }
333template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == MT_uint);        }
334template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == MT_long);        }
335template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == MT_ulong);       }
336template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == MT_longlong);    }
337template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == MT_ulonglong);   }
338template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == MT_float);       }
339template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == MT_double);      }
340template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == MT_longdouble);  }
341template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == MT_bool);        }
342template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == MT_void);        }
343template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == MT_string);      }
344template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == MT_vector2);     }
345template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == MT_vector3);     }
346template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == MT_vector4);     }
347template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_colourvalue); }
348template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == MT_quaternion);  }
349template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == MT_radian);      }
350template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_degree);      }
351
352template <> inline void MultiType::convert<std::string>()          { this->setValue<std::string>         (this->operator std::string());          }
353template <> inline void MultiType::convert<orxonox::Vector2>()     { this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     }
354template <> inline void MultiType::convert<orxonox::Vector3>()     { this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     }
355template <> inline void MultiType::convert<orxonox::Vector4>()     { this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     }
356template <> inline void MultiType::convert<orxonox::ColourValue>() { this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); }
357template <> inline void MultiType::convert<orxonox::Quaternion>()  { this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  }
358template <> inline void MultiType::convert<orxonox::Radian>()      { this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      }
359template <> inline void MultiType::convert<orxonox::Degree>()      { this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      }
360
361template <> inline void MultiType::convert<const std::string&>()          { this->convert<std::string>();          }
362template <> inline void MultiType::convert<const orxonox::Vector2&>()     { this->convert<orxonox::Vector2>();     }
363template <> inline void MultiType::convert<const orxonox::Vector3&>()     { this->convert<orxonox::Vector3>();     }
364template <> inline void MultiType::convert<const orxonox::Vector4&>()     { this->convert<orxonox::Vector4>();     }
365template <> inline void MultiType::convert<const orxonox::ColourValue&>() { this->convert<orxonox::ColourValue>(); }
366template <> inline void MultiType::convert<const orxonox::Quaternion&>()  { this->convert<orxonox::Quaternion>();  }
367template <> inline void MultiType::convert<const orxonox::Radian&>()      { this->convert<orxonox::Radian>();      }
368template <> inline void MultiType::convert<const orxonox::Degree&>()      { this->convert<orxonox::Degree>();      }
369
370template <> void MultiType::createNewValueContainer(const char& value);
371template <> void MultiType::createNewValueContainer(const unsigned char& value);
372template <> void MultiType::createNewValueContainer(const short& value);
373template <> void MultiType::createNewValueContainer(const unsigned short& value);
374template <> void MultiType::createNewValueContainer(const int& value);
375template <> void MultiType::createNewValueContainer(const unsigned int& value);
376template <> void MultiType::createNewValueContainer(const long& value);
377template <> void MultiType::createNewValueContainer(const unsigned long& value);
378template <> void MultiType::createNewValueContainer(const long long& value);
379template <> void MultiType::createNewValueContainer(const unsigned long long& value);
380template <> void MultiType::createNewValueContainer(const float& value);
381template <> void MultiType::createNewValueContainer(const double& value);
382template <> void MultiType::createNewValueContainer(const bool& value);
383template <> void MultiType::createNewValueContainer(const long double& value);
384template <> void MultiType::createNewValueContainer(      void* const& value);
385template <> void MultiType::createNewValueContainer(const std::string& value);
386template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value);
387template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value);
388template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value);
389template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value);
390template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value);
391template <> void MultiType::createNewValueContainer(const orxonox::Radian& value);
392template <> void MultiType::createNewValueContainer(const orxonox::Degree& value);
393
394inline void MultiType::setValue(const char& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
395inline void MultiType::setValue(const unsigned char& value)         { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
396inline void MultiType::setValue(const short& value)                 { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
397inline void MultiType::setValue(const unsigned short& value)        { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
398inline void MultiType::setValue(const int& value)                   { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
399inline void MultiType::setValue(const unsigned int& value)          { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
400inline void MultiType::setValue(const long& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
401inline void MultiType::setValue(const unsigned long& value)         { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
402inline void MultiType::setValue(const long long& value)             { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
403inline void MultiType::setValue(const unsigned long long& value)    { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
404inline void MultiType::setValue(const float& value)                 { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
405inline void MultiType::setValue(const double& value)                { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
406inline void MultiType::setValue(const long double& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
407inline void MultiType::setValue(const bool& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
408inline void MultiType::setValue(      void* const& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
409inline void MultiType::setValue(const std::string& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
410inline void MultiType::setValue(const orxonox::Vector2& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
411inline void MultiType::setValue(const orxonox::Vector3& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
412inline void MultiType::setValue(const orxonox::Vector4& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
413inline void MultiType::setValue(const orxonox::ColourValue& value)  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
414inline void MultiType::setValue(const orxonox::Quaternion& value)   { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
415inline void MultiType::setValue(const orxonox::Radian& value)       { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
416inline void MultiType::setValue(const orxonox::Degree& value)       { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
417
418inline void MultiType::setValue(const char* value)                  { if (this->value_) { this->value_->setValue(std::string(value)); } else { this->assignValue(std::string(value)); } }
419
420
421#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
422#pragma warning(pop)
423#endif
424
425#endif /* _MultiType_H__ */
Note: See TracBrowser for help on using the repository browser.