Changeset 708 for code/branches/FICN/src/orxonox/core/Identifier.h
- Timestamp:
- Dec 28, 2007, 10:30:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/Identifier.h
r700 r708 52 52 #define _Identifier_H__ 53 53 54 #include <string>55 54 #include <map> 56 55 57 56 #include "CorePrereqs.h" 58 57 58 #include "misc/String.h" 59 59 #include "ObjectList.h" 60 60 #include "IdentifierList.h" … … 112 112 113 113 /** @returns the name of the class the Identifier belongs to. */ 114 inline const std::string& getName() const { return this->name_; }114 inline const String& getName() const { return this->name_; } 115 115 116 116 /** @returns the parents of the class the Identifier belongs to. */ … … 130 130 131 131 /** @returns the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variable */ 132 inline ConfigValueContainer* getConfigValueContainer(const std::string& varname)132 inline ConfigValueContainer* getConfigValueContainer(const String& varname) 133 133 { return this->configValues_[varname]; } 134 134 135 135 /** @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 */ 136 inline void setConfigValueContainer(const std::string& varname, ConfigValueContainer* container)136 inline void setConfigValueContainer(const String& varname, ConfigValueContainer* container) 137 137 { this->configValues_[varname] = container; } 138 138 139 static std::map< std::string, Identifier*>& getIdentifierMap();139 static std::map<String, Identifier*>& getIdentifierMap(); 140 140 141 141 private: … … 166 166 IdentifierList* children_; //!< The Children of the class the Identifier belongs to 167 167 168 std::string name_; //!< The name of the class the Identifier belongs to168 String name_; //!< The name of the class the Identifier belongs to 169 169 170 170 BaseFactory* factory_; //!< The Factory, able to create new objects of the given class (if available) … … 172 172 static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading) 173 173 unsigned int classID_; //!< The network ID to identify a class through the network 174 std::map< std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer174 std::map<String, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer 175 175 }; 176 176 … … 189 189 { 190 190 public: 191 static ClassIdentifier<T>* registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass);191 static ClassIdentifier<T>* registerClass(const IdentifierList* parents, const String& name, bool bRootClass); 192 192 static void addObject(T* object); 193 193 static ClassIdentifier<T>* getIdentifier(); 194 void setName(const std::string& name);194 void setName(const String& name); 195 195 196 196 private: … … 221 221 */ 222 222 template <class T> 223 ClassIdentifier<T>* ClassIdentifier<T>::registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass)223 ClassIdentifier<T>* ClassIdentifier<T>::registerClass(const IdentifierList* parents, const String& name, bool bRootClass) 224 224 { 225 225 COUT(4) << "*** Register Class in " << name << "-Singleton." << std::endl; … … 265 265 */ 266 266 template <class T> 267 void ClassIdentifier<T>::setName(const std::string& name)267 void ClassIdentifier<T>::setName(const String& name) 268 268 { 269 269 // Make sure we didn't already set the name, to avoid duplicate entries in the Identifier map … … 271 271 { 272 272 this->name_ = name; 273 this->getIdentifierMap().insert(std::pair< std::string, Identifier*>(name, this));273 this->getIdentifierMap().insert(std::pair<String, Identifier*>(name, this)); 274 274 this->bSetName_ = true; 275 275 }
Note: See TracChangeset
for help on using the changeset viewer.