Changeset 853 for code/branches/core/src
- Timestamp:
- Mar 5, 2008, 6:38:09 PM (17 years ago)
- Location:
- code/branches/core/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/core/BaseObject.cc
r852 r853 79 79 Element& BaseObject::XMLPort(Element& xmlelement, bool loading) 80 80 { 81 std::cout << "1_1: " << this->getName() << std::endl; 81 82 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading); 82 83 std::cout << "1_2: " << this->getName() << std::endl; 83 84 return xmlelement; 84 85 } -
code/branches/core/src/orxonox/core/XMLPort.h
r850 r853 48 48 xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading) 49 49 50 #define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, loading) \ 51 orxonox::XMLPortClassParamContainer<classname>* xmlcontainer##loadfunction##savefunction = (orxonox::XMLPortClassParamContainer<classname>*)(this->getIdentifier()->getXMLPortParamContainer(paramname)); \ 52 if (!xmlcontainer##loadfunction##savefunction) \ 53 { \ 54 xmlcontainer##loadfunction##savefunction = new orxonox::XMLPortClassParamContainer<classname>(this->getIdentifier()->getName(), std::string(paramname), createFunctor(&classname::loadfunction), 0); \ 55 this->getIdentifier()->addXMLPortParamContainer(paramname, xmlcontainer##loadfunction##savefunction); \ 56 } \ 57 xmlcontainer##loadfunction##savefunction->port(this, xmlelement, loading) 50 58 51 59 namespace orxonox … … 100 108 if (loading) 101 109 { 110 std::cout << "3_1: load param " << this->paramname_ << std::endl; 102 111 std::string attribute = xmlelement.GetAttribute(this->paramname_); 112 std::cout << "3_2: attribute " << attribute << std::endl; 103 113 if (attribute.size() > 0) 104 114 { 105 115 SubString tokens(attribute, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 116 std::cout << "3_3: tokens: " << tokens.size() << " params: " << this->loadfunction_->getParamCount() << std::endl; 106 117 if ((unsigned int)tokens.size() >= (unsigned int)this->loadfunction_->getParamCount()) 107 118 { 108 MultiTypeMath param1, param2, param3, param4, param5; 109 if (tokens.size() >= 1) param1 = tokens[0]; 110 if (tokens.size() >= 2) param1 = tokens[1]; 111 if (tokens.size() >= 3) param1 = tokens[2]; 112 if (tokens.size() >= 4) param1 = tokens[3]; 113 if (tokens.size() >= 5) param1 = tokens[4]; 119 if (this->loadfunction_->getParamCount() == 1) 120 { 121 std::cout << "3_4 start: load with whole attribute as input" << std::endl; 122 (*this->loadfunction_)(object, MultiTypeMath(attribute)); 123 std::cout << "3_5 end" << std::endl; 124 } 125 else 126 { 127 std::cout << "3_4: load with tokens as input" << std::endl; 128 MultiTypeMath param1, param2, param3, param4, param5; 129 if (tokens.size() >= 1) param1 = tokens[0]; 130 if (tokens.size() >= 2) param1 = tokens[1]; 131 if (tokens.size() >= 3) param1 = tokens[2]; 132 if (tokens.size() >= 4) param1 = tokens[3]; 133 if (tokens.size() >= 5) param1 = tokens[4]; 114 134 115 (*this->loadfunction_)(object, param1, param2, param3, param4, param5); 135 (*this->loadfunction_)(object, param1, param2, param3, param4, param5); 136 } 116 137 } 117 138 else … … 123 144 else 124 145 { 125 // xmlelement.SetAttribute(this->paramname_, "..."); 146 if (this->savefunction_) 147 { 148 // xmlelement.SetAttribute(this->paramname_, "..."); 149 } 126 150 } 127 151 -
code/branches/core/src/orxonox/objects/WorldEntity.cc
r850 r853 172 172 XMLPortParam(WorldEntity, "position", setPosition, getPosition, xmlelement, loading); 173 173 // XMLPortParam(WorldEntity, "direction", setDirection, getDirection, xmlelement, loading); 174 // XMLPortParam(WorldEntity, "yaw", yaw, getYaw, xmlelement, loading);175 // XMLPortParam(WorldEntity, "pitch", pitch, getPitch, xmlelement, loading);176 // XMLPortParam(WorldEntity, "roll", roll, getRoll, xmlelement, loading);177 XMLPortParam(WorldEntity, "scale", set Scale, getScale, xmlelement, loading);174 XMLPortParamLoadOnly(WorldEntity, "yaw", setYaw, xmlelement, loading); 175 XMLPortParamLoadOnly(WorldEntity, "pitch", setPitch, xmlelement, loading); 176 XMLPortParamLoadOnly(WorldEntity, "roll", setRoll, xmlelement, loading); 177 XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, loading); 178 178 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxis, getRotationAxis, xmlelement, loading); 179 179 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading); -
code/branches/core/src/orxonox/objects/WorldEntity.h
r852 r853 57 57 { this->node_->roll(angle, relativeTo); } 58 58 59 inline void setYaw(const Degree &angle) 60 { this->node_->yaw(angle, Ogre::Node::TS_LOCAL); } 61 inline void setPitch(const Degree &angle) 62 { this->node_->pitch(angle, Ogre::Node::TS_LOCAL); } 63 inline void setRoll(const Degree &angle) 64 { this->node_->roll(angle, Ogre::Node::TS_LOCAL); } 65 59 66 inline const Ogre::Quaternion& getOrientation() 60 67 { return this->node_->getOrientation(); } … … 75 82 { this->node_->setScale(x, y, z); } 76 83 inline void setScale(Real scale) 84 { this->node_->setScale(scale, scale, scale); } 85 inline void setTotalScale(Real scale) 77 86 { this->node_->setScale(scale, scale, scale); } 78 87 inline const Vector3& getScale(void) const -
code/branches/core/src/util/Convert.h
r848 r853 397 397 bool operator()(orxonox::Vector2* output, const std::string& input) const 398 398 { 399 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');399 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 400 400 401 401 if (tokens.size() >= 2) … … 420 420 bool operator()(orxonox::Vector3* output, const std::string& input) const 421 421 { 422 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');422 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 423 423 424 424 if (tokens.size() >= 3) … … 445 445 bool operator()(orxonox::Vector4* output, const std::string& input) const 446 446 { 447 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');447 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 448 448 449 449 if (tokens.size() >= 4) … … 472 472 bool operator()(orxonox::Quaternion* output, const std::string& input) const 473 473 { 474 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');474 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 475 475 476 476 if (tokens.size() >= 4) … … 499 499 bool operator()(orxonox::ColourValue* output, const std::string& input) const 500 500 { 501 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', ' (', ')', '\0');501 SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0'); 502 502 503 503 if (tokens.size() >= 4) -
code/branches/core/src/util/MultiTypeMath.cc
r848 r853 44 44 else if (type == MT_degree) 45 45 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;59 46 } 60 47 … … 103 90 MultiTypeMath::operator orxonox::Vector2() const 104 91 { 105 return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Vector2>(*this);92 return (this->type_ == MT_vector2) ? this->vector2_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector2>(*this); 106 93 } 107 94 108 95 MultiTypeMath::operator orxonox::Vector3() const 109 96 { 110 return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector3>(*this); 97 std::cout << "4_2: Convert MultiTypeMath to Vector3:" << std::endl; 98 std::cout << " MultiTypeMath has type " << this->getType() << std::endl; 99 std::cout << MT_vector3 << std::endl; 100 std::cout << MT_string << std::endl; 101 std::cout << MT_vector2 << std::endl; 102 std::cout << MT_int << std::endl; 103 std::cout << MT_uint << std::endl; 104 std::cout << MT_null << std::endl; 105 if (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 } 110 else 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); 111 117 } 112 118 113 119 MultiTypeMath::operator orxonox::Quaternion() const 114 120 { 115 return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Quaternion>(*this);121 return (this->type_ == MT_quaternion) ? this->quaternion_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Quaternion>(*this); 116 122 } 117 123 118 124 MultiTypeMath::operator orxonox::ColourValue() const 119 125 { 120 return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiType Primitive, orxonox::ColourValue>(*this);126 return (this->type_ == MT_colourvalue) ? this->colourvalue_ : ConvertValueAndReturn<MultiTypeMath, orxonox::ColourValue>(*this); 121 127 } 122 128 123 129 MultiTypeMath::operator orxonox::Radian() const 124 130 { 125 return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Radian>(*this);131 return (this->type_ == MT_radian) ? this->radian_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Radian>(*this); 126 132 } 127 133 128 134 MultiTypeMath::operator orxonox::Degree() const 129 135 { 130 return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiType Primitive, orxonox::Degree>(*this);136 return (this->type_ == MT_degree) ? this->degree_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Degree>(*this); 131 137 } 132 138 133 139 void MultiTypeMath::setValue(const MultiTypeMath& mtm) 134 140 { 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_; 137 150 } 138 151 -
code/branches/core/src/util/MultiTypeMath.h
r848 r853 59 59 inline MultiTypeMath(const orxonox::Radian& value) { this->setValue(value); } 60 60 inline MultiTypeMath(const orxonox::Degree& value) { this->setValue(value); } 61 MultiTypeMath(const MultiTypeMath& mtm);61 inline MultiTypeMath(const MultiTypeMath& mtm) { this->setValue(mtm); } 62 62 63 63 using MultiTypeString::operator=; … … 68 68 inline MultiTypeMath& operator=(const orxonox::Radian& value) { this->setValue(value); return *this; } 69 69 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; } 71 71 72 72 using MultiTypeString::operator==; … … 97 97 using MultiTypeString::setValue; 98 98 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; } 100 100 inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; } 101 101 inline void setValue(const orxonox::Quaternion& value) { this->type_ = MT_quaternion; this->quaternion_ = value; } -
code/branches/core/src/util/MultiTypePrimitive.cc
r848 r853 32 32 MultiTypePrimitive::MultiTypePrimitive(MultiType type) 33 33 { 34 std::cout << "4_5: Created MultiTypePrimitive with type " << type << std::endl; 34 35 this->type_ = type; 35 36 … … 60 61 else 61 62 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;75 63 } 76 64 … … 203 191 void MultiTypePrimitive::setValue(const MultiTypePrimitive& mtp) 204 192 { 193 std::cout << "4_3: setValue in MultiTypePrimitive with other Multitype as parameter: " << mtp << std::endl; 205 194 this->type_ = mtp.type_; 206 195 this->value_ = mtp.value_; -
code/branches/core/src/util/MultiTypePrimitive.h
r848 r853 52 52 inline MultiTypePrimitive(long double value) { this->setValue(value); } 53 53 inline MultiTypePrimitive(bool value) { this->setValue(value); } 54 MultiTypePrimitive(const MultiTypePrimitive& mtp);54 inline MultiTypePrimitive(const MultiTypePrimitive& mtp) { this->setValue(mtp); } 55 55 56 56 inline MultiTypePrimitive& operator=(MultiType value) { this->type_ = MT_null; return *this; } … … 67 67 inline MultiTypePrimitive& operator=(long double value) { this->setValue(value); return *this; } 68 68 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; } 70 70 71 71 inline bool operator==(int value) const { return (this->value_.int_ == value); } -
code/branches/core/src/util/MultiTypeString.cc
r848 r853 38 38 } 39 39 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 53 40 bool MultiTypeString::operator==(const MultiTypeString& mts) const 54 41 { … … 79 66 MultiTypeString::operator std::string() const 80 67 { 81 return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiType Primitive, std::string>(*this);68 return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this); 82 69 } 83 70 84 71 MultiTypeString::operator const char*() const 85 72 { 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(); 87 74 } 88 75 89 76 void MultiTypeString::setValue(const MultiTypeString& mts) 90 77 { 91 this->type_ = mts.type_;92 this-> value_ = mts.value_;78 MultiTypePrimitive::setValue(mts); 79 this->string_ = mts.string_; 93 80 } 94 81 -
code/branches/core/src/util/MultiTypeString.h
r848 r853 31 31 32 32 #include <string> 33 33 #include <iostream> 34 34 #include "UtilPrereqs.h" 35 35 … … 52 52 inline MultiTypeString(long double value) : MultiTypePrimitive(value) {} 53 53 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); } 57 57 58 58 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; } 62 62 63 63 using MultiTypePrimitive::operator==; 64 64 inline bool operator==(const char* value) const { return (this->string_ == std::string(value)); } 65 65 inline bool operator==(const std::string& value) const { return (this->string_ == value); } 66 bool operator==(const MultiTypeString& mt p) const;66 bool operator==(const MultiTypeString& mts) const; 67 67 68 68 using MultiTypePrimitive::operator!=; 69 69 inline bool operator!=(const char* value) const { return (this->string_ != std::string(value)); } 70 70 inline bool operator!=(const std::string& value) const { return (this->string_ != value); } 71 bool operator!=(const MultiTypeString& mt p) const;71 bool operator!=(const MultiTypeString& mts) const; 72 72 73 73 operator std::string() const; … … 77 77 inline void setValue(const char* value) { this->type_ = MT_string; this->string_ = std::string(value); } 78 78 inline void setValue(const std::string& value) { this->type_ = MT_string; this->string_ = value; } 79 void setValue(const MultiTypeString& mt p);79 void setValue(const MultiTypeString& mts); 80 80 81 81 inline const std::string getString() const { return this->string_; }
Note: See TracChangeset
for help on using the changeset viewer.