MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / unloadModuleExplicit

Method unloadModuleExplicit

Engine/source/module/moduleManager.cpp:823–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

821//-----------------------------------------------------------------------------
822
823bool ModuleManager::unloadModuleExplicit( const char* pModuleId )
824{
825 // Lock database.
826 LockDatabase( this );
827
828 // Sanity!
829 AssertFatal( pModuleId != NULL, "Cannot unload explicit module Id with NULL module Id." );
830
831 typeModuleLoadEntryVector moduleResolvingQueue;
832 typeModuleLoadEntryVector moduleReadyQueue;
833
834 // Fetch module Id.
835 StringTableEntry moduleId = StringTable->insert( pModuleId );
836
837 // Fetch modules definitions.
838 ModuleDefinitionEntry* pDefinitions = findModuleId( moduleId );
839
840 // Did we find the module Id?
841 if ( pDefinitions == NULL )
842 {
843 // No, so warn.
844 Con::warnf( "Module Manager: Cannot unload explicit module Id '%s' as it does not exist.", moduleId );
845 return false;
846 }
847
848 // Find if the module is actually loaded.
849 ModuleDefinition* pLoadedModule = findLoadedModule( moduleId );
850
851 // Is the module loaded?
852 if ( pLoadedModule == NULL )
853 {
854 // No, so warn.
855 Con::warnf( "Module Manager: Cannot unload explicit module Id '%s' as it is not loaded.", moduleId );
856 return false;
857 }
858
859 // Fetch module group.
860 StringTableEntry moduleGroup = pDefinitions->mModuleGroup;
861
862 // Info.
863 if ( mEchoInfo )
864 {
865 Con::printSeparator();
866 Con::printf( "Module Manager: Unloading explicit module Id '%s':" , moduleId );
867 }
868
869 // Finish if we could not resolve the dependencies for module Id (of any version Id).
870 if ( !resolveModuleDependencies( moduleId, pLoadedModule->getVersionId(), moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) )
871 return false;
872
873 // Check the modules we want to unload to ensure that we do not have incompatible modules loaded already.
874 for ( typeModuleLoadEntryVector::iterator moduleReadyItr = moduleReadyQueue.begin(); moduleReadyItr != moduleReadyQueue.end(); ++moduleReadyItr )
875 {
876 // Fetch load ready module definition.
877 ModuleDefinition* pLoadReadyModuleDefinition = moduleReadyItr->mpModuleDefinition;;
878
879 // Fetch the module Id loaded entry.
880 ModuleLoadEntry* pLoadedModuleEntry = findModuleLoaded( pLoadReadyModuleDefinition->getModuleId() );

Callers 1

Calls 15

LockDatabaseClass · 0.85
warnfFunction · 0.85
printSeparatorFunction · 0.85
printfFunction · 0.85
executefFunction · 0.85
removePathExpandoFunction · 0.85
getVersionIdMethod · 0.80
getModuleIdMethod · 0.80
reduceLoadCountMethod · 0.80
getLoadCountMethod · 0.80
erase_fastMethod · 0.80
isMethodMethod · 0.80

Tested by

no test coverage detected