| 54 | } |
| 55 | |
| 56 | void ModuleRegistry::registerModule(const RegisterableModulePtr& module) |
| 57 | { |
| 58 | assert(module); // don't take NULL module pointers |
| 59 | |
| 60 | if (_modulesInitialised) |
| 61 | { |
| 62 | // The train has left, this module is registered too late |
| 63 | throw std::logic_error( |
| 64 | "ModuleRegistry: module " + module->getName() + |
| 65 | " registered after initialisation." |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | // Check the compatibility level of this module against our internal one |
| 70 | if (module->getCompatibilityLevel() != getCompatibilityLevel()) |
| 71 | { |
| 72 | rError() << "ModuleRegistry: Incompatible module rejected: " << module->getName() << |
| 73 | " (module level: " << module->getCompatibilityLevel() << ", registry level: " << |
| 74 | getCompatibilityLevel() << ")" << std::endl; |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | // Add this module to the list of uninitialised ones |
| 79 | std::pair<ModulesMap::iterator, bool> result = _uninitialisedModules.insert( |
| 80 | ModulesMap::value_type(module->getName(), module) |
| 81 | ); |
| 82 | |
| 83 | // Don't allow modules with the same name being added twice |
| 84 | if (!result.second) |
| 85 | { |
| 86 | throw std::logic_error( |
| 87 | "ModuleRegistry: multiple modules named " + module->getName() |
| 88 | ); |
| 89 | } |
| 90 | |
| 91 | rMessage() << "Module registered: " << module->getName() << std::endl; |
| 92 | } |
| 93 | |
| 94 | // Initialise the module (including dependencies, if necessary) |
| 95 | void ModuleRegistry::initialiseModuleRecursive(const std::string& name) |
no test coverage detected