refactor: Move module type string into modules

This allows us to identify module by their type and it is also better to
store the module type as part of the module instead of having it
hardcoded in factory.hpp
This commit is contained in:
patrick96 2020-05-15 19:59:08 +02:00 committed by Patrick Ziegler
parent 06012af3aa
commit d592eea966
30 changed files with 137 additions and 89 deletions
src/components

View file

@ -422,7 +422,7 @@ void controller::process_inputdata() {
// Forwards the action to all input handlers that match the name
for (auto&& handler : m_inputhandlers) {
if (handler->input_handler_name() == handler_name) {
if(!handler->input(string{action})) {
if (!handler->input(string{action})) {
m_log.warn("The '%s' module does not support the '%s' action.", handler_name, action);
}
@ -432,9 +432,8 @@ void controller::process_inputdata() {
if (num_delivered == 0) {
m_log.err("There exists no input handler with name '%s' (input: %s)", handler_name, cmd);
}
else {
m_log.info("Delivered input to %d input handler%s", num_delivered, num_delivered > 1? "s": "");
} else {
m_log.info("Delivered input to %d input handler%s", num_delivered, num_delivered > 1 ? "s" : "");
}
return;
@ -600,7 +599,7 @@ size_t controller::setup_modules(alignment align) {
try {
auto type = m_conf.get("module/" + module_name, "type");
if (type == "custom/ipc" && !m_ipc) {
if (type == ipc_module::TYPE && !m_ipc) {
throw application_error("Inter-process messaging needs to be enabled");
}