Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 16, 2008, 3:46:25 AM (17 years ago)
Author:
landauf
Message:

added comments to all my classes in util

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/util/MultiTypeValue.h

    r1747 r1791  
    2727 */
    2828
     29/**
     30    @file MultiTypeValue.h
     31    @brief Declaration and Implementation of the MT_Value<T> class.
     32
     33    The MT_Value<T> class is used to hold a value of type T within a MultiType.
     34*/
     35
    2936#ifndef _MultiTypeValue_H__
    3037#define _MultiTypeValue_H__
     
    3441#include "MultiType.h"
    3542
     43/**
     44    @brief The MT_Value<T> class is used to hold a value of type T within a MultiType.
     45*/
    3646template <typename T>
    3747struct MT_Value : public MultiType::MT_ValueBase
    3848{
     49    /** @brief Constructor: Assigns the value and the type identifier. */
    3950    MT_Value(const T& value, MT_Type type) : MT_ValueBase(type), value_(value) {}
    4051
     52    /** @brief Creates a copy of itself. */
    4153    inline MT_ValueBase* clone() const { return new MT_Value<T>(this->value_, this->type_); }
     54
     55    /** @brief Resets the current value to the default. */
    4256    inline void reset() { this->value_ = T(); }
     57
     58    /** @brief Assigns the value of the other MultiType, converted to T. @param other The other MultiType */
    4359    inline void assimilate(const MultiType& other) { if (other.value_) { T temp; other.getValue(&temp); this->value_ = temp; } else { this->value_ = T(); } }
    4460
    45     inline void setValue(const char& value)                 { this->value_ = getConvertedValue<char,                 T>(value); }
    46     inline void setValue(const unsigned char& value)        { this->value_ = getConvertedValue<unsigned char,        T>(value); }
    47     inline void setValue(const short& value)                { this->value_ = getConvertedValue<short,                T>(value); }
    48     inline void setValue(const unsigned short& value)       { this->value_ = getConvertedValue<unsigned short,       T>(value); }
    49     inline void setValue(const int& value)                  { this->value_ = getConvertedValue<int,                  T>(value); }
    50     inline void setValue(const unsigned int& value)         { this->value_ = getConvertedValue<unsigned int,         T>(value); }
    51     inline void setValue(const long& value)                 { this->value_ = getConvertedValue<long,                 T>(value); }
    52     inline void setValue(const unsigned long& value)        { this->value_ = getConvertedValue<unsigned long,        T>(value); }
    53     inline void setValue(const long long& value)            { this->value_ = getConvertedValue<long long,            T>(value); }
    54     inline void setValue(const unsigned long long& value)   { this->value_ = getConvertedValue<unsigned long long,   T>(value); }
    55     inline void setValue(const float& value)                { this->value_ = getConvertedValue<float,                T>(value); }
    56     inline void setValue(const double& value)               { this->value_ = getConvertedValue<double,               T>(value); }
    57     inline void setValue(const long double& value)          { this->value_ = getConvertedValue<long double,          T>(value); }
    58     inline void setValue(const bool& value)                 { this->value_ = getConvertedValue<bool,                 T>(value); }
    59     inline void setValue(      void* const& value)          { this->value_ = getConvertedValue<void*,                T>(value); }
    60     inline void setValue(const std::string& value)          { this->value_ = getConvertedValue<std::string,          T>(value); }
    61     inline void setValue(const orxonox::Vector2& value)     { this->value_ = getConvertedValue<orxonox::Vector2,     T>(value); }
    62     inline void setValue(const orxonox::Vector3& value)     { this->value_ = getConvertedValue<orxonox::Vector3,     T>(value); }
    63     inline void setValue(const orxonox::Vector4& value)     { this->value_ = getConvertedValue<orxonox::Vector4,     T>(value); }
    64     inline void setValue(const orxonox::ColourValue& value) { this->value_ = getConvertedValue<orxonox::ColourValue, T>(value); }
    65     inline void setValue(const orxonox::Quaternion& value)  { this->value_ = getConvertedValue<orxonox::Quaternion,  T>(value); }
    66     inline void setValue(const orxonox::Radian& value)      { this->value_ = getConvertedValue<orxonox::Radian,      T>(value); }
    67     inline void setValue(const orxonox::Degree& value)      { this->value_ = getConvertedValue<orxonox::Degree,      T>(value); }
     61    inline void setValue(const char& value)                 { this->value_ = getConvertedValue<char,                 T>(value); } /** @brief Assigns the value by converting it to T. */
     62    inline void setValue(const unsigned char& value)        { this->value_ = getConvertedValue<unsigned char,        T>(value); } /** @brief Assigns the value by converting it to T. */
     63    inline void setValue(const short& value)                { this->value_ = getConvertedValue<short,                T>(value); } /** @brief Assigns the value by converting it to T. */
     64    inline void setValue(const unsigned short& value)       { this->value_ = getConvertedValue<unsigned short,       T>(value); } /** @brief Assigns the value by converting it to T. */
     65    inline void setValue(const int& value)                  { this->value_ = getConvertedValue<int,                  T>(value); } /** @brief Assigns the value by converting it to T. */
     66    inline void setValue(const unsigned int& value)         { this->value_ = getConvertedValue<unsigned int,         T>(value); } /** @brief Assigns the value by converting it to T. */
     67    inline void setValue(const long& value)                 { this->value_ = getConvertedValue<long,                 T>(value); } /** @brief Assigns the value by converting it to T. */
     68    inline void setValue(const unsigned long& value)        { this->value_ = getConvertedValue<unsigned long,        T>(value); } /** @brief Assigns the value by converting it to T. */
     69    inline void setValue(const long long& value)            { this->value_ = getConvertedValue<long long,            T>(value); } /** @brief Assigns the value by converting it to T. */
     70    inline void setValue(const unsigned long long& value)   { this->value_ = getConvertedValue<unsigned long long,   T>(value); } /** @brief Assigns the value by converting it to T. */
     71    inline void setValue(const float& value)                { this->value_ = getConvertedValue<float,                T>(value); } /** @brief Assigns the value by converting it to T. */
     72    inline void setValue(const double& value)               { this->value_ = getConvertedValue<double,               T>(value); } /** @brief Assigns the value by converting it to T. */
     73    inline void setValue(const long double& value)          { this->value_ = getConvertedValue<long double,          T>(value); } /** @brief Assigns the value by converting it to T. */
     74    inline void setValue(const bool& value)                 { this->value_ = getConvertedValue<bool,                 T>(value); } /** @brief Assigns the value by converting it to T. */
     75    inline void setValue(      void* const& value)          { this->value_ = getConvertedValue<void*,                T>(value); } /** @brief Assigns the value by converting it to T. */
     76    inline void setValue(const std::string& value)          { this->value_ = getConvertedValue<std::string,          T>(value); } /** @brief Assigns the value by converting it to T. */
     77    inline void setValue(const orxonox::Vector2& value)     { this->value_ = getConvertedValue<orxonox::Vector2,     T>(value); } /** @brief Assigns the value by converting it to T. */
     78    inline void setValue(const orxonox::Vector3& value)     { this->value_ = getConvertedValue<orxonox::Vector3,     T>(value); } /** @brief Assigns the value by converting it to T. */
     79    inline void setValue(const orxonox::Vector4& value)     { this->value_ = getConvertedValue<orxonox::Vector4,     T>(value); } /** @brief Assigns the value by converting it to T. */
     80    inline void setValue(const orxonox::ColourValue& value) { this->value_ = getConvertedValue<orxonox::ColourValue, T>(value); } /** @brief Assigns the value by converting it to T. */
     81    inline void setValue(const orxonox::Quaternion& value)  { this->value_ = getConvertedValue<orxonox::Quaternion,  T>(value); } /** @brief Assigns the value by converting it to T. */
     82    inline void setValue(const orxonox::Radian& value)      { this->value_ = getConvertedValue<orxonox::Radian,      T>(value); } /** @brief Assigns the value by converting it to T. */
     83    inline void setValue(const orxonox::Degree& value)      { this->value_ = getConvertedValue<orxonox::Degree,      T>(value); } /** @brief Assigns the value by converting it to T. */
    6884
    69     inline operator char()                 const { return getConvertedValue<T, char>                (this->value_, 0); }
    70     inline operator unsigned char()        const { return getConvertedValue<T, unsigned char>       (this->value_, 0); }
    71     inline operator short()                const { return getConvertedValue<T, short>               (this->value_, 0); }
    72     inline operator unsigned short()       const { return getConvertedValue<T, unsigned short>      (this->value_, 0); }
    73     inline operator int()                  const { return getConvertedValue<T, int>                 (this->value_, 0); }
    74     inline operator unsigned int()         const { return getConvertedValue<T, unsigned int>        (this->value_, 0); }
    75     inline operator long()                 const { return getConvertedValue<T, long>                (this->value_, 0); }
    76     inline operator unsigned long()        const { return getConvertedValue<T, unsigned long>       (this->value_, 0); }
    77     inline operator long long()            const { return getConvertedValue<T, long long>           (this->value_, 0); }
    78     inline operator unsigned long long()   const { return getConvertedValue<T, unsigned long long>  (this->value_, 0); }
    79     inline operator float()                const { return getConvertedValue<T, float>               (this->value_, 0); }
    80     inline operator double()               const { return getConvertedValue<T, double>              (this->value_, 0); }
    81     inline operator long double()          const { return getConvertedValue<T, long double>         (this->value_, 0); }
    82     inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, false); }
    83     inline operator void*()                const { return getConvertedValue<T, void*>               (this->value_, 0); }
    84     inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_); }
    85     inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_); }
    86     inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_); }
    87     inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_); }
    88     inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_); }
    89     inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_); }
    90     inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_); }
    91     inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_); }
     85    inline operator char()                 const { return getConvertedValue<T, char>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     86    inline operator unsigned char()        const { return getConvertedValue<T, unsigned char>       (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     87    inline operator short()                const { return getConvertedValue<T, short>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     88    inline operator unsigned short()       const { return getConvertedValue<T, unsigned short>      (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     89    inline operator int()                  const { return getConvertedValue<T, int>                 (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     90    inline operator unsigned int()         const { return getConvertedValue<T, unsigned int>        (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     91    inline operator long()                 const { return getConvertedValue<T, long>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     92    inline operator unsigned long()        const { return getConvertedValue<T, unsigned long>       (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     93    inline operator long long()            const { return getConvertedValue<T, long long>           (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     94    inline operator unsigned long long()   const { return getConvertedValue<T, unsigned long long>  (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     95    inline operator float()                const { return getConvertedValue<T, float>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     96    inline operator double()               const { return getConvertedValue<T, double>              (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     97    inline operator long double()          const { return getConvertedValue<T, long double>         (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     98    inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, false); } /** @brief Returns the current value, converted to the requested type. */
     99    inline operator void*()                const { return getConvertedValue<T, void*>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
     100    inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     101    inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     102    inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     103    inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     104    inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     105    inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     106    inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
     107    inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_); }        /** @brief Returns the current value, converted to the requested type. */
    92108
     109    /** @brief Puts the current value on the stream */
    93110    inline void toString(std::ostream& outstream) const { outstream << this->value_; }
    94111
    95     T value_;
     112    T value_; //! The stored value
    96113};
    97114
Note: See TracChangeset for help on using the changeset viewer.