Changeset 10518 for code/branches/core7/src/libraries/core/Core.cc
- Timestamp:
- May 31, 2015, 10:56:32 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/Core.cc
r10509 r10518 111 111 , graphicsScope_(NULL) 112 112 , bGraphicsLoaded_(false) 113 , rootModule_(NULL) 113 114 , config_(NULL) 114 115 , destructionHelper_(this) … … 121 122 // Create a new dynamic library manager 122 123 this->dynLibManager_ = new DynLibManager(); 123 124 // Load modules125 orxout(internal_info) << "Loading modules:" << endl;126 const std::vector<std::string>& modulePaths = ApplicationPaths::getInstance().getModulePaths();127 for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)128 {129 try130 {131 this->dynLibManager_->load(*it);132 }133 catch (...)134 {135 orxout(user_error) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << endl;136 }137 }138 124 139 125 // TODO: initialize Root-Context … … 142 128 // TODO: initialize CommandLineParser here 143 129 // TODO: initialize ConsoleCommandManager here 144 ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(); 130 this->rootModule_ = ModuleInstance::getCurrentModuleInstance(); 131 this->rootModule_->loadAllStaticallyInitializedInstances(); 145 132 146 133 // Parse command line arguments AFTER the modules have been loaded (static code!) … … 258 245 IdentifierManager::getInstance().destroyAllIdentifiers(); 259 246 safeObjectDelete(&signalHandler_); 247 // if (this->rootModule_) 248 // this->rootModule_->unloadAllStaticallyInitializedInstances(); 249 // safeObjectDelete(&rootModule_); 260 250 safeObjectDelete(&dynLibManager_); 261 251 safeObjectDelete(&configurablePaths_); … … 263 253 264 254 orxout(internal_status) << "finished destroying Core object" << endl; 255 } 256 257 void Core::loadModules() 258 { 259 orxout(internal_info) << "Loading modules:" << endl; 260 261 const std::vector<std::string>& modulePaths = ApplicationPaths::getInstance().getModulePaths(); 262 for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it) 263 { 264 try 265 { 266 ModuleInstance* module = new ModuleInstance(*it); 267 this->loadModule(module); 268 this->modules_.push_back(module); 269 } 270 catch (...) 271 { 272 orxout(user_error) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << endl; 273 } 274 } 275 276 orxout(internal_info) << "finished loading modules" << endl; 277 } 278 279 void Core::loadModule(ModuleInstance* module) 280 { 281 ModuleInstance::setCurrentModuleInstance(module); 282 DynLib* dynLib = this->dynLibManager_->load(module->getName()); 283 module->setDynLib(dynLib); 284 module->loadAllStaticallyInitializedInstances(); 285 IdentifierManager::getInstance().createClassHierarchy(); 286 ScopeManager::getInstance().updateListeners(); 287 } 288 289 void Core::unloadModules() 290 { 291 for (std::list<ModuleInstance*>::iterator it = this->modules_.begin(); it != this->modules_.end(); ++it) 292 { 293 ModuleInstance* module = (*it); 294 this->unloadModule(module); 295 delete module; 296 } 297 this->modules_.clear(); 298 } 299 300 void Core::unloadModule(ModuleInstance* module) 301 { 302 module->unloadAllStaticallyInitializedInstances(); 303 module->deleteAllStaticallyInitializedInstances(); 304 this->dynLibManager_->unload(module->getDynLib()); 305 module->setDynLib(NULL); 265 306 } 266 307
Note: See TracChangeset
for help on using the changeset viewer.