-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetworkBehavior.hpp
42 lines (30 loc) · 1.01 KB
/
NetworkBehavior.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef DYNAMICNETWORK_HPP
#define DYNAMICNETWORK_HPP
#include <omnetpp.h>
#include <set>
#include <tuple>
#include <string>
using namespace omnetpp;
class NetworkBehavior : public cSimpleModule
{
public:
NetworkBehavior();
protected:
double linkDelay;
double partitionMinTime, partitionMaxTime,
endPartitionMinTime, endPartitionMaxTime;
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void handleNetworkEvent(cMessage *msg);
virtual std::set<std::tuple<std::string,std::string>> handleEvent_partition() = 0;
virtual void handleEvent_endPartition(std::set<std::tuple<std::string,std::string>> gates) = 0;
private:
double stopEventTime;
enum class NetworkEvent {
PARTITION,
END_PARTITION
};
std::string ne_toString(NetworkEvent ne);
NetworkEvent ne_fromString(std::string ne);
};
#endif /* DYNAMICNETWORK_HPP */