| 640 | //----------------------------------------------------------------------------- |
| 641 | |
| 642 | bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 versionId ) |
| 643 | { |
| 644 | // Lock database. |
| 645 | LockDatabase( this ); |
| 646 | |
| 647 | // Sanity! |
| 648 | AssertFatal( pModuleId != NULL, "Cannot load explicit module Id with NULL module Id." ); |
| 649 | |
| 650 | typeModuleLoadEntryVector moduleResolvingQueue; |
| 651 | typeModuleLoadEntryVector moduleReadyQueue; |
| 652 | |
| 653 | // Fetch module Id. |
| 654 | StringTableEntry moduleId = StringTable->insert( pModuleId ); |
| 655 | |
| 656 | // Fetch modules definitions. |
| 657 | ModuleDefinitionEntry* pDefinitions = findModuleId( moduleId ); |
| 658 | |
| 659 | // Did we find the module Id? |
| 660 | if ( pDefinitions == NULL ) |
| 661 | { |
| 662 | // No, so warn. |
| 663 | Con::warnf( "Module Manager: Cannot load explicit module Id '%s' as it does not exist.", moduleId ); |
| 664 | return false; |
| 665 | } |
| 666 | |
| 667 | // Fetch module group. |
| 668 | StringTableEntry moduleGroup = pDefinitions->mModuleGroup; |
| 669 | |
| 670 | // Info. |
| 671 | if ( mEchoInfo ) |
| 672 | { |
| 673 | Con::printSeparator(); |
| 674 | Con::printf( "Module Manager: Loading explicit module Id '%s' at version Id '%d':", moduleId, versionId ); |
| 675 | } |
| 676 | |
| 677 | // Finish if we could not resolve the dependencies for module Id (of any version Id). |
| 678 | if ( !resolveModuleDependencies( moduleId, versionId, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) ) |
| 679 | return false; |
| 680 | |
| 681 | // Check the modules we want to load to ensure that we do not have incompatible modules loaded already. |
| 682 | for ( typeModuleLoadEntryVector::iterator moduleReadyItr = moduleReadyQueue.begin(); moduleReadyItr != moduleReadyQueue.end(); ++moduleReadyItr ) |
| 683 | { |
| 684 | // Fetch load ready module definition. |
| 685 | ModuleDefinition* pLoadReadyModuleDefinition = moduleReadyItr->mpModuleDefinition; |
| 686 | |
| 687 | // Fetch the module Id loaded entry. |
| 688 | ModuleLoadEntry* pLoadedModuleEntry = findModuleLoaded( pLoadReadyModuleDefinition->getModuleId() ); |
| 689 | |
| 690 | // Did we find a loaded entry? |
| 691 | if ( pLoadedModuleEntry != NULL ) |
| 692 | { |
| 693 | // Yes, so is it the one we need to load? |
| 694 | if ( pLoadedModuleEntry->mpModuleDefinition != pLoadReadyModuleDefinition ) |
| 695 | { |
| 696 | // Yes, so warn. |
| 697 | Con::warnf( "Module Manager: Cannot load explicit module Id '%s' at version Id '%d' as the module Id is already loaded but at version Id '%d'.", |
| 698 | pLoadReadyModuleDefinition->getModuleId(), pLoadReadyModuleDefinition->getVersionId(), pLoadedModuleEntry->mpModuleDefinition->getVersionId() ); |
| 699 | return false; |
no test coverage detected