Refactor to split .h into .h and .cpp pair

This commit is contained in:
2026-03-27 12:38:31 +01:00
parent c6bcd3a9d7
commit 06495a089f
16 changed files with 1029 additions and 694 deletions

26
src/base/router.cpp Normal file
View File

@@ -0,0 +1,26 @@
// Copyright (C) 2026 Hector van der Aa <hector@h3cx.dev>
// Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "router.h"
namespace router {
int send(const Task& task) {
if (task.target >= MOD_COUNT) {
return 1;
}
module_base* mod = modules[task.target];
if (mod == nullptr) {
return 1;
}
return mod->push(task);
}
int send(module_id target, task_type type, uint32_t data) {
Task t{target, type, data};
return send(t);
}
}

View File

@@ -2,26 +2,12 @@
// Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "base/task.h"
#include "base/module_base.h"
#include "base/modules.h"
namespace router {
int send(const Task& task) {
if (task.target >= MOD_COUNT) {
return 1;
}
module_base* mod = modules[task.target];
if (mod == nullptr) {
return 1;
}
return mod->push(task);
}
int send(module_id target, task_type type, uint32_t data=0) {
Task t{target, type, data};
return send(t);
}
int send(const Task& task);
int send(module_id target, task_type type, uint32_t data = 0);
}