Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

several changes to avoid compiler errors with gcc4

  • Property svn:eol-style set to native
File size: 33.3 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    friend std::ostream& operator<<(std::ostream& outstream, const MultiType& mt);
75
76    struct _UtilExport MT_ValueBase
77    {
78        virtual ~MT_ValueBase() {}
79
80        virtual MT_ValueBase* clone() const = 0;
81
82        virtual void setValue(const char& value)                 = 0;
83        virtual void setValue(const unsigned char& value)        = 0;
84        virtual void setValue(const short& value)                = 0;
85        virtual void setValue(const unsigned short& value)       = 0;
86        virtual void setValue(const int& value)                  = 0;
87        virtual void setValue(const unsigned int& value)         = 0;
88        virtual void setValue(const long& value)                 = 0;
89        virtual void setValue(const unsigned long& value)        = 0;
90        virtual void setValue(const long long& value)            = 0;
91        virtual void setValue(const unsigned long long& value)   = 0;
92        virtual void setValue(const float& value)                = 0;
93        virtual void setValue(const double& value)               = 0;
94        virtual void setValue(const long double& value)          = 0;
95        virtual void setValue(const bool& value)                 = 0;
96        virtual void setValue(      void* const& value)          = 0;
97        virtual void setValue(const std::string& value)          = 0;
98        virtual void setValue(const orxonox::Vector2& value)     = 0;
99        virtual void setValue(const orxonox::Vector3& value)     = 0;
100        virtual void setValue(const orxonox::Vector4& value)     = 0;
101        virtual void setValue(const orxonox::ColourValue& value) = 0;
102        virtual void setValue(const orxonox::Quaternion& value)  = 0;
103        virtual void setValue(const orxonox::Radian& value)      = 0;
104        virtual void setValue(const orxonox::Degree& value)      = 0;
105
106        virtual operator char()                 const = 0;
107        virtual operator unsigned char()        const = 0;
108        virtual operator short()                const = 0;
109        virtual operator unsigned short()       const = 0;
110        virtual operator int()                  const = 0;
111        virtual operator unsigned int()         const = 0;
112        virtual operator long()                 const = 0;
113        virtual operator unsigned long()        const = 0;
114        virtual operator long long()            const = 0;
115        virtual operator unsigned long long()   const = 0;
116        virtual operator float()                const = 0;
117        virtual operator double()               const = 0;
118        virtual operator long double()          const = 0;
119        virtual operator bool()                 const = 0;
120        virtual operator void*()                const = 0;
121        virtual operator std::string()          const = 0;
122        virtual operator orxonox::Vector2()     const = 0;
123        virtual operator orxonox::Vector3()     const = 0;
124        virtual operator orxonox::Vector4()     const = 0;
125        virtual operator orxonox::ColourValue() const = 0;
126        virtual operator orxonox::Quaternion()  const = 0;
127        virtual operator orxonox::Radian()      const = 0;
128        virtual operator orxonox::Degree()      const = 0;
129
130        virtual void toString(std::ostream& outstream) const = 0;
131    };
132
133    public:
134        inline                       MultiType()                                  : value_(0), type_(MT_null) {}
135//        template <typename V> inline MultiType(const V& value)                  : value_(0), type_(MT_null) { this->assignValue(value); }
136        inline                       MultiType(const char& value)                 : value_(0), type_(MT_null) { this->assignValue(value); }
137        inline                       MultiType(const unsigned char& value)        : value_(0), type_(MT_null) { this->assignValue(value); }
138        inline                       MultiType(const short& value)                : value_(0), type_(MT_null) { this->assignValue(value); }
139        inline                       MultiType(const unsigned short& value)       : value_(0), type_(MT_null) { this->assignValue(value); }
140        inline                       MultiType(const int& value)                  : value_(0), type_(MT_null) { this->assignValue(value); }
141        inline                       MultiType(const unsigned int& value)         : value_(0), type_(MT_null) { this->assignValue(value); }
142        inline                       MultiType(const long& value)                 : value_(0), type_(MT_null) { this->assignValue(value); }
143        inline                       MultiType(const unsigned long& value)        : value_(0), type_(MT_null) { this->assignValue(value); }
144        inline                       MultiType(const long long& value)            : value_(0), type_(MT_null) { this->assignValue(value); }
145        inline                       MultiType(const unsigned long long& value)   : value_(0), type_(MT_null) { this->assignValue(value); }
146        inline                       MultiType(const float& value)                : value_(0), type_(MT_null) { this->assignValue(value); }
147        inline                       MultiType(const double& value)               : value_(0), type_(MT_null) { this->assignValue(value); }
148        inline                       MultiType(const long double& value)          : value_(0), type_(MT_null) { this->assignValue(value); }
149        inline                       MultiType(const bool& value)                 : value_(0), type_(MT_null) { this->assignValue(value); }
150        inline                       MultiType(const std::string& value)          : value_(0), type_(MT_null) { this->assignValue(value); }
151        inline                       MultiType(const orxonox::Vector2& value)     : value_(0), type_(MT_null) { this->assignValue(value); }
152        inline                       MultiType(const orxonox::Vector3& value)     : value_(0), type_(MT_null) { this->assignValue(value); }
153        inline                       MultiType(const orxonox::Vector4& value)     : value_(0), type_(MT_null) { this->assignValue(value); }
154        inline                       MultiType(const orxonox::ColourValue& value) : value_(0), type_(MT_null) { this->assignValue(value); }
155        inline                       MultiType(const orxonox::Quaternion& value)  : value_(0), type_(MT_null) { this->assignValue(value); }
156        inline                       MultiType(const orxonox::Radian& value)      : value_(0), type_(MT_null) { this->assignValue(value); }
157        inline                       MultiType(const orxonox::Degree& value)      : value_(0), type_(MT_null) { this->assignValue(value); }
158        inline                       MultiType(const MultiType& other)            : value_(0), type_(MT_null) { this->setValue(other); }
159        inline                       MultiType(MT_Type type)                      : value_(0), type_(MT_null) { this->setType(type); }
160        ~MultiType() { if (this->value_) { delete this->value_; } }
161
162        template <typename V>             inline MultiType& operator=(const V& value)         { this->setValue(value);          return (*this); }
163        inline                                   MultiType& operator=(const MultiType& other) { this->setValue(other);          return (*this); }
164        inline                                   MultiType& operator=(MT_Type type)           { this->setType(type);            return (*this); }
165
166        inline void                                   setValue(const char& value);
167        inline void                                   setValue(const unsigned char& value);
168        inline void                                   setValue(const short& value);
169        inline void                                   setValue(const unsigned short& value);
170        inline void                                   setValue(const int& value);
171        inline void                                   setValue(const unsigned int& value);
172        inline void                                   setValue(const long& value);
173        inline void                                   setValue(const unsigned long& value);
174        inline void                                   setValue(const long long& value);
175        inline void                                   setValue(const unsigned long long& value);
176        inline void                                   setValue(const float& value);
177        inline void                                   setValue(const double& value);
178        inline void                                   setValue(const long double& value);
179        inline void                                   setValue(const bool& value);
180        inline void                                   setValue(const std::string& value);
181        inline void                                   setValue(const orxonox::Vector2& value);
182        inline void                                   setValue(const orxonox::Vector3& value);
183        inline void                                   setValue(const orxonox::Vector4& value);
184        inline void                                   setValue(const orxonox::ColourValue& value);
185        inline void                                   setValue(const orxonox::Quaternion& value);
186        inline void                                   setValue(const orxonox::Radian& value);
187        inline void                                   setValue(const orxonox::Degree& value);
188        template <typename V> inline void             setValue(V* value)                           { if (this->value_) { this->value_->setValue((void*)value); } else { this->assignValue((void*)value); } }
189        inline void                                   setValue(const char* value);
190        inline void                                   setValue(const MultiType& other)             { this->type_ = other.type_; this->value_ = (other.value_) ? other.value_->clone() : 0; }
191        template <typename T, typename V> inline void setValue(const V& value)                     { this->assignValue((T)value); }
192
193        template <typename T> inline void convert() { this->setValue<T>((T)(*this)); }
194
195        inline void                       reset() { if (this->value_) { delete this->value_; this->value_ = 0; } this->type_ = MT_null; }
196
197        template <typename T> inline void setType()                       { this->assignValue(T()); }
198        inline void                       setType(const MultiType& other) { this->setType(other.type_); }
199        void                              setType(MT_Type type);
200
201        operator char()                  const;
202        operator unsigned char()         const;
203        operator short()                 const;
204        operator unsigned short()        const;
205        operator int()                   const;
206        operator unsigned int()          const;
207        operator long()                  const;
208        operator unsigned long()         const;
209        operator long long()             const;
210        operator unsigned long long()    const;
211        operator float()                 const;
212        operator double()                const;
213        operator long double()           const;
214        operator bool()                  const;
215        operator void*()                 const;
216        operator std::string()           const;
217        operator orxonox::Vector2()      const;
218        operator orxonox::Vector3()      const;
219        operator orxonox::Vector4()      const;
220        operator orxonox::ColourValue()  const;
221        operator orxonox::Quaternion()   const;
222        operator orxonox::Radian()       const;
223        operator orxonox::Degree()       const;
224        template <class T> operator T*() const { return ((T*)this->operator void*()); }
225
226        inline void getValue(char*                 value) const { if (this->value_) { (*value) = (*this->value_); } }
227        inline void getValue(unsigned char*        value) const { if (this->value_) { (*value) = (*this->value_); } }
228        inline void getValue(short*                value) const { if (this->value_) { (*value) = (*this->value_); } }
229        inline void getValue(unsigned short*       value) const { if (this->value_) { (*value) = (*this->value_); } }
230        inline void getValue(int*                  value) const { if (this->value_) { (*value) = (*this->value_); } }
231        inline void getValue(unsigned int*         value) const { if (this->value_) { (*value) = (*this->value_); } }
232        inline void getValue(long*                 value) const { if (this->value_) { (*value) = (*this->value_); } }
233        inline void getValue(unsigned long*        value) const { if (this->value_) { (*value) = (*this->value_); } }
234        inline void getValue(long long*            value) const { if (this->value_) { (*value) = (*this->value_); } }
235        inline void getValue(unsigned long long*   value) const { if (this->value_) { (*value) = (*this->value_); } }
236        inline void getValue(float*                value) const { if (this->value_) { (*value) = (*this->value_); } }
237        inline void getValue(double*               value) const { if (this->value_) { (*value) = (*this->value_); } }
238        inline void getValue(long double*          value) const { if (this->value_) { (*value) = (*this->value_); } }
239        inline void getValue(bool*                 value) const { if (this->value_) { (*value) = (*this->value_); } }
240        inline void getValue(void*                 value) const { if (this->value_) {   value  = (*this->value_); } }
241        inline void getValue(std::string*          value) const { if (this->value_) { (*value) = this->value_->operator std::string();          } }
242        inline void getValue(orxonox::Vector2*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector2();     } }
243        inline void getValue(orxonox::Vector3*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector3();     } }
244        inline void getValue(orxonox::Vector4*     value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Vector4();     } }
245        inline void getValue(orxonox::ColourValue* value) const { if (this->value_) { (*value) = this->value_->operator orxonox::ColourValue(); } }
246        inline void getValue(orxonox::Quaternion*  value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Quaternion();  } }
247        inline void getValue(orxonox::Radian*      value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Radian();      } }
248        inline void getValue(orxonox::Degree*      value) const { if (this->value_) { (*value) = this->value_->operator orxonox::Degree();      } }
249
250        inline MT_Type                    getType()            const { return this->type_; }
251        inline bool                       isType(MT_Type type) const { return (this->type_ == type); }
252        template <typename T> inline bool isType()             const { return false; }
253        std::string                       getTypename()        const;
254
255        inline std::string toString() const { return this->operator std::string(); }
256
257    private:
258        inline void assignValue(const char& value)                 { if (this->value_ && this->type_ == MT_char)        { this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 this->type_ = MT_char;        } }
259        inline void assignValue(const unsigned char& value)        { if (this->value_ && this->type_ == MT_uchar)       { this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        this->type_ = MT_uchar;       } }
260        inline void assignValue(const short& value)                { if (this->value_ && this->type_ == MT_short)       { this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                this->type_ = MT_short;       } }
261        inline void assignValue(const unsigned short& value)       { if (this->value_ && this->type_ == MT_ushort)      { this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       this->type_ = MT_ushort;      } }
262        inline void assignValue(const int& value)                  { if (this->value_ && this->type_ == MT_int)         { this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  this->type_ = MT_int;         } }
263        inline void assignValue(const unsigned int& value)         { if (this->value_ && this->type_ == MT_uint)        { this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         this->type_ = MT_uint;        } }
264        inline void assignValue(const long& value)                 { if (this->value_ && this->type_ == MT_long)        { this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 this->type_ = MT_long;        } }
265        inline void assignValue(const unsigned long& value)        { if (this->value_ && this->type_ == MT_ulong)       { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        this->type_ = MT_ulong;       } }
266        inline void assignValue(const long long& value)            { if (this->value_ && this->type_ == MT_longlong)    { this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            this->type_ = MT_longlong;    } }
267        inline void assignValue(const unsigned long long& value)   { if (this->value_ && this->type_ == MT_ulonglong)   { this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   this->type_ = MT_ulonglong;   } }
268        inline void assignValue(const float& value)                { if (this->value_ && this->type_ == MT_float)       { this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                this->type_ = MT_float;       } }
269        inline void assignValue(const double& value)               { if (this->value_ && this->type_ == MT_double)      { this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               this->type_ = MT_double;      } }
270        inline void assignValue(const long double& value)          { if (this->value_ && this->type_ == MT_longdouble)  { this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          this->type_ = MT_longdouble;  } }
271        inline void assignValue(const bool& value)                 { if (this->value_ && this->type_ == MT_bool)        { this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 this->type_ = MT_bool;        } }
272        inline void assignValue(      void* const& value)          { if (this->value_ && this->type_ == MT_void)        { this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                this->type_ = MT_void;        } }
273        inline void assignValue(const std::string& value)          { if (this->value_ && this->type_ == MT_string)      { this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          this->type_ = MT_string;      } }
274        inline void assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->type_ == MT_vector2)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     this->type_ = MT_vector2;     } }
275        inline void assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->type_ == MT_vector3)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     this->type_ = MT_vector3;     } }
276        inline void assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->type_ == MT_vector4)     { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     this->type_ = MT_vector4;     } }
277        inline void assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->type_ == MT_colourvalue) { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); this->type_ = MT_colourvalue; } }
278        inline void assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->type_ == MT_quaternion)  { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  this->type_ = MT_quaternion;  } }
279        inline void assignValue(const orxonox::Radian& value)      { if (this->value_ && this->type_ == MT_radian)      { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      this->type_ = MT_radian;      } }
280        inline void assignValue(const orxonox::Degree& value)      { if (this->value_ && this->type_ == MT_degree)      { this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      this->type_ = MT_degree;      } }
281        template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
282        template <typename T>        void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); }
283
284        MT_ValueBase* value_;
285        MT_Type type_;
286};
287
288_UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }
289
290template <> inline bool MultiType::isType<char>()                 const { return (this->type_ == MT_char);        }
291template <> inline bool MultiType::isType<unsigned char>()        const { return (this->type_ == MT_uchar);       }
292template <> inline bool MultiType::isType<short>()                const { return (this->type_ == MT_short);       }
293template <> inline bool MultiType::isType<unsigned short>()       const { return (this->type_ == MT_ushort);      }
294template <> inline bool MultiType::isType<int>()                  const { return (this->type_ == MT_int);         }
295template <> inline bool MultiType::isType<unsigned int>()         const { return (this->type_ == MT_uint);        }
296template <> inline bool MultiType::isType<long>()                 const { return (this->type_ == MT_long);        }
297template <> inline bool MultiType::isType<unsigned long>()        const { return (this->type_ == MT_ulong);       }
298template <> inline bool MultiType::isType<long long>()            const { return (this->type_ == MT_longlong);    }
299template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->type_ == MT_ulonglong);   }
300template <> inline bool MultiType::isType<float>()                const { return (this->type_ == MT_float);       }
301template <> inline bool MultiType::isType<double>()               const { return (this->type_ == MT_double);      }
302template <> inline bool MultiType::isType<long double>()          const { return (this->type_ == MT_longdouble);  }
303template <> inline bool MultiType::isType<bool>()                 const { return (this->type_ == MT_bool);        }
304template <> inline bool MultiType::isType<void*>()                const { return (this->type_ == MT_void);        }
305template <> inline bool MultiType::isType<std::string>()          const { return (this->type_ == MT_string);      }
306template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->type_ == MT_vector2);     }
307template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->type_ == MT_vector3);     }
308template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->type_ == MT_vector4);     }
309template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->type_ == MT_colourvalue); }
310template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->type_ == MT_quaternion);  }
311template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->type_ == MT_radian);      }
312template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->type_ == MT_degree);      }
313
314template <> inline void MultiType::convert<std::string>()          { this->setValue<std::string>         (this->operator std::string());          }
315template <> inline void MultiType::convert<orxonox::Vector2>()     { this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     }
316template <> inline void MultiType::convert<orxonox::Vector3>()     { this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     }
317template <> inline void MultiType::convert<orxonox::Vector4>()     { this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     }
318template <> inline void MultiType::convert<orxonox::ColourValue>() { this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); }
319template <> inline void MultiType::convert<orxonox::Quaternion>()  { this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  }
320template <> inline void MultiType::convert<orxonox::Radian>()      { this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      }
321template <> inline void MultiType::convert<orxonox::Degree>()      { this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      }
322
323template <> inline void MultiType::convert<const std::string&>()          { this->convert<std::string>();          }
324template <> inline void MultiType::convert<const orxonox::Vector2&>()     { this->convert<orxonox::Vector2>();     }
325template <> inline void MultiType::convert<const orxonox::Vector3&>()     { this->convert<orxonox::Vector3>();     }
326template <> inline void MultiType::convert<const orxonox::Vector4&>()     { this->convert<orxonox::Vector4>();     }
327template <> inline void MultiType::convert<const orxonox::ColourValue&>() { this->convert<orxonox::ColourValue>(); }
328template <> inline void MultiType::convert<const orxonox::Quaternion&>()  { this->convert<orxonox::Quaternion>();  }
329template <> inline void MultiType::convert<const orxonox::Radian&>()      { this->convert<orxonox::Radian>();      }
330template <> inline void MultiType::convert<const orxonox::Degree&>()      { this->convert<orxonox::Degree>();      }
331
332template <> void MultiType::createNewValueContainer(const char& value);
333template <> void MultiType::createNewValueContainer(const unsigned char& value);
334template <> void MultiType::createNewValueContainer(const short& value);
335template <> void MultiType::createNewValueContainer(const unsigned short& value);
336template <> void MultiType::createNewValueContainer(const int& value);
337template <> void MultiType::createNewValueContainer(const unsigned int& value);
338template <> void MultiType::createNewValueContainer(const long& value);
339template <> void MultiType::createNewValueContainer(const unsigned long& value);
340template <> void MultiType::createNewValueContainer(const long long& value);
341template <> void MultiType::createNewValueContainer(const unsigned long long& value);
342template <> void MultiType::createNewValueContainer(const float& value);
343template <> void MultiType::createNewValueContainer(const double& value);
344template <> void MultiType::createNewValueContainer(const bool& value);
345template <> void MultiType::createNewValueContainer(const long double& value);
346template <> void MultiType::createNewValueContainer(      void* const& value);
347template <> void MultiType::createNewValueContainer(const std::string& value);
348template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value);
349template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value);
350template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value);
351template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value);
352template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value);
353template <> void MultiType::createNewValueContainer(const orxonox::Radian& value);
354template <> void MultiType::createNewValueContainer(const orxonox::Degree& value);
355
356inline void MultiType::setValue(const char& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
357inline void MultiType::setValue(const unsigned char& value)         { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
358inline void MultiType::setValue(const short& value)                 { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
359inline void MultiType::setValue(const unsigned short& value)        { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
360inline void MultiType::setValue(const int& value)                   { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
361inline void MultiType::setValue(const unsigned int& value)          { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
362inline void MultiType::setValue(const long& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
363inline void MultiType::setValue(const unsigned long& value)         { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
364inline void MultiType::setValue(const long long& value)             { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
365inline void MultiType::setValue(const unsigned long long& value)    { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
366inline void MultiType::setValue(const float& value)                 { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
367inline void MultiType::setValue(const double& value)                { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
368inline void MultiType::setValue(const long double& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
369inline void MultiType::setValue(const bool& value)                  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
370inline void MultiType::setValue(const std::string& value)           { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
371inline void MultiType::setValue(const orxonox::Vector2& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
372inline void MultiType::setValue(const orxonox::Vector3& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
373inline void MultiType::setValue(const orxonox::Vector4& value)      { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
374inline void MultiType::setValue(const orxonox::ColourValue& value)  { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
375inline void MultiType::setValue(const orxonox::Quaternion& value)   { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
376inline void MultiType::setValue(const orxonox::Radian& value)       { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
377inline void MultiType::setValue(const orxonox::Degree& value)       { if (this->value_) { this->value_->setValue(value); } else { this->assignValue(value); } }
378inline void MultiType::setValue(const char* value) { if (this->value_) { this->value_->setValue(std::string(value)); } else { this->assignValue(std::string(value)); } }
379
380/*
381
382(*) = funktion 2x:
383function(...) : bezieht sich auf aktuellen type
384function<T>(...) : bezieht sich auf type T
385
386constructor(V value) : zuweisung
387(*) operator=(V value) : zuweisung
388(*) setValue(V value) : zuweisung
389
390(*) == != > < <= >= : template
391
392(*) reset() : zurück auf 0 (bzw "")
393setType<T>() : setzt type und macht reset
394convert<T>() : setzt type und konvertiert
395
396(T) : return konvertiert
397
398isType<T>() : return bool
399getType() : return MT_Type
400getTypename() : return string
401
402toString() : return string
403(*) fromString(string value) : konvertiert string
404operator<< : toString()
405
406*/
407
408#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
409#pragma warning(pop)
410#endif
411
412#endif /* _MultiType_H__ */
Note: See TracBrowser for help on using the repository browser.