Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5545 in orxonox.OLD for trunk/src/lib/util/multi_type.h


Ignore:
Timestamp:
Nov 11, 2005, 4:32:28 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: renaming of BaseLoadParam to LoadParamBase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/multi_type.h

    r5544 r5545  
    22 * @file multi_type.h
    33 * @brief Definition of ...
    4 */
     4 */
    55
    66#ifndef _MULTI_TYPE_H
     
    2929class MultiType {
    3030
    31  public:
    32    MultiType();
    33    MultiType(bool value);
    34    MultiType(int value);
    35    MultiType(double value);
    36    MultiType(char value);
    37    MultiType(const char* value);
    38    virtual ~MultiType();
    39    void init();
     31  public:
     32    MultiType();
     33    MultiType(bool value);
     34    MultiType(int value);
     35    MultiType(double value);
     36    MultiType(char value);
     37    MultiType(const char* value);
     38    virtual ~MultiType();
    4039
    41    MultiType operator= (const MultiType& mt);
     40    MultiType operator= (const MultiType& mt);
    4241
    43    void setType(MT_Type);
     42    void setType(MT_Type);
    4443
    45    void setBool(bool value);
    46    void setInt(int value);
    47    void setFloat(float value);
    48    void setChar(char value);
    49    void setString(const char* value);
     44    void setBool(bool value);
     45    void setInt(int value);
     46    void setFloat(float value);
     47    void setChar(char value);
     48    void setString(const char* value);
    5049
    51    inline void setValue(bool value) { this->setBool(value); };
    52    inline void setValue(int value) { this->setInt(value); };
    53    inline void setValue(float value) { this->setFloat(value); };
    54    inline void setValue(char value) { this->setChar(value); };
    55    inline void setValue(const char* value) { this->setString(value); };
     50    inline void setValue(bool value) { this->setBool(value); };
     51    inline void setValue(int value) { this->setInt(value); };
     52    inline void setValue(float value) { this->setFloat(value); };
     53    inline void setValue(char value) { this->setChar(value); };
     54    inline void setValue(const char* value) { this->setString(value); };
    5655
    57   /** @returns the Type of the Value stored in this MultiType */
    58   inline MT_Type getType() const { return this->type; };
     56    /** @returns the Type of the Value stored in this MultiType */
     57    inline MT_Type getType() const { return this->type; };
    5958
    60   bool getBool() const;
    61   int getInt() const;
    62   float getFloat() const;
    63   char getChar() const;
    64   const char* getString();
     59    bool getBool() const;
     60    int getInt() const;
     61    float getFloat() const;
     62    char getChar() const;
     63    const char* getString();
    6564
    6665
    67   void debug();
     66    void debug();
    6867
    69   static const char* MultiTypeToString(MT_Type type);
    70   static MT_Type StringToMultiType(const char* type);
     68    static const char* MultiTypeToString(MT_Type type);
     69    static MT_Type StringToMultiType(const char* type);
    7170
    72  private:
    73    MT_Type             type;
    74    union Type
    75    {
    76      bool              Bool;
    77      int               Int;
    78      float             Float;
    79      char              Char;
    80      char*             String;
     71  private:
     72    void init();
    8173
    82    }                   value;
    8374
    84    char*               storedString;
     75  private:
     76    MT_Type             type;
     77    union Type
     78    {
     79      bool              Bool;
     80      int               Int;
     81      float             Float;
     82      char              Char;
     83      char*             String;
     84
     85    }                   value;
     86
     87    char*               storedString;
    8588};
    8689
Note: See TracChangeset for help on using the changeset viewer.