Changeset 1682
- Timestamp:
- Aug 30, 2008, 12:40:27 AM (16 years ago)
- Location:
- code/branches/core3/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/core/Identifier.cc
r1676 r1682 37 37 38 38 #include "Factory.h" 39 #include "ConfigValueContainer.h" 39 40 #include "ConsoleCommand.h" 40 41 #include "CommandExecutor.h" … … 77 78 delete this->children_; 78 79 delete this->directChildren_; 80 delete this->objects_; 81 82 if (this->factory_) 83 delete this->factory_; 84 85 for (std::map<std::string, ConsoleCommand*>::iterator it = this->consoleCommands_.begin(); it != this->consoleCommands_.end(); ++it) 86 delete (it->second); 87 for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it) 88 delete (it->second); 89 for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it) 90 delete (it->second); 91 for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it) 92 delete (it->second); 79 93 } 80 94 … … 153 167 154 168 /** 169 @brief Destroys all Identifiers. Called when exiting the program. 170 */ 171 void Identifier::destroyAllIdentifiers() 172 { 173 for (std::map<std::string, Identifier*>::iterator it = Identifier::getIdentifierMapIntern().begin(); it != Identifier::getIdentifierMapIntern().end(); ++it) 174 delete (it->second); 175 } 176 177 /** 155 178 @brief Sets the name of the class. 156 179 @param name The name … … 282 305 { 283 306 COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << "." << std::endl; 307 delete (it->second); 284 308 } 285 309 … … 329 353 { 330 354 COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << "." << std::endl; 355 delete (it->second); 331 356 } 332 357 … … 367 392 else 368 393 return 0; 394 } 395 396 /** 397 @brief Returns a XMLPortParamContainer that loads a parameter of this class. 398 @param paramname The name of the parameter 399 @return The container 400 */ 401 XMLPortParamContainer* Identifier::getXMLPortParamContainer(const std::string& paramname) 402 { 403 std::map<std::string, XMLPortParamContainer*>::const_iterator it = xmlportParamContainers_.find(paramname); 404 if (it != xmlportParamContainers_.end()) 405 return ((*it).second); 406 else 407 return 0; 408 } 409 410 /** 411 @brief Adds a new XMLPortParamContainer that loads a parameter of this class. 412 @param paramname The name of the parameter 413 @param container The container 414 */ 415 void Identifier::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) 416 { 417 this->xmlportParamContainers_[paramname] = container; 418 } 419 420 /** 421 @brief Returns a XMLPortObjectContainer that attaches an object to this class. 422 @param sectionname The name of the section that contains the attachable objects 423 @return The container 424 */ 425 XMLPortObjectContainer* Identifier::getXMLPortObjectContainer(const std::string& sectionname) 426 { 427 std::map<std::string, XMLPortObjectContainer*>::const_iterator it = xmlportObjectContainers_.find(sectionname); 428 if (it != xmlportObjectContainers_.end()) 429 return ((*it).second); 430 else 431 return 0; 432 } 433 434 /** 435 @brief Adds a new XMLPortObjectContainer that attaches an object to this class. 436 @param sectionname The name of the section that contains the attachable objects 437 @param container The container 438 */ 439 void Identifier::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container) 440 { 441 this->xmlportObjectContainers_[sectionname] = container; 369 442 } 370 443 -
code/branches/core3/src/core/Identifier.h
r1676 r1682 208 208 ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname); 209 209 210 v irtual void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) = 0;211 virtual XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname) = 0;212 213 v irtual void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container) = 0;214 virtual XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname) = 0;210 void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container); 211 XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname); 212 213 void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container); 214 XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname); 215 215 216 216 ConsoleCommand& addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut); … … 259 259 COUT(4) << "*** Identifier: Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl; 260 260 } 261 262 static void destroyAllIdentifiers(); 261 263 262 264 std::set<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to … … 279 281 std::map<std::string, ConsoleCommand*> consoleCommands_; //!< All console commands of this class 280 282 std::map<std::string, ConsoleCommand*> consoleCommands_LC_; //!< All console commands of this class with their names in lowercase 283 284 std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_; //!< All loadable parameters 285 std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_; //!< All attachable objects 281 286 }; 282 287 … … 310 315 311 316 void updateConfigValues(bool updateChildren = true) const; 312 317 /* 313 318 XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname); 314 319 void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container); … … 316 321 XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname); 317 322 void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container); 318 323 */ 319 324 private: 325 ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy 320 326 ClassIdentifier() 321 327 { … … 323 329 #include "Super.h" 324 330 } 325 ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy 326 ~ClassIdentifier() {} // don't delete 327 331 ~ClassIdentifier() 332 { 333 #define SUPER_INTRUSIVE_DESTRUCTOR 334 #include "Super.h" 335 /* 336 for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it) 337 delete (it->second); 338 for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it) 339 delete (it->second); 340 */ 341 } 342 /* 328 343 std::map<std::string, XMLPortClassParamContainer<class O>*> xmlportParamContainers_; //!< All loadable parameters 329 344 std::map<std::string, XMLPortClassObjectContainer<T, class O>*> xmlportObjectContainers_; //!< All attachable objects 330 345 */ 331 346 static ClassIdentifier<T> *classIdentifier_s; 332 347 }; … … 453 468 @param paramname The name of the parameter 454 469 @return The container 455 */ 470 *//* 456 471 template <class T> 457 472 XMLPortParamContainer* ClassIdentifier<T>::getXMLPortParamContainer(const std::string& paramname) … … 462 477 else 463 478 return 0; 464 } 479 }*/ 465 480 466 481 /** … … 468 483 @param paramname The name of the parameter 469 484 @param container The container 470 */ 485 *//* 471 486 template <class T> 472 487 void ClassIdentifier<T>::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) 473 488 { 474 489 this->xmlportParamContainers_[paramname] = (XMLPortClassParamContainer<class O>*)container; 475 } 490 }*/ 476 491 477 492 /** … … 479 494 @param sectionname The name of the section that contains the attachable objects 480 495 @return The container 481 */ 496 *//* 482 497 template <class T> 483 498 XMLPortObjectContainer* ClassIdentifier<T>::getXMLPortObjectContainer(const std::string& sectionname) … … 488 503 else 489 504 return 0; 490 } 505 }*/ 491 506 492 507 /** … … 494 509 @param sectionname The name of the section that contains the attachable objects 495 510 @param container The container 496 */ 511 *//* 497 512 template <class T> 498 513 void ClassIdentifier<T>::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container) 499 514 { 500 515 this->xmlportObjectContainers_[sectionname] = (XMLPortClassObjectContainer<T, class O>*)container; 501 } 516 }*/ 502 517 503 518 -
code/branches/core3/src/core/Language.cc
r1586 r1682 97 97 // Read the default language file to create all known LanguageEntry objects 98 98 this->readDefaultLanguageFile(); 99 } 100 101 /** 102 @brief Destructor: Deletes all language entries. 103 */ 104 Language::~Language() 105 { 106 for (std::map<std::string, LanguageEntry*>::iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it) 107 delete (it->second); 99 108 } 100 109 -
code/branches/core3/src/core/Language.h
r1535 r1682 123 123 Language(); 124 124 Language(const Language& language); // don't copy 125 virtual ~Language() {}; // don't delete125 virtual ~Language(); 126 126 127 127 void readDefaultLanguageFile(); -
code/branches/core3/src/core/Super.h
r1679 r1682 127 127 #undef SUPER_INTRUSIVE_CONSTRUCTOR 128 128 #endif /* SUPER_INTRUSIVE_CONSTRUCTOR */ 129 130 #ifdef SUPER_INTRUSIVE_DESTRUCTOR 131 132 //////////////////////////// 133 // Function-specific code // 134 //////////////////////////// 135 136 if (this->superFunctionCaller_testfunction_) 137 delete this->superFunctionCaller_testfunction_; 138 139 #undef SUPER_INTRUSIVE_DESTRUCTOR 140 #endif /* SUPER_INTRUSIVE_DESTRUCTOR */ 129 141 #endif /* _Super_H__ */ -
code/branches/core3/src/core/TclThreadManager.cc
r1594 r1682 72 72 } 73 73 74 TclThreadManager::~TclThreadManager() 75 { 76 unsigned int threadID; 77 { 78 boost::mutex::scoped_lock bundles_lock(this->bundlesMutex_); 79 if (this->interpreterBundles_.begin() == this->interpreterBundles_.end()) 80 return; 81 else 82 threadID = this->interpreterBundles_.begin()->first; 83 } 84 this->destroy(threadID); 85 } 86 74 87 TclThreadManager& TclThreadManager::getInstance() 75 88 { -
code/branches/core3/src/core/TclThreadManager.h
r1535 r1682 71 71 class _CoreExport TclThreadManager : public OrxonoxClass 72 72 { 73 friend class IRC; 74 friend class TclBind; 75 73 76 public: 74 77 static TclThreadManager& getInstance(); … … 83 86 static void flush(unsigned int threadID); 84 87 88 void error(const std::string& error); 89 void debug(const std::string& error); 90 91 virtual void tick(float dt); 92 93 std::list<unsigned int> getThreadList() const; 94 95 private: 96 TclThreadManager(); 97 TclThreadManager(const TclThreadManager& other); 98 ~TclThreadManager(); 99 85 100 static void tcl_execute(Tcl::object const &args); 86 101 static std::string tcl_query(int querierID, Tcl::object const &args); … … 91 106 TclInterpreterBundle* getInterpreterBundle(unsigned int threadID); 92 107 std::string dumpList(const std::list<unsigned int>& list); 93 void error(const std::string& error);94 void debug(const std::string& error);95 108 96 109 void pushCommandToQueue(const std::string& command); … … 107 120 std::string evalQuery(unsigned int querierID, const std::string& command); 108 121 std::string evalQuery(unsigned int querierID, unsigned int threadID, const std::string& command); 109 110 virtual void tick(float dt);111 112 std::list<unsigned int> getThreadList() const;113 114 private:115 TclThreadManager();116 TclThreadManager(const TclThreadManager& other);117 ~TclThreadManager() {}118 122 119 123 unsigned int threadCounter_; -
code/branches/core3/src/orxonox/objects/Projectile.h
r1681 r1682 97 97 ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); 98 98 99 /* 99 100 SuperFunctionCaller_testfunction* superFunctionCaller = 0; 100 101 // Search for an existing caller within all direct children … … 105 106 if (!superFunctionCaller) 106 107 superFunctionCaller = new SuperFunctionClassCaller_testfunction<T>; 108 */ 107 109 // Iterate through all children and assign the caller 108 110 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) … … 111 113 { 112 114 std::cout << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl; 113 ((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_ = superFunctionCaller; 115 // ((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_ = superFunctionCaller; 116 ((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_ = new SuperFunctionClassCaller_testfunction<T>; 114 117 } 115 118 }
Note: See TracChangeset
for help on using the changeset viewer.