| 255 | //----------------------------------------------------------------------------- |
| 256 | |
| 257 | bool ModuleManager::loadModuleGroup( const char* pModuleGroup ) |
| 258 | { |
| 259 | // Lock database. |
| 260 | LockDatabase( this ); |
| 261 | |
| 262 | // Sanity! |
| 263 | AssertFatal( pModuleGroup != NULL, "Cannot load module group with NULL group name." ); |
| 264 | |
| 265 | typeModuleLoadEntryVector moduleResolvingQueue; |
| 266 | typeModuleLoadEntryVector moduleReadyQueue; |
| 267 | |
| 268 | // Fetch module group. |
| 269 | StringTableEntry moduleGroup = StringTable->insert( pModuleGroup ); |
| 270 | |
| 271 | // Info. |
| 272 | if ( mEchoInfo ) |
| 273 | { |
| 274 | Con::printSeparator(); |
| 275 | Con::printf( "Module Manager: Loading group '%s':" ,moduleGroup ); |
| 276 | } |
| 277 | |
| 278 | // Is the module group already loaded? |
| 279 | if ( findGroupLoaded( moduleGroup ) != NULL ) |
| 280 | { |
| 281 | // Yes, so warn. |
| 282 | Con::warnf( "Module Manager: Cannot load group '%s' as it is already loaded.", moduleGroup ); |
| 283 | return false; |
| 284 | } |
| 285 | |
| 286 | // Find module group. |
| 287 | typeGroupModuleHash::iterator moduleGroupItr = mGroupModules.find( moduleGroup ); |
| 288 | |
| 289 | // Did we find the module group? |
| 290 | if ( moduleGroupItr == mGroupModules.end() ) |
| 291 | { |
| 292 | // No, so info. |
| 293 | if ( mEchoInfo ) |
| 294 | { |
| 295 | Con::printf( "Module Manager: No modules found for module group '%s'.", moduleGroup ); |
| 296 | } |
| 297 | |
| 298 | return true; |
| 299 | } |
| 300 | |
| 301 | // Yes, so fetch the module Ids. |
| 302 | typeModuleIdVector* pModuleIds = moduleGroupItr->value; |
| 303 | |
| 304 | // Iterate module groups. |
| 305 | for( typeModuleIdVector::iterator moduleIdItr = pModuleIds->begin(); moduleIdItr != pModuleIds->end(); ++moduleIdItr ) |
| 306 | { |
| 307 | // Fetch module Id. |
| 308 | StringTableEntry moduleId = *moduleIdItr; |
| 309 | |
| 310 | // Finish if we could not resolve the dependencies for module Id (of any version Id). |
| 311 | if ( !resolveModuleDependencies( moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) ) |
| 312 | return false; |
| 313 | } |
| 314 |
no test coverage detected