MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / registerModule

Method registerModule

radiantcore/modulesystem/ModuleRegistry.cpp:56–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void 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)
95void ModuleRegistry::initialiseModuleRecursive(const std::string& name)

Callers 1

Radiant.cppFile · 0.45

Calls 6

rErrorFunction · 0.85
value_typeClass · 0.85
rMessageFunction · 0.85
getNameMethod · 0.45
getCompatibilityLevelMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected