feat: implement module access in engine API

- Add implementation for `getModule`
- Add implementation for `getLoadedModules`
This commit is contained in:
Samsonium
2026-09-29 13:25:49 +03:00
parent ff0453e81d
commit e756bb1d73
3 changed files with 33 additions and 6 deletions
+23 -2
View File
@@ -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);
}