Changeset 847
- Timestamp:
- Mar 3, 2008, 1:49:06 AM (17 years ago)
- Location:
- code/branches/core/src/orxonox/core
- Files:
-
- 5 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/core/BaseObject.cc
r826 r847 34 34 35 35 #include "BaseObject.h" 36 #include "XMLPort.h" 36 37 37 38 namespace orxonox … … 46 47 RegisterRootObject(BaseObject); 47 48 49 this->bActive_ = true; 50 this->bVisible_ = true; 48 51 this->level_ = 0; 49 52 } … … 75 78 Element& BaseObject::XMLPort(Element& xmlelement, bool loading) 76 79 { 77 //XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading);80 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading); 78 81 79 82 return xmlelement; -
code/branches/core/src/orxonox/core/BaseObject.h
r845 r847 52 52 virtual Element& XMLPort(Element& xmlelement, bool loading); 53 53 54 /** @brief Sets the name of the object. @param name The name */ 55 inline void setName(const std::string& name) { this->name_ = name; this->changedName(); } 56 /** @brief Returns the name of the object. @return The name */ 57 inline const std::string& getName() const { return this->name_; } 58 /** @brief This function gets called if the name of the object changes. */ 59 virtual void changedName() {} 60 61 /** @brief Sets the state of the objects activity. @param bActive True = active */ 62 inline void setActivity(bool bActive) { this->bActive_ = bActive; this->changedActivity(); } 63 /** @brief Returns the state of the objects activity. @return The state of the activity */ 64 inline const bool isActive() const { return this->bActive_; } 65 /** @brief This function gets called if the activity of the object changes. */ 66 virtual void changedActivity() {} 67 68 /** @brief Sets the state of the objects visibility. @param bVisible True = visible */ 69 inline void setVisibility(bool bVisible) { this->bVisible_ = bVisible; this->changedVisibility(); } 70 /** @brief Returns the state of the objects visibility. @return The state of the visibility */ 71 inline const bool isVisible() const { return this->bVisible_; } 72 /** @brief This function gets called if the visibility of the object changes. */ 73 virtual void changedVisibility() {} 74 75 /** @brief Sets a pointer to the level that loaded this object. @param level The pointer to the level */ 76 inline void setLevel(const Level* level) { this->level_ = level; } 54 77 /** @brief Returns a pointer to the level that loaded this object. @return The level */ 55 78 inline const Level* getLevel() const { return this->level_; } 56 79 57 80 private: 81 std::string name_; //!< The name of the object 82 bool bActive_; //!< True = the object is active 83 bool bVisible_; //!< True = the object is visible 58 84 const Level* level_; //!< The level that loaded this object 59 85 }; -
code/branches/core/src/orxonox/core/CMakeLists.txt
r820 r847 15 15 ClassTreeMask.cc 16 16 Loader.cc 17 Executor.cc 18 XMLPort.cc 17 19 ) 18 20 -
code/branches/core/src/orxonox/core/ConfigValueContainer.cc
r839 r847 957 957 @return The description 958 958 */ 959 std::stringConfigValueContainer::getDescription() const959 const std::string& ConfigValueContainer::getDescription() const 960 960 { 961 961 return GetLocalisation(this->description_); -
code/branches/core/src/orxonox/core/ConfigValueContainer.h
r838 r847 100 100 101 101 void description(const std::string& description); 102 std::stringgetDescription() const;102 const std::string& getDescription() const; 103 103 104 104 bool parseString(const std::string& input, MultiTypeMath& defvalue); -
code/branches/core/src/orxonox/core/CoreIncludes.h
r845 r847 121 121 { \ 122 122 container##varname = new orxonox::ConfigValueContainer(this->getIdentifier()->getName(), #varname, varname = defvalue); \ 123 this->getIdentifier()-> setConfigValueContainer(#varname, container##varname); \123 this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \ 124 124 } \ 125 125 container##varname->getValue(&varname) -
code/branches/core/src/orxonox/core/CorePrereqs.h
r838 r847 82 82 class DebugLevel; 83 83 class Error; 84 class Executor; 84 85 class Factory; 85 86 class Identifier; … … 102 103 template <class T> 103 104 class SubclassIdentifier; 105 class XMLPortParamContainer; 106 template <class T> 107 class XMLPortClassParamContainer; 104 108 } 105 109 -
code/branches/core/src/orxonox/core/Identifier.cc
r820 r847 198 198 199 199 /** 200 @brief Returns the ConfigValueContainer of a variable, given by the string of its name. 201 @param varname The name of the variable 202 @return The ConfigValueContainer 203 */ 204 ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname) 205 { 206 std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname); 207 if (it != configValues_.end()) 208 return ((*it).second); 209 else 210 return 0; 211 } 212 213 /** 214 @brief Adds the ConfigValueContainer of a variable, given by the string of its name. 215 @param varname The name of the variablee 216 @param container The container 217 */ 218 void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container) 219 { 220 this->configValues_[varname] = container; 221 } 222 223 /** 200 224 @brief Searches for a given identifier in a list and returns whether the identifier is in the list or not. 201 225 @param identifier The identifier to look for -
code/branches/core/src/orxonox/core/Identifier.h
r845 r847 62 62 #include "Debug.h" 63 63 #include "Iterator.h" 64 //#include "XMLPort.h" 64 65 65 66 namespace orxonox … … 151 152 void setNetworkID(unsigned int id); 152 153 153 /** @brief Returns the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variable @return The ConfigValueContainer */ 154 inline ConfigValueContainer* getConfigValueContainer(const std::string& varname) 155 { return this->configValues_[varname]; } 156 157 /** @brief Sets the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variablee @param container The container */ 158 inline void setConfigValueContainer(const std::string& varname, ConfigValueContainer* container) 159 { this->configValues_[varname] = container; } 154 ConfigValueContainer* getConfigValueContainer(const std::string& varname); 155 void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container); 156 157 virtual XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname) = 0; 158 virtual void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) = 0; 160 159 161 160 static bool identifierIsInList(const Identifier* identifier, const std::list<const Identifier*>& list); … … 236 235 inline const ObjectList<T>* getObjects() const { return this->objects_; } 237 236 237 XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname); 238 void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container); 239 238 240 private: 239 241 ClassIdentifier(); … … 243 245 ObjectList<T>* objects_; //!< The ObjectList, containing all objects of type T 244 246 bool bSetName_; //!< True if the name is set 247 std::map<std::string, XMLPortClassParamContainer<T>*> xmlportParamContainers_; 245 248 }; 246 249 … … 317 320 for (Iterator<T> it = this->objects_->start(); it;) 318 321 delete *(it++); 322 } 323 324 template <class T> 325 XMLPortParamContainer* ClassIdentifier<T>::getXMLPortParamContainer(const std::string& paramname) 326 { 327 typename std::map<std::string, XMLPortClassParamContainer<T>*>::const_iterator it = xmlportParamContainers_.find(paramname); 328 if (it != xmlportParamContainers_.end()) 329 return (XMLPortParamContainer*)((*it).second); 330 else 331 return 0; 332 } 333 334 template <class T> 335 void ClassIdentifier<T>::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) 336 { 337 this->xmlportParamContainers_[paramname] = (XMLPortClassParamContainer<T>*)container; 319 338 } 320 339 -
code/branches/core/src/orxonox/core/Language.cc
r838 r847 145 145 { 146 146 LanguageEntry* newEntry = new LanguageEntry(entry); 147 newEntry->set Name(label);147 newEntry->setLabel(label); 148 148 this->languageEntries_[label] = newEntry; 149 149 return newEntry; … … 332 332 for (Iterator<LanguageEntry> it = ObjectList<LanguageEntry>::start(); it; ++it) 333 333 { 334 file << it->get Name() << "=" << it->getDefault() << std::endl;334 file << it->getLabel() << "=" << it->getDefault() << std::endl; 335 335 } 336 336 -
code/branches/core/src/orxonox/core/Language.h
r845 r847 51 51 #include "OrxonoxClass.h" 52 52 53 54 #define AddLanguageEntry(label, fallbackstring) \ 55 orxonox::Language::getLanguage().addEntry(label, fallbackstring) 56 57 #define GetLocalisation(label) \ 58 orxonox::Language::getLanguage().getLocalisation(label) 59 60 53 61 namespace orxonox 54 62 { … … 78 86 { return this->fallbackEntry_; } 79 87 88 /** 89 @brief Sets the label of this entry. 90 @param label The label 91 */ 92 inline void setLabel(const LanguageEntryLabel& label) 93 { this->label_ = label; } 94 95 /** 96 @brief Returns the label of this entry. 97 @return The label 98 */ 99 inline const LanguageEntryLabel& getLabel() const 100 { return this->label_; } 101 80 102 private: 81 std::string fallbackEntry_; //!< The default entry: Used, if no translation is available or no language configured 82 std::string localisedEntry_; //!< The localised entry in the configured language 83 bool bLocalisationSet_; //!< True if the translation was set 103 LanguageEntryLabel label_; //!< The label of the entry 104 std::string fallbackEntry_; //!< The default entry: Used, if no translation is available or no language configured 105 std::string localisedEntry_; //!< The localised entry in the configured language 106 bool bLocalisationSet_; //!< True if the translation was set 84 107 }; 85 108 … … 118 141 } 119 142 120 #define AddLanguageEntry(label, fallbackstring) \121 orxonox::Language::getLanguage().addEntry(label, fallbackstring)122 123 #define GetLocalisation(label) \124 orxonox::Language::getLanguage().getLocalisation(label)125 126 143 #endif /* _Language_H__ */ -
code/branches/core/src/orxonox/core/Loader.cc
r820 r847 121 121 COUT(4) << " fabricating " << child->Value() << "..." << std::endl; 122 122 BaseObject* newObject = identifier->fabricate(); 123 newObject->XMLPort(*child, true); 123 124 } 124 125 else -
code/branches/core/src/orxonox/core/OrxonoxClass.cc
r813 r847 42 42 this->identifier_ = 0; 43 43 this->parents_ = 0; 44 45 this->bActive_ = true;46 this->bVisible_ = true;47 44 } 48 45 -
code/branches/core/src/orxonox/core/OrxonoxClass.h
r845 r847 155 155 { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); } 156 156 157 158 /** @brief Sets the name of the object. @param name The name */159 inline virtual void setName(const std::string& name) { this->name_ = name; }160 161 /** @brief Returns the name of the object. @return The name */162 inline const std::string& getName() const { return this->name_; }163 164 /** @brief Sets the state of the objects activity. @param bActive True = active */165 inline virtual void setActive(bool bActive) { this->bActive_ = bActive; }166 167 /** @brief Returns the state of the objects activity. @return The state of the activity */168 inline const bool isActive() const { return this->bActive_; }169 170 /** @brief Sets the state of the objects visibility. @param bVisible True = visible */171 inline virtual void setVisible(bool bVisible) { this->bVisible_ = bVisible; }172 173 /** @brief Returns the state of the objects visibility. @return The state of the visibility */174 inline const bool isVisible() const { return this->bVisible_; }175 176 157 private: 177 158 Identifier* identifier_; //!< The Identifier of the object 178 159 std::list<const Identifier*>* parents_; //!< List of all parents of the object 179 160 MetaObjectList metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 180 181 std::string name_; //!< The name of the object182 bool bActive_; //!< True = the object is active183 bool bVisible_; //!< True = the object is visible184 161 }; 185 162 }
Note: See TracChangeset
for help on using the changeset viewer.