Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2008, 6:38:09 PM (16 years ago)
Author:
landauf
Message:

sync with notebook, there are some changes in the MultiTypes, XMLPort and the WorldEntity, but there's still a bug in some of the Converter-specializations

Location:
code/branches/core/src/util
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/util/Convert.h

    r848 r853  
    397397    bool operator()(orxonox::Vector2* output, const std::string& input) const
    398398    {
    399       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     399      SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    400400
    401401      if (tokens.size() >= 2)
     
    420420    bool operator()(orxonox::Vector3* output, const std::string& input) const
    421421    {
    422       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     422      SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    423423
    424424      if (tokens.size() >= 3)
     
    445445    bool operator()(orxonox::Vector4* output, const std::string& input) const
    446446    {
    447       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     447      SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    448448
    449449      if (tokens.size() >= 4)
     
    472472    bool operator()(orxonox::Quaternion* output, const std::string& input) const
    473473    {
    474       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     474      SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    475475
    476476      if (tokens.size() >= 4)
     
    499499    bool operator()(orxonox::ColourValue* output, const std::string& input) const
    500500    {
    501       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
     501      SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    502502
    503503      if (tokens.size() >= 4)
  • code/branches/core/src/util/MultiTypeMath.cc

    r848 r853  
    4444    else if (type == MT_degree)
    4545        this->degree_ = orxonox::Degree(0);
    46 }
    47 
    48 MultiTypeMath::MultiTypeMath(const MultiTypeMath& mtm) : MultiTypeString(mtm)
    49 {
    50     this->type_ = mtm.type_;
    51     this->value_ = mtm.value_;
    52 }
    53 
    54 MultiTypeMath& MultiTypeMath::operator=(const MultiTypeMath& mtm)
    55 {
    56     this->type_ = mtm.type_;
    57     this->value_ = mtm.value_;
    58     return *this;
    5946}
    6047
     
    10390MultiTypeMath::operator orxonox::Vector2() const
    10491{
    105     return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector2>(*this);
     92    return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector2>(*this);
    10693}
    10794
    10895MultiTypeMath::operator orxonox::Vector3() const
    10996{
    110     return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector3>(*this);
     97std::cout << "4_2: Convert MultiTypeMath to Vector3:" << std::endl;
     98std::cout << "     MultiTypeMath has type " << this->getType() << std::endl;
     99std::cout << MT_vector3 << std::endl;
     100std::cout << MT_string << std::endl;
     101std::cout << MT_vector2 << std::endl;
     102std::cout << MT_int << std::endl;
     103std::cout << MT_uint << std::endl;
     104std::cout << MT_null << std::endl;
     105if (this->type_ == MT_vector3)
     106{
     107    std::cout << "     MultiTypeMath contains already a Vector3" << std::endl;
     108    std::cout << "     Returnvalue is " << this->vector3_ << std::endl;
     109}
     110else
     111{
     112    std::cout << "     MultiTypeMath doesn't contain a Vector3" << std::endl;
     113    std::cout << "     Returnvalue is " << ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this) << std::endl;
     114    std::cout << "     Returnvalue was " << ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector3>(*this) << std::endl;
     115}
     116    return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this);
    111117}
    112118
    113119MultiTypeMath::operator orxonox::Quaternion() const
    114120{
    115     return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Quaternion>(*this);
     121    return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Quaternion>(*this);
    116122}
    117123
    118124MultiTypeMath::operator orxonox::ColourValue() const
    119125{
    120     return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::ColourValue>(*this);
     126    return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiTypeMath, orxonox::ColourValue>(*this);
    121127}
    122128
    123129MultiTypeMath::operator orxonox::Radian() const
    124130{
    125     return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Radian>(*this);
     131    return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Radian>(*this);
    126132}
    127133
    128134MultiTypeMath::operator orxonox::Degree() const
    129135{
    130     return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Degree>(*this);
     136    return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Degree>(*this);
    131137}
    132138
    133139void MultiTypeMath::setValue(const MultiTypeMath& mtm)
    134140{
    135     this->type_ = mtm.type_;
    136     this->value_ = mtm.value_;
     141    std::cout << "4_3: setValue in MultiTypeMath with other Multitype as parameter: " << mtm << std::endl;
     142
     143    MultiTypeString::setValue(mtm);
     144    this->vector2_ = mtm.vector2_;
     145    this->vector3_ = mtm.vector3_;
     146    this->quaternion_ = mtm.quaternion_;
     147    this->colourvalue_ = mtm.colourvalue_;
     148    this->radian_ = mtm.radian_;
     149    this->degree_ = mtm.degree_;
    137150}
    138151
  • code/branches/core/src/util/MultiTypeMath.h

    r848 r853  
    5959        inline MultiTypeMath(const orxonox::Radian&      value) { this->setValue(value); }
    6060        inline MultiTypeMath(const orxonox::Degree&      value) { this->setValue(value); }
    61         MultiTypeMath(const MultiTypeMath& mtm);
     61        inline MultiTypeMath(const MultiTypeMath& mtm)          { this->setValue(mtm);   }
    6262
    6363        using MultiTypeString::operator=;
     
    6868        inline MultiTypeMath& operator=(const orxonox::Radian&      value) { this->setValue(value); return *this; }
    6969        inline MultiTypeMath& operator=(const orxonox::Degree&      value) { this->setValue(value); return *this; }
    70         MultiTypeMath& operator=(const MultiTypeMath& mtm);
     70        inline MultiTypeMath& operator=(const MultiTypeMath& mtm)          { this->setValue(mtm);   return *this; }
    7171
    7272        using MultiTypeString::operator==;
     
    9797        using MultiTypeString::setValue;
    9898        inline void setValue(const orxonox::Vector2&     value) { this->type_ = MT_vector2;     this->vector2_     = value; }
    99         inline void setValue(const orxonox::Vector3&     value) { this->type_ = MT_vector3;     this->vector3_     = value; }
     99        inline void setValue(const orxonox::Vector3&     value) { std::cout << "4_4: setValue Vector3: " << value << std::endl; this->type_ = MT_vector3;     this->vector3_     = value; }
    100100        inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; }
    101101        inline void setValue(const orxonox::Quaternion&  value) { this->type_ = MT_quaternion;  this->quaternion_  = value; }
  • code/branches/core/src/util/MultiTypePrimitive.cc

    r848 r853  
    3232MultiTypePrimitive::MultiTypePrimitive(MultiType type)
    3333{
     34std::cout << "4_5: Created MultiTypePrimitive with type " << type << std::endl;
    3435    this->type_ = type;
    3536
     
    6061    else
    6162        this->value_.int_ = 0;
    62 }
    63 
    64 MultiTypePrimitive::MultiTypePrimitive(const MultiTypePrimitive& mtp)
    65 {
    66     this->type_ = mtp.type_;
    67     this->value_ = mtp.value_;
    68 }
    69 
    70 MultiTypePrimitive& MultiTypePrimitive::operator=(const MultiTypePrimitive& mtp)
    71 {
    72     this->type_ = mtp.type_;
    73     this->value_ = mtp.value_;
    74     return *this;
    7563}
    7664
     
    203191void MultiTypePrimitive::setValue(const MultiTypePrimitive& mtp)
    204192{
     193    std::cout << "4_3: setValue in MultiTypePrimitive with other Multitype as parameter: " << mtp << std::endl;
    205194    this->type_ = mtp.type_;
    206195    this->value_ = mtp.value_;
  • code/branches/core/src/util/MultiTypePrimitive.h

    r848 r853  
    5252        inline MultiTypePrimitive(long double    value) { this->setValue(value); }
    5353        inline MultiTypePrimitive(bool           value) { this->setValue(value); }
    54         MultiTypePrimitive(const MultiTypePrimitive& mtp);
     54        inline MultiTypePrimitive(const MultiTypePrimitive& mtp) { this->setValue(mtp); }
    5555
    5656        inline MultiTypePrimitive& operator=(MultiType      value) { this->type_ = MT_null; return *this; }
     
    6767        inline MultiTypePrimitive& operator=(long double    value) { this->setValue(value); return *this; }
    6868        inline MultiTypePrimitive& operator=(bool           value) { this->setValue(value); return *this; }
    69         MultiTypePrimitive& operator=(const MultiTypePrimitive& mtp);
     69        inline MultiTypePrimitive& operator=(const MultiTypePrimitive& mtp) { this->setValue(mtp); return *this; }
    7070
    7171        inline bool operator==(int            value) const { return (this->value_.int_        == value); }
  • code/branches/core/src/util/MultiTypeString.cc

    r848 r853  
    3838}
    3939
    40 MultiTypeString::MultiTypeString(const MultiTypeString& mts) : MultiTypePrimitive(mts)
    41 {
    42     this->type_ = mts.type_;
    43     this->value_ = mts.value_;
    44 }
    45 
    46 MultiTypeString& MultiTypeString::operator=(const MultiTypeString& mts)
    47 {
    48     this->type_ = mts.type_;
    49     this->value_ = mts.value_;
    50     return *this;
    51 }
    52 
    5340bool MultiTypeString::operator==(const MultiTypeString& mts) const
    5441{
     
    7966MultiTypeString::operator std::string() const
    8067{
    81     return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypePrimitive, std::string>(*this);
     68    return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this);
    8269}
    8370
    8471MultiTypeString::operator const char*() const
    8572{
    86     return (this->type_ == MT_constchar) ? this->string_.c_str() : ConvertValueAndReturn<MultiTypePrimitive, const char*>(*this);
     73    return ((this->type_ == MT_constchar) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this)).c_str();
    8774}
    8875
    8976void MultiTypeString::setValue(const MultiTypeString& mts)
    9077{
    91     this->type_ = mts.type_;
    92     this->value_ = mts.value_;
     78    MultiTypePrimitive::setValue(mts);
     79    this->string_ = mts.string_;
    9380}
    9481
  • code/branches/core/src/util/MultiTypeString.h

    r848 r853  
    3131
    3232#include <string>
    33 
     33#include <iostream>
    3434#include "UtilPrereqs.h"
    3535
     
    5252        inline MultiTypeString(long double    value) : MultiTypePrimitive(value) {}
    5353        inline MultiTypeString(bool           value) : MultiTypePrimitive(value) {}
    54         inline MultiTypeString(const char*        value) { this->setValue(value); }
    55         inline MultiTypeString(const std::string& value) { this->setValue(value); }
    56         MultiTypeString(const MultiTypeString& mtp);
     54        inline MultiTypeString(const char*        value)   { this->setValue(value); }
     55        inline MultiTypeString(const std::string& value)   { this->setValue(value); std::cout << "4_1: Created MultiTypeString with value " << value << " and type " << this->getType() << std::endl; }
     56        inline MultiTypeString(const MultiTypeString& mts) { this->setValue(mts);   }
    5757
    5858        using MultiTypePrimitive::operator=;
    59         inline MultiTypeString& operator=(const char*        value) { this->setValue(value); return *this; }
    60         inline MultiTypeString& operator=(const std::string& value) { this->setValue(value); return *this; }
    61         MultiTypeString& operator=(const MultiTypeString& mtp);
     59        inline MultiTypeString& operator=(const char*        value)   { this->setValue(value); return *this; }
     60        inline MultiTypeString& operator=(const std::string& value)   { this->setValue(value); return *this; }
     61        inline MultiTypeString& operator=(const MultiTypeString& mts) { this->setValue(mts);   return *this; }
    6262
    6363        using MultiTypePrimitive::operator==;
    6464        inline bool operator==(const char*        value) const { return (this->string_ == std::string(value)); }
    6565        inline bool operator==(const std::string& value) const { return (this->string_ == value);              }
    66         bool operator==(const MultiTypeString& mtp) const;
     66        bool operator==(const MultiTypeString& mts) const;
    6767
    6868        using MultiTypePrimitive::operator!=;
    6969        inline bool operator!=(const char*        value) const { return (this->string_ != std::string(value)); }
    7070        inline bool operator!=(const std::string& value) const { return (this->string_ != value);              }
    71         bool operator!=(const MultiTypeString& mtp) const;
     71        bool operator!=(const MultiTypeString& mts) const;
    7272
    7373        operator std::string() const;
     
    7777        inline void setValue(const char*        value) { this->type_ = MT_string; this->string_ = std::string(value); }
    7878        inline void setValue(const std::string& value) { this->type_ = MT_string; this->string_ = value;              }
    79         void setValue(const MultiTypeString& mtp);
     79        void setValue(const MultiTypeString& mts);
    8080
    8181        inline const std::string getString() const { return this->string_;         }
Note: See TracChangeset for help on using the changeset viewer.