29 lines
709 B
C
29 lines
709 B
C
|
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include <string>
|
||
|
#include <map>
|
||
|
#include <memory>
|
||
|
|
||
|
#include "actor.h"
|
||
|
#include "module/module.h"
|
||
|
|
||
|
class Router {
|
||
|
public:
|
||
|
Router();
|
||
|
|
||
|
void registerModule(const std::string& key, const std::shared_ptr<Module::Module>& module);
|
||
|
void registerActor(const std::string& key, const std::string& group);
|
||
|
void routeMessage(const std::string& sender, const std::string& body);
|
||
|
|
||
|
private:
|
||
|
typedef std::map<std::string, std::weak_ptr<Module::Module>> Modules;
|
||
|
typedef std::map<std::string, Actor> Actors;
|
||
|
|
||
|
Modules modules;
|
||
|
Actors actors;
|
||
|
std::string defaultGroup;
|
||
|
};
|