Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2007, 3:55:33 AM (16 years ago)
Author:
landauf
Message:

used a union to save some memory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/core/ConfigValueContainer.h

    r450 r451  
    6363
    6464            /** @returns the value of the type int. @param value This is only needed to determine the right type. */
    65             inline int getValue(int value)                                      { return this->value_int_; }
     65            inline int getValue(int value)                                      { return this->value_.value_int_; }
    6666            /** @returns the value of the type double. @param value This is only needed to determine the right type. */
    67             inline double getValue(double value)                                { return this->value_double_; }
     67            inline double getValue(double value)                                { return this->value_.value_double_; }
    6868            /** @returns the value of the type bool. @param value This is only needed to determine the right type. */
    69             inline bool getValue(bool value)                                    { return this->value_bool_; }
     69            inline bool getValue(bool value)                                    { return this->value_.value_bool_; }
    7070            /** @returns the value of the type std::string. @param value This is only needed to determine the right type. */
    7171            inline std::string getValue(const std::string& value)               { return this->value_string_; }
     
    8282            std::string         defvalue_;                      //!< The string of the default-variable
    8383
    84             int                 value_int_;                     //!< The value, if the variable is of the type int
    85             double              value_double_;                  //!< The value, if the variable is of the type double
    86             bool                value_bool_;                    //!< The value, if the variable is of the type bool
     84            union MultiType
     85            {
     86                int                 value_int_;                 //!< The value, if the variable is of the type int
     87                double              value_double_;              //!< The value, if the variable is of the type double
     88                bool                value_bool_;                //!< The value, if the variable is of the type bool
     89            } value_;
     90
    8791            std::string         value_string_;                  //!< The value, if the variable is of the type string
    8892            Ogre::Vector2       value_vector2_;                 //!< The value, if the variable is of the type Vector2
Note: See TracChangeset for help on using the changeset viewer.