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