| 1 | #include <module_com.h> |
| 2 | |
| 3 | bool ModuleComManager::registerInterface(std::string moduleName, std::string name, void (*handler)(int code, void* in, void* out, void* ctx), void* ctx) { |
| 4 | std::lock_guard<std::mutex> lck(mtx); |
| 5 | if (interfaces.find(name) != interfaces.end()) { |
| 6 | spdlog::error("Tried creating module interface with an existing name: {0}", name); |
| 7 | return false; |
| 8 | } |
| 9 | ModuleComInterface iface; |
| 10 | iface.moduleName = moduleName; |
| 11 | iface.handler = handler; |
| 12 | iface.ctx = ctx; |
| 13 | interfaces[name] = iface; |
| 14 | return true; |
| 15 | } |
| 16 | |
| 17 | bool ModuleComManager::unregisterInterface(std::string name) { |
| 18 | std::lock_guard<std::mutex> lck(mtx); |
no test coverage detected