| 1882 | //----------------------------------------------------------------------------- |
| 1883 | |
| 1884 | void ModuleManager::clearDatabase( void ) |
| 1885 | { |
| 1886 | // Lock database. |
| 1887 | AssertFatal( mDatabaseLocks == 0, "Cannot clear database if database is locked." ); |
| 1888 | |
| 1889 | // Iterate groups loaded. |
| 1890 | while ( mGroupsLoaded.size() > 0 ) |
| 1891 | { |
| 1892 | // Unload module group. |
| 1893 | unloadModuleGroup( *mGroupsLoaded.begin() ); |
| 1894 | } |
| 1895 | |
| 1896 | // Iterate any other explicit modules that are loaded. |
| 1897 | while ( mModulesLoaded.size() > 0 ) |
| 1898 | { |
| 1899 | // Fetch module definition. |
| 1900 | ModuleDefinition* pModuleDefinition = mModulesLoaded.begin()->mpModuleDefinition; |
| 1901 | |
| 1902 | // Unload explicit module. |
| 1903 | unloadModuleExplicit( pModuleDefinition->getModuleId() ); |
| 1904 | } |
| 1905 | |
| 1906 | // Iterate modules to delete module definitions. |
| 1907 | for ( typeModuleIdDatabaseHash::iterator moduleItr = mModuleIdDatabase.begin(); moduleItr != mModuleIdDatabase.end(); ++moduleItr ) |
| 1908 | { |
| 1909 | // Fetch modules definitions. |
| 1910 | ModuleDefinitionEntry* pDefinitions = moduleItr->value; |
| 1911 | |
| 1912 | // Iterate module definitions. |
| 1913 | for ( ModuleDefinitionEntry::iterator definitionItr = pDefinitions->begin(); definitionItr != pDefinitions->end(); ++definitionItr ) |
| 1914 | { |
| 1915 | // Fetch module definition. |
| 1916 | ModuleDefinition* pModuleDefinition = *definitionItr; |
| 1917 | |
| 1918 | // Remove notification before we delete it. |
| 1919 | clearNotify( pModuleDefinition ); |
| 1920 | |
| 1921 | // Delete module definition. |
| 1922 | pModuleDefinition->deleteObject(); |
| 1923 | } |
| 1924 | |
| 1925 | // Clear definitions. |
| 1926 | delete pDefinitions; |
| 1927 | } |
| 1928 | |
| 1929 | // Clear database. |
| 1930 | mModuleIdDatabase.clear(); |
| 1931 | |
| 1932 | // Iterate module groups. |
| 1933 | for ( typeGroupModuleHash::iterator moduleGroupItr = mGroupModules.begin(); moduleGroupItr != mGroupModules.end(); ++moduleGroupItr ) |
| 1934 | { |
| 1935 | // Delete module group vector. |
| 1936 | delete moduleGroupItr->value; |
| 1937 | } |
| 1938 | |
| 1939 | // Clear module groups. |
| 1940 | mGroupModules.clear(); |
| 1941 | } |
nothing calls this directly
no test coverage detected