Changeset 11071 for code/trunk/src/libraries/core/module
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/module/DynLib.cc
r10540 r11071 56 56 { 57 57 mName = name; 58 m_hInst = NULL;58 m_hInst = nullptr; 59 59 } 60 60 … … 127 127 FORMAT_MESSAGE_FROM_SYSTEM | 128 128 FORMAT_MESSAGE_IGNORE_INSERTS, 129 NULL,129 nullptr, 130 130 GetLastError(), 131 131 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 132 132 (LPTSTR) &lpMsgBuf, 133 133 0, 134 NULL134 nullptr 135 135 ); 136 136 std::string ret = (char*)lpMsgBuf; -
code/trunk/src/libraries/core/module/DynLib.h
r10541 r11071 45 45 #if defined(ORXONOX_PLATFORM_WINDOWS) 46 46 # define DYNLIB_HANDLE hInstance 47 # define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )47 # define DYNLIB_LOAD( a ) LoadLibraryEx( a, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH ) 48 48 # define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b ) 49 49 # define DYNLIB_UNLOAD( a ) !FreeLibrary( a ) … … 104 104 the symbol. 105 105 @par 106 If the function fails, the returned value is <b> NULL</b>.106 If the function fails, the returned value is <b>nullptr</b>. 107 107 108 108 */ -
code/trunk/src/libraries/core/module/DynLibManager.cc
r10540 r11071 38 38 //----------------------------------------------------------------------- 39 39 //! Static pointer to the singleton 40 DynLibManager* DynLibManager::singletonPtr_s = 0;40 DynLibManager* DynLibManager::singletonPtr_s = nullptr; 41 41 42 42 //----------------------------------------------------------------------- … … 75 75 { 76 76 // Unload & delete resources in turn 77 for ( DynLibList::iterator it = mLibList.begin(); it != mLibList.end(); ++it)77 for (const auto& mapEntry : mLibList) 78 78 { 79 it->second->unload();80 delete it->second;79 mapEntry.second->unload(); 80 delete mapEntry.second; 81 81 } 82 82 -
code/trunk/src/libraries/core/module/ModuleInstance.cc
r10549 r11071 33 33 namespace orxonox 34 34 { 35 ModuleInstance* ModuleInstance::currentModuleInstance_s = NULL;35 ModuleInstance* ModuleInstance::currentModuleInstance_s = nullptr; 36 36 37 37 ModuleInstance::ModuleInstance(const std::string& libraryName) 38 38 : libraryName_(libraryName) 39 , dynLib_( NULL)39 , dynLib_(nullptr) 40 40 { 41 41 } … … 59 59 { 60 60 const std::set<StaticallyInitializedInstance*>& instances = this->staticallyInitializedInstancesByType_[type]; 61 for ( std::set<StaticallyInitializedInstance*>::iterator it = instances.begin(); it != instances.end(); ++it)62 (*it)->load();61 for (StaticallyInitializedInstance* instance : instances) 62 instance->load(); 63 63 } 64 64 … … 73 73 void ModuleInstance::deleteAllStaticallyInitializedInstances() 74 74 { 75 std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*> 75 std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_); 76 76 this->staticallyInitializedInstancesByType_.clear(); 77 for ( std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*> >::iterator it1 = copy.begin(); it1 != copy.end(); ++it1)78 for ( std::set<StaticallyInitializedInstance*>::iterator it2 = it1->second.begin(); it2 != it1->second.end(); ++it2)79 delete (*it2);77 for (const auto& mapEntry : copy) 78 for (StaticallyInitializedInstance* instance : mapEntry.second) 79 delete instance; 80 80 } 81 81 -
code/trunk/src/libraries/core/module/ModuleInstance.h
r10549 r11071 69 69 70 70 private: 71 std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*> 71 std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> staticallyInitializedInstancesByType_; 72 72 std::string libraryName_; 73 73 DynLib* dynLib_; -
code/trunk/src/libraries/core/module/Plugin.cc
r11015 r11071 39 39 { 40 40 this->referenceCounter_ = 0; 41 this->moduleInstance_ = NULL;41 this->moduleInstance_ = nullptr; 42 42 } 43 43 … … 45 45 { 46 46 // force unloading of the module when the plugin is destroyed 47 if (this->moduleInstance_ != NULL)47 if (this->moduleInstance_ != nullptr) 48 48 this->unloadModule(); 49 49 } … … 79 79 { 80 80 // only load module if it isn't already loaded. otherwise merely activate it. 81 if (this->moduleInstance_ == NULL)81 if (this->moduleInstance_ == nullptr) 82 82 this->loadModule(); 83 83 else … … 112 112 Core::getInstance().unloadModule(this->moduleInstance_); 113 113 delete this->moduleInstance_; 114 this->moduleInstance_ = NULL;114 this->moduleInstance_ = nullptr; 115 115 } 116 116 void Plugin::deactivateModule() -
code/trunk/src/libraries/core/module/PluginManager.cc
r11017 r11071 54 54 SetConsoleCommand("PluginManager", __CC_PluginManager_unload_name, &PluginManager::unloadPlugin); 55 55 56 PluginManager* PluginManager::singletonPtr_s = 0;56 PluginManager* PluginManager::singletonPtr_s = nullptr; 57 57 58 58 RegisterAbstractClass(PluginManager).inheritsFrom<Configurable>(); … … 70 70 PluginManager::~PluginManager() 71 71 { 72 ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject( NULL);73 ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject( NULL);72 ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject(nullptr); 73 ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr); 74 74 75 for ( std::map<std::string, PluginReference*>::iterator it = this->references_.begin(); it != this->references_.end(); ++it)76 delete it->second;77 for ( std::map<std::string, Plugin*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)78 delete it->second;75 for (const auto& mapEntry : this->references_) 76 delete mapEntry.second; 77 for (const auto& mapEntry : this->plugins_) 78 delete mapEntry.second; 79 79 } 80 80 … … 96 96 { 97 97 const std::vector<std::string>& pluginPaths = ApplicationPaths::getInstance().getPluginPaths(); 98 for ( std::vector<std::string>::const_iterator it = pluginPaths.begin(); it != pluginPaths.end(); ++it)98 for (const std::string& libraryName : pluginPaths) 99 99 { 100 100 std::string name; 101 std::string libraryName = (*it);102 101 std::string filename = libraryName + + specialConfig::pluginExtension; 103 102 std::ifstream infile(filename.c_str()); … … 117 116 { 118 117 Plugin* plugin = this->plugins_[name]; 119 if (plugin != NULL)118 if (plugin != nullptr) 120 119 plugin->reference(); 121 120 else … … 126 125 { 127 126 Plugin* plugin = this->plugins_[name]; 128 if (plugin != NULL)127 if (plugin != nullptr) 129 128 plugin->dereference(this->bMerelyDeactivatePlugins_); 130 129 else … … 137 136 void PluginManager::loadPlugin(const std::string& name) 138 137 { 139 if (this->references_[name] == NULL)138 if (this->references_[name] == nullptr) 140 139 { 141 140 this->references_[name] = new PluginReference(name); … … 152 151 { 153 152 PluginReference* reference = this->references_[name]; 154 if (reference != NULL)153 if (reference != nullptr) 155 154 { 156 this->references_[name] = NULL;155 this->references_[name] = nullptr; 157 156 delete reference; 158 157 } -
code/trunk/src/libraries/core/module/StaticInitializationHandler.h
r10532 r11071 37 37 { 38 38 public: 39 StaticInitializationHandler() {}40 virtual ~StaticInitializationHandler() {}39 StaticInitializationHandler() = default; 40 virtual ~StaticInitializationHandler() = default; 41 41 42 42 virtual void setupHandler() = 0; -
code/trunk/src/libraries/core/module/StaticInitializationHandlerIncludes.h
r10535 r11071 53 53 ~StaticallyInitializedStaticInitializationHandler() { delete handler_; } 54 54 55 virtual void load() ;56 virtual void unload() ;55 virtual void load() override; 56 virtual void unload() override; 57 57 58 58 inline StaticInitializationHandler& getHandler() -
code/trunk/src/libraries/core/module/StaticInitializationManager.cc
r10542 r11071 33 33 namespace orxonox 34 34 { 35 StaticInitializationManager* StaticInitializationManager::singletonPtr_s = 0;35 StaticInitializationManager* StaticInitializationManager::singletonPtr_s = nullptr; 36 36 37 37 void StaticInitializationManager::addHandler(StaticInitializationHandler* handler) … … 50 50 { 51 51 // attention: loading a module may add new handlers to the list 52 for ( std::list<StaticInitializationHandler*>::iterator it = this->handlers_.begin(); it != this->handlers_.end(); ++it)53 (*it)->loadModule(module);52 for (StaticInitializationHandler* handler : this->handlers_) 53 handler->loadModule(module); 54 54 } 55 55 -
code/trunk/src/libraries/core/module/StaticInitializationManager.h
r10542 r11071 43 43 44 44 public: 45 StaticInitializationManager() {}46 virtual ~StaticInitializationManager() {}45 StaticInitializationManager() = default; 46 virtual ~StaticInitializationManager() = default; 47 47 48 48 void addHandler(StaticInitializationHandler* handler);
Note: See TracChangeset
for help on using the changeset viewer.