A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-graph-manager.h
Go to the documentation of this file.
1/*
2 * Copyright(c) 2020 DOTFEESA www.tk.etf.unsa.ba
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 *
8 * Author: Miralem Mehic <miralem.mehic@ieee.org>
9 */
10
11#ifndef QKD_GRAPH_MANAGER_H
12#define QKD_GRAPH_MANAGER_H
13
14#include <fstream>
15#include <sstream>
16#include <vector>
17#include "ns3/object.h"
18#include "ns3/gnuplot.h"
19#include "ns3/core-module.h"
20#include "ns3/node-list.h"
21#include "qkd-graph.h"
22#include "qkd-control.h"
23#include "qkd-total-graph.h"
24
25namespace ns3 {
26
27/**
28 * @ingroup qkd
29 * @class QKDGraphManager
30 * @brief QKDGraphManager.
31 *
32 * @brief QKDGraphManager is a signleton class used to connect QKDGraphs and
33 * QKDTotalGraph. It uses TraceSources to make connection and make printing
34 * of graphs easier, all graphs are printed using a single function "PrintGraphs".
35 */
36
37class QKDGraph;
38
39class QKDGraphManager : public Object
40{
41public:
42
43 /**
44 * @brief Get the type ID.
45 * @return the object TypeId
46 */
47 static TypeId GetTypeId();
48
49 /**
50 * @brief Destructor
51 */
52 ~QKDGraphManager() override;
53
54 /**
55 * @brief Signelton getInstance function
56 */
58
59 /**
60 * @brief Print graphs
61 */
62 void PrintGraphs();
63
64 /**
65 * @brief Connect new QBuffer/Sbuffer to QKDTotalGraph
66 * @param Ptr<Node> src
67 * @param Ptr<Node> dst
68 * @param uint32_t bufferID
69 * @param uint32_t srcKMSApplicationIndex
70 * @param std::string graphTitle
71 * @param std::string graphType
72 */
78 std::string graphName,
79 std::string graphType,
81 );
82
83 /**
84 * @brief Mcur value changed, so plot it on the graph
85 * @param std::string context
86 * @param uint32_t value
87 */
88 static void ProcessCurrentChange(std::string context, uint32_t value);
89
90 /**
91 * @brief Status changed, so plot it on the graph
92 * @param std::string context
93 * @param uint32_t value
94 */
95 static void ProcessStatusChange(std::string context, uint32_t value);
96
97 /**
98 * @brief Mthr value changed, so plot it on the graph
99 * @param std::string context
100 * @param uint32_t value
101 */
102 static void ProcessThresholdChange(std::string context, uint32_t value);
103
104 // FOR QKD TOTAL GRAPH
105
106 /**
107 * @brief Mcur value increase, so plot it on the graph
108 * @param std::string context
109 * @param uint32_t value
110 */
111 static void ProcessCurrentIncrease(std::string context, uint32_t value);
112
113 /**
114 * @brief Mcur value decreased, so plot it on the graph
115 * @param std::string context
116 * @param uint32_t value
117 */
118 static void ProcessCurrentDecrease(std::string context, uint32_t value);
119
120 /**
121 * @brief Mthr value increased, so plot it on the graph
122 * @param std::string context
123 * @param uint32_t value
124 */
125 static void ProcessThresholdIncrease(std::string context, uint32_t value);
126
127 /**
128 * @brief Mthr value decreased, so plot it on the graph
129 * @param std::string context
130 * @param uint32_t value
131 */
132 static void ProcessThresholdDecrease(std::string context, uint32_t value);
133
134 /**
135 * @brief Temp function, forward value form trace source to the graph in the list
136 * @param uint32_t& nodeID
137 * @param uint32_t& bufferID
138 * @param uint32_t& value
139 */
141
142 /**
143 * @brief Temp function, forward value form trace source to the graph in the list
144 * @param uint32_t& nodeID
145 * @param uint32_t& bufferID
146 * @param uint32_t& value
147 */
149
150 /**
151 * @brief Temp function, forward value form trace source to the graph in the list
152 * @param uint32_t& nodeID
153 * @param uint32_t& bufferID
154 * @param uint32_t& value
155 */
157
158 /**
159 * @brief Return Ptr to QKDTotalGraph
160 * @return Ptr<QKDTotalGraph>
161 */
163
164private:
165
167
168 static bool instanceFlag; //!< check whether object exists
169
171
172 static Ptr<QKDTotalGraph> m_totalGraph; //!< Ptr to QKDTotalGraph
173
174 std::vector<std::vector<Ptr<QKDGraph > > > m_graphs; //vector of nodes-device-channels
175};
176}
177#endif /* QKD_GRAPH_MANAGER */
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
static void ProcessCurrentChange(std::string context, uint32_t value)
Mcur value changed, so plot it on the graph.
static QKDGraphManager * single
static QKDGraphManager * getInstance()
Signelton getInstance function.
~QKDGraphManager() override
Destructor.
static void ProcessThresholdDecrease(std::string context, uint32_t value)
Mthr value decreased, so plot it on the graph.
Ptr< QKDTotalGraph > GetTotalGraph()
Return Ptr to QKDTotalGraph.
void SendCurrentChangeValueToGraph(const uint32_t &nodeID, const uint32_t &bufferID, const uint32_t &value)
Temp function, forward value form trace source to the graph in the list.
std::vector< std::vector< Ptr< QKDGraph > > > m_graphs
static Ptr< QKDTotalGraph > m_totalGraph
Ptr to QKDTotalGraph.
void SendStatusValueToGraph(const uint32_t &nodeID, const uint32_t &bufferID, const uint32_t &value)
Temp function, forward value form trace source to the graph in the list.
void SendThresholdValueToGraph(const uint32_t &nodeID, const uint32_t &bufferID, const uint32_t &value)
Temp function, forward value form trace source to the graph in the list.
static void ProcessThresholdIncrease(std::string context, uint32_t value)
Mthr value increased, so plot it on the graph.
static void ProcessCurrentDecrease(std::string context, uint32_t value)
Mcur value decreased, so plot it on the graph.
static void ProcessCurrentIncrease(std::string context, uint32_t value)
Mcur value increase, so plot it on the graph.
static bool instanceFlag
check whether object exists
static void ProcessThresholdChange(std::string context, uint32_t value)
Mthr value changed, so plot it on the graph.
static void ProcessStatusChange(std::string context, uint32_t value)
Status changed, so plot it on the graph.
void PrintGraphs()
Print graphs.
static TypeId GetTypeId()
Get the type ID.
void CreateGraphForBuffer(Ptr< Node > srcKMSNode, Ptr< Node > dstKMSNode, uint32_t bufferID, uint32_t srcKMSApplicationIndex, std::string graphName, std::string graphType, Ptr< QBuffer > buff)
Connect new QBuffer/Sbuffer to QKDTotalGraph.
a unique identifier for an interface.
Definition type-id.h:49
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static unsigned int value(char c)