feat: implement module access in engine API
- Add implementation for `getModule` - Add implementation for `getLoadedModules`
This commit is contained in:
@@ -59,7 +59,28 @@ MscEventBus &MscEngine::getBus()
|
||||
return _bus;
|
||||
}
|
||||
|
||||
UNIMPL MscEngine::getLoadedModules() const
|
||||
std::unordered_map<std::string, std::uint16_t> MscEngine::getLoadedModules() const
|
||||
{
|
||||
throw std::runtime_error("Unimplemented");
|
||||
std::unordered_map<std::string, std::uint16_t> result;
|
||||
for (const auto &module : _modules)
|
||||
{
|
||||
if (!module)
|
||||
continue;
|
||||
|
||||
auto mod = module.get();
|
||||
result[mod->getName()] = mod->getRev();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
MscEngineModule &MscEngine::getModule(const std::string &name)
|
||||
{
|
||||
for (auto &module : _modules)
|
||||
{
|
||||
if (module.get()->getName() == name)
|
||||
return *module.get();
|
||||
}
|
||||
|
||||
throw std::runtime_error("Module not found: " + name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user