Refactor to split .h into .h and .cpp pair
This commit is contained in:
26
src/base/router.cpp
Normal file
26
src/base/router.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user