ConflictGraph.h Source File

Simu5G: ConflictGraph.h Source File
Simu5G
ConflictGraph.h
1//
2// Simu5G
3//
4// Copyright (C) 2012-2021 Giovanni Nardini, Giovanni Stea, Antonio Virdis et al. (University of Pisa)
5// Copyright (C) 2022-2026 Giovanni Nardini, Giovanni Stea et al. (University of Pisa)
6//
7// This file is part of a software released under the license included in file
8// "license.pdf". Please read LICENSE and README files before using it.
9// The above files and the present reference are part of the software itself,
10// and cannot be removed from it.
11//
12
13#ifndef CONFLICTGRAPH_H
14#define CONFLICTGRAPH_H
15
16#include "simu5g/stack/mac/LteMacEnb.h"
17#include "simu5g/common/cellInfo/CellInfo.h"
18
19namespace simu5g {
20
21using namespace omnetpp;
22
23enum CGType
24{
25 CG_DISTANCE,
26 CG_UNKNOWN
27};
28
29/*
30 * Define the structure for graph vertices
31 */
32struct CGVertex
33{
34 MacNodeId srcId;
35 MacNodeId dstId;
36
37 bool operator<(const CGVertex& v1) const
38 {
39 if (srcId < v1.srcId)
40 return true;
41 if ((srcId == v1.srcId) && (dstId < v1.dstId))
42 return true;
43 return false;
44 }
45
46 bool operator==(const CGVertex& v1) const
47 {
48 return (srcId == v1.srcId) && (dstId == v1.dstId);
49 }
50
51 public:
52 CGVertex(MacNodeId src = NODEID_NONE, MacNodeId dst = NODEID_NONE) : srcId(src), dstId(dst)
53 {
54 }
55
56 bool isMulticast() const
57 {
58 return dstId == NODEID_NONE;
59 }
60
61};
62
63inline std::ostream& operator<<(std::ostream& os, const CGVertex& v)
64{
65 os << "src=" << v.srcId << " dst=" << v.dstId;
66 return os;
67}
68
69typedef std::map<CGVertex, std::map<CGVertex, bool>> CGMatrix;
70class CellInfo;
71class LteMacEnb;
72
82class ConflictGraph
83{
84
85 protected:
86 opp_component_ptr<Binder> binder_;
87
88 // Reference to the MAC layer
89 opp_component_ptr<LteMacEnb> macEnb_;
90
91 // Reference to the CellInfo
92 opp_component_ptr<CellInfo> cellInfo_;
93
94 // Conflict Graph
95 CGMatrix conflictGraph_;
96
97 // flag for enabling/disabling sharing models
98 bool reuseD2D_;
99 bool reuseD2DMulti_;
100
101 // reset Conflict Graph
102 virtual void clearConflictGraph();
103
104 virtual void findVertices(std::vector<CGVertex>& vertices) = 0;
105 virtual void findEdges(const std::vector<CGVertex>& vertices) = 0;
106
107 public:
108
109 ConflictGraph(Binder *binder, LteMacEnb *macEnb, bool reuseD2D, bool reuseD2DMulti);
110
111 virtual ~ConflictGraph() {}
112
113 // compute Conflict Graph
114 virtual void computeConflictGraph();
115
116 // print Conflict Graph - for debug
117 virtual void printConflictGraph();
118
119 const CGMatrix *getConflictMatrix() const { return &conflictGraph_; }
120};
121
122} //namespace
123
124#endif /* CONFLICTGRAPH_H */
125
Definition Binder.h:48
There is one CellInfo module for each eNB (thus one for each cell). Keeps cross-layer information abo...
Definition CellInfo.h:30
Definition AlertReceiver.h:24
constexpr MacNodeId NODEID_NONE
MAC node ID.
Definition LteTypes.h:54