Changeset 5781 for code/trunk/src/libraries/core/Identifier.h
- Timestamp:
- Sep 24, 2009, 11:02:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/Identifier.h
r5774 r5781 66 66 #include "ObjectList.h" 67 67 #include "ObjectListBase.h" 68 #include "Super.h" 68 69 69 70 namespace orxonox … … 106 107 bool isDirectParentOf(const Identifier* identifier) const; 107 108 109 /** @brief Returns true if the class can be loaded through XML. */ 110 inline bool isLoadable() const { return this->bLoadable_; } 111 /** @brief Set the class to be loadable through XML or not. */ 112 inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; } 113 108 114 /** @brief Returns the list of all existing objects of this class. @return The list */ 109 115 inline ObjectListBase* getObjects() const … … 175 181 176 182 183 /** @brief Returns the map that stores all console commands. @return The const_iterator */ 184 inline const std::map<std::string, ConsoleCommand*>& getConsoleCommandMap() const { return this->consoleCommands_; } 185 /** @brief Returns a const_iterator to the beginning of the map that stores all console commands. @return The const_iterator */ 186 inline std::map<std::string, ConsoleCommand*>::const_iterator getConsoleCommandMapBegin() const { return this->consoleCommands_.begin(); } 187 /** @brief Returns a const_iterator to the end of the map that stores all console commands. @return The const_iterator */ 188 inline std::map<std::string, ConsoleCommand*>::const_iterator getConsoleCommandMapEnd() const { return this->consoleCommands_.end(); } 189 190 /** @brief Returns the map that stores all console commands with their names in lowercase. @return The const_iterator */ 191 inline const std::map<std::string, ConsoleCommand*>& getLowercaseConsoleCommandMap() const { return this->consoleCommands_LC_; } 192 /** @brief Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase. @return The const_iterator */ 193 inline std::map<std::string, ConsoleCommand*>::const_iterator getLowercaseConsoleCommandMapBegin() const { return this->consoleCommands_LC_.begin(); } 194 /** @brief Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase. @return The const_iterator */ 195 inline std::map<std::string, ConsoleCommand*>::const_iterator getLowercaseConsoleCommandMapEnd() const { return this->consoleCommands_LC_.end(); } 196 197 /** @brief Returns the map that stores all XMLPort params. @return The const_iterator */ 198 inline const std::map<std::string, XMLPortParamContainer*>& getXMLPortParamMap() const { return this->xmlportParamContainers_; } 199 /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort params. @return The const_iterator */ 200 inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapBegin() const { return this->xmlportParamContainers_.begin(); } 201 /** @brief Returns a const_iterator to the end of the map that stores all XMLPort params. @return The const_iterator */ 202 inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapEnd() const { return this->xmlportParamContainers_.end(); } 203 204 /** @brief Returns the map that stores all XMLPort objects. @return The const_iterator */ 205 inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortObjectMap() const { return this->xmlportObjectContainers_; } 206 /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort objects. @return The const_iterator */ 207 inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapBegin() const { return this->xmlportObjectContainers_.begin(); } 208 /** @brief Returns a const_iterator to the end of the map that stores all XMLPort objects. @return The const_iterator */ 209 inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); } 210 211 /** @brief Returns the map that stores all XMLPort events. @return The const_iterator */ 212 inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortEventMap() const { return this->xmlportEventContainers_; } 213 /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort events. @return The const_iterator */ 214 inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortEventMapBegin() const { return this->xmlportEventContainers_.begin(); } 215 /** @brief Returns a const_iterator to the end of the map that stores all XMLPort events. @return The const_iterator */ 216 inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortEventMapEnd() const { return this->xmlportEventContainers_.end(); } 217 177 218 /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */ 178 219 inline bool hasConfigValues() const { return this->bHasConfigValues_; } 220 /** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */ 221 inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; } 179 222 180 223 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */ 181 224 inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); } 225 226 /** @brief Returns the network ID to identify a class through the network. @return the network ID */ 227 inline const uint32_t getNetworkID() const { return this->networkID_; } 228 229 /** @brief Sets the network ID to a new value. @param id The new value */ 230 void setNetworkID(uint32_t id); 182 231 183 232 /** @brief Returns the unique ID of the class */ … … 187 236 ConfigValueContainer* getConfigValueContainer(const std::string& varname); 188 237 ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname); 238 239 void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container); 240 XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname); 241 242 void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container); 243 XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname); 244 245 void addXMLPortEventContainer(const std::string& eventname, XMLPortObjectContainer* container); 246 XMLPortObjectContainer* getXMLPortEventContainer(const std::string& eventname); 247 248 ConsoleCommand& addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut); 249 ConsoleCommand* getConsoleCommand(const std::string& name) const; 250 ConsoleCommand* getLowercaseConsoleCommand(const std::string& name) const; 189 251 190 252 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass); … … 198 260 199 261 static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal); 262 virtual void createSuperFunctionCaller() const = 0; 200 263 201 264 /** @brief Returns the map that stores all Identifiers. @return The map */ … … 242 305 bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents) 243 306 bool bSetName_; //!< True if the name is set 307 bool bLoadable_; //!< False = it's not permitted to load the object through XML 244 308 std::string name_; //!< The name of the class the Identifier belongs to 245 309 BaseFactory* factory_; //!< The Factory, able to create new objects of the given class (if available) 246 310 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) 311 uint32_t networkID_; //!< The network ID to identify a class through the network 247 312 const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_) 248 313 static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs … … 251 316 std::map<std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer 252 317 std::map<std::string, ConfigValueContainer*> configValues_LC_; //!< A map to link the string of configurable variables with their ConfigValueContainer 318 319 bool bHasConsoleCommands_; //!< True if this class has at least one assigned console command 320 std::map<std::string, ConsoleCommand*> consoleCommands_; //!< All console commands of this class 321 std::map<std::string, ConsoleCommand*> consoleCommands_LC_; //!< All console commands of this class with their names in lowercase 322 323 std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_; //!< All loadable parameters 324 std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_; //!< All attachable objects 325 std::map<std::string, XMLPortObjectContainer*> xmlportEventContainers_; //!< All events 253 326 }; 254 327 … … 271 344 class ClassIdentifier : public Identifier 272 345 { 346 #define SUPER_INTRUSIVE_DECLARATION_INCLUDE 347 #include "Super.h" 348 273 349 public: 274 350 static ClassIdentifier<T> *getIdentifier(); … … 284 360 ClassIdentifier() 285 361 { 362 SuperFunctionInitialization<0, T>::initialize(this); 286 363 } 287 364 ~ClassIdentifier() 288 365 { 366 SuperFunctionDestruction<0, T>::destroy(this); 289 367 } 290 368 … … 552 630 { return this->identifier_; } 553 631 632 // /** @brief Returns true, if the assigned identifier is at least of the given type. @param identifier The identifier to compare with */ 633 // inline bool isA(const Identifier* identifier) const 634 // { return this->identifier_->isA(identifier); } 635 // 636 // /** @brief Returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */ 637 // inline bool isExactlyA(const Identifier* identifier) const 638 // { return this->identifier_->isExactlyA(identifier); } 639 // 640 // /** @brief Returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */ 641 // inline bool isChildOf(const Identifier* identifier) const 642 // { return this->identifier_->isChildOf(identifier); } 643 // 644 // /** @brief Returns true, if the assigned identifier is a direct child of the given identifier. @param identifier The identifier to compare with */ 645 // inline bool isDirectChildOf(const Identifier* identifier) const 646 // { return this->identifier_->isDirectChildOf(identifier); } 647 // 648 // /** @brief Returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */ 649 // inline bool isParentOf(const Identifier* identifier) const 650 // { return this->identifier_->isParentOf(identifier); } 651 // 652 // /** @brief Returns true, if the assigned identifier is a direct parent of the given identifier. @param identifier The identifier to compare with */ 653 // inline bool isDirectParentOf(const Identifier* identifier) const 654 // { return this->identifier_->isDirectParentOf(identifier); } 655 554 656 private: 555 657 Identifier* identifier_; //!< The assigned identifier
Note: See TracChangeset
for help on using the changeset viewer.