A Discrete-Event Network Simulator
API
qkd-graph-manager.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 DOTFEESA www.tk.etf.unsa.ba
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Miralem Mehic <miralem.mehic@ieee.org>
19  */
20 
21 #ifndef QKD_GRAPH_MANAGER_H
22 #define QKD_GRAPH_MANAGER_H
23 
24 #include <fstream>
25 #include <sstream>
26 #include <vector>
27 #include "ns3/object.h"
28 #include "ns3/gnuplot.h"
29 #include "ns3/core-module.h"
30 #include "ns3/node-list.h"
31 #include "qkd-graph.h"
32 #include "qkd-control.h"
33 #include "qkd-total-graph.h"
34 
35 namespace ns3 {
36 
47 class QKDGraph;
48 
49 class QKDGraphManager : public Object
50 {
51 public:
52 
57  static TypeId GetTypeId (void);
58 
62  virtual ~QKDGraphManager();
63 
67  static QKDGraphManager* getInstance();
68 
72  void PrintGraphs();
73 
83  void AddQKDBuffer(
84  Ptr<QKDControl> c,
85  Ptr<Node> src,
86  Ptr<Node> dst,
87  uint32_t bufferID,
88  std::string graphName,
89  std::string graphType
90  );
91 
97  static void ProcessCurrentChange(std::string context, uint32_t value);
98 
104  static void ProcessStatusChange(std::string context, uint32_t value);
105 
111  static void ProcessThresholdChange(std::string context, uint32_t value);
112 
113  // FOR QKD TOTAL GRAPH
114 
120  static void ProcessCurrentIncrease(std::string context, uint32_t value);
121 
127  static void ProcessCurrentDecrease(std::string context, uint32_t value);
128 
134  static void ProcessThresholdIncrease(std::string context, uint32_t value);
135 
141  static void ProcessThresholdDecrease(std::string context, uint32_t value);
142 
149  void SendStatusValueToGraph(const uint32_t& nodeID, const uint32_t& bufferID, const uint32_t& value);
150 
157  void SendCurrentChangeValueToGraph(const uint32_t& nodeID, const uint32_t& bufferID, const uint32_t& value);
158 
165  void SendThresholdValueToGraph(const uint32_t& nodeID, const uint32_t& bufferID, const uint32_t& value);
166 
172 
173 private:
174 
176 
177  static bool instanceFlag;
178 
180 
182 
183  std::vector<std::vector<QKDGraph *> > m_graphs; //vector of nodes-device-channels
184 };
185 }
186 #endif /* QKD_GRAPH_MANAGER */
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
QKDGraphManager.
static void ProcessThresholdIncrease(std::string context, uint32_t value)
Mthr value increased, so plot it on the graph.
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.
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.
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 AddQKDBuffer(Ptr< QKDControl > c, Ptr< Node > src, Ptr< Node > dst, uint32_t bufferID, std::string graphName, std::string graphType)
Connect new QKDBuffer to QKDTotalGraph.
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 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
virtual ~QKDGraphManager()
Destructor.
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.
std::vector< std::vector< QKDGraph * > > m_graphs
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.