| 458 | //----------------------------------------------------------------------------- |
| 459 | |
| 460 | bool ModuleManager::unloadModuleGroup( const char* pModuleGroup ) |
| 461 | { |
| 462 | // Lock database. |
| 463 | LockDatabase( this ); |
| 464 | |
| 465 | // Sanity! |
| 466 | AssertFatal( pModuleGroup != NULL, "Cannot unload module group with NULL group name." ); |
| 467 | |
| 468 | typeModuleLoadEntryVector moduleResolvingQueue; |
| 469 | typeModuleLoadEntryVector moduleReadyQueue; |
| 470 | |
| 471 | // Fetch module group. |
| 472 | StringTableEntry moduleGroup = StringTable->insert( pModuleGroup ); |
| 473 | |
| 474 | // Info. |
| 475 | if ( mEchoInfo ) |
| 476 | { |
| 477 | Con::printSeparator(); |
| 478 | Con::printf( "Module Manager: Unloading group '%s':" , moduleGroup ); |
| 479 | } |
| 480 | |
| 481 | // Find the group loaded iterator. |
| 482 | typeGroupVector::iterator groupLoadedItr = findGroupLoaded( moduleGroup ); |
| 483 | |
| 484 | // Is the module group already unloaded? |
| 485 | if ( groupLoadedItr == NULL ) |
| 486 | { |
| 487 | // No, so warn. |
| 488 | Con::warnf( "Module Manager: Cannot unload group '%s' as it is not loaded.", moduleGroup ); |
| 489 | return false; |
| 490 | } |
| 491 | |
| 492 | // Find module group. |
| 493 | typeGroupModuleHash::iterator moduleGroupItr = mGroupModules.find( moduleGroup ); |
| 494 | |
| 495 | // Did we find the module group? |
| 496 | if ( moduleGroupItr == mGroupModules.end() ) |
| 497 | { |
| 498 | // No, so info. |
| 499 | if ( mEchoInfo ) |
| 500 | { |
| 501 | Con::printf( "Module Manager: No modules found for module group '%s'.", moduleGroup ); |
| 502 | return true; |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | // Yes, so fetch the module Ids. |
| 507 | typeModuleIdVector* pModuleIds = moduleGroupItr->value; |
| 508 | |
| 509 | // Iterate module groups. |
| 510 | for( typeModuleIdVector::iterator moduleIdItr = pModuleIds->begin(); moduleIdItr != pModuleIds->end(); ++moduleIdItr ) |
| 511 | { |
| 512 | // Fetch module Id. |
| 513 | StringTableEntry moduleId = *moduleIdItr; |
| 514 | |
| 515 | // Finish if we could not resolve the dependencies for module Id (of any version Id). |
| 516 | if ( !resolveModuleDependencies( moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) ) |
| 517 | return false; |
no test coverage detected