SOLA
Loading...
Searching...
No Matches
interface_leave_algorithm.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_LEAVE_LEAVE_ALGORITHM_INTERFACE_H_
8#define MINHTON_ALGORITHMS_LEAVE_LEAVE_ALGORITHM_INTERFACE_H_
9
10#include <memory>
11
12#include "minhton/algorithms/algorithm_interface.h"
13#include "minhton/core/physical_node_info.h"
14#include "minhton/message/message.h"
15
16namespace minhton {
17
19public:
20 explicit LeaveAlgorithmInterface(std::shared_ptr<AccessContainer> access)
21 : AlgorithmInterface(access){};
22
23 ~LeaveAlgorithmInterface() override = default;
24
25 void process(const MessageVariant &msg) override = 0;
26 virtual void initiateSelfDeparture() = 0;
27 virtual bool canLeaveWithoutReplacement() = 0;
28
29 virtual void replaceMyself(const NodeInfo &node_to_replace,
30 std::vector<NodeInfo> neighbors_of_node_to_replace) = 0;
31
32 static std::vector<MessageType> getSupportedMessageTypes() {
33 return {
34 MessageType::kFindReplacement, MessageType::kReplacementAck,
35 MessageType::kReplacementNack, MessageType::kReplacementOffer,
36 MessageType::kReplacementUpdate, MessageType::kSignOffParentRequest,
37 MessageType::kSignOffParentAnswer, MessageType::kLockNeighborRequest,
38 MessageType::kLockNeighborResponse, MessageType::kUnlockNeighbor,
39 };
40 }
41};
42
43} // namespace minhton
44
45#endif
Definition algorithm_interface.h:18
Definition interface_leave_algorithm.h:18
Definition node_info.h:24
Definition minhton_watchdog_ns3.cpp:24