SOLA
Loading...
Searching...
No Matches
algorithm_interface.h
1// Copyright The SOLA Contributors
2//
3// Licensed under the MIT License.
4// For details on the licensing terms, see the LICENSE file.
5// SPDX-License-Identifier: MIT
6
7#ifndef MINHTON_ALGORITHMS_ALGORITHM_INTERFACE_H_
8#define MINHTON_ALGORITHMS_ALGORITHM_INTERFACE_H_
9
10#include <memory>
11
12#include "minhton/core/access_container.h"
13#include "minhton/message/message.h"
14#include "minhton/message/types_all.h"
15
16namespace minhton {
17
19public:
20 explicit AlgorithmInterface(std::shared_ptr<AccessContainer> access)
21 : access_(std::move(access)){};
22
23 virtual ~AlgorithmInterface() = default;
24
25 virtual void process(const MessageVariant &msg) = 0;
26
27protected:
28 std::shared_ptr<AccessContainer> access_;
29 void send(const MessageVariant &msg) { access_->send(msg); }
30
31 std::shared_ptr<RoutingInformation> getRoutingInfo() const { return access_->routing_info; }
32
33 NodeInfo getSelfNodeInfo() const { return getRoutingInfo()->getSelfNodeInfo(); }
34};
35
36} // namespace minhton
37
38#endif
Definition algorithm_interface.h:18
Definition node_info.h:24
Definition minhton_watchdog_ns3.cpp:24