A Discrete-Event Network Simulator
API
qkd-graph.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_H
22 #define QKD_GRAPH_H
23 
24 #include <fstream>
25 #include "ns3/object.h"
26 #include "ns3/gnuplot.h"
27 #include "ns3/core-module.h"
28 #include "ns3/node-list.h"
29 #include "ns3/qkd-control.h"
30 #include <sstream>
31 
32 namespace ns3 {
33 
47  class QKDGraph: public Object {
48  public:
49 
54  static TypeId GetTypeId(void);
55 
65  QKDGraph(
66  Ptr < QKDControl > control,
67  Ptr < Node > src,
68  Ptr < Node > dst,
69  uint32_t bufferID,
70  std::string graphTitle,
71  std::string graphType
72  );
73 
77  virtual~QKDGraph();
78 
82  void InitTotalGraph() const;
83 
87  void PrintGraph();
88 
92  void ProcessMCurrent(uint32_t value);
93 
97  void ProcessMStatus(uint32_t value);
98 
102  void ProcessMThrStatus(uint32_t value);
103 
107  void ProcessMStatusHelpFunction(double time, uint32_t newValue);
108 
109  private:
110 
114 
115  uint32_t m_keymMin;
116  uint32_t m_keymCurrent;
117  uint32_t m_keymMax;
118  uint32_t m_tempMax;
119  uint32_t m_keymThreshold;
120 
121  std::string m_plotFileName;
122  std::string m_plotFileType; //png or svg
125 
136  };
137 }
138 
139 #endif /* QKDGRAPH */
Class to represent a 2D points plot.
Definition: gnuplot.h:118
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition: gnuplot.h:373
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
QKD graphs are implemented to allow straightforward access to QKD buffers' state and convenient monit...
Definition: qkd-graph.h:47
std::string m_plotFileType
Definition: qkd-graph.h:122
Gnuplot2dDataset m_datasetWorkingState_3
Definition: qkd-graph.h:132
Ptr< QKDBuffer > m_buffer
QKDBuffer associated with the QKDGraph.
Definition: qkd-graph.h:111
uint32_t m_keymMax
get some boundaries for the graph
Definition: qkd-graph.h:117
std::string m_plotFileName
output filename
Definition: qkd-graph.h:121
virtual ~QKDGraph()
Destructor.
Definition: qkd-graph.cc:37
Ptr< Node > m_src
source node, info required for graph title
Definition: qkd-graph.h:112
Gnuplot2dDataset m_datasetMaximum
Definition: qkd-graph.h:135
QKDGraph(Ptr< QKDControl > control, Ptr< Node > src, Ptr< Node > dst, uint32_t bufferID, std::string graphTitle, std::string graphType)
Constructor.
Definition: qkd-graph.cc:39
Gnuplot2dDataset m_datasetWorkingState_Mthr
Definition: qkd-graph.h:128
Gnuplot m_gnuplot
Gluplot object settings.
Definition: qkd-graph.h:126
void ProcessMStatus(uint32_t value)
The status of the QKDBuffer changed, so plot it on the graph.
Definition: qkd-graph.cc:287
void ProcessMStatusHelpFunction(double time, uint32_t newValue)
Help function for detection of status change value.
Definition: qkd-graph.cc:251
uint32_t m_keymCurrent
get some boundaries for the graph
Definition: qkd-graph.h:116
Gnuplot2dDataset m_datasetThreshold
Definition: qkd-graph.h:133
uint32_t m_keymMin
get some boundaries for the graph
Definition: qkd-graph.h:115
Gnuplot2dDataset m_datasetWorkingState_0
Definition: qkd-graph.h:129
void InitTotalGraph() const
Initialized function for total graph.
Definition: qkd-graph.cc:229
uint32_t m_keymThreshold
get some boundaries for the graph
Definition: qkd-graph.h:119
static TypeId GetTypeId(void)
Get the type ID.
Definition: qkd-graph.cc:29
Ptr< Node > m_dst
destination node, info required for graph title
Definition: qkd-graph.h:113
void PrintGraph()
Print the graph.
Definition: qkd-graph.cc:191
uint32_t m_graphStatusEntry
temp variable
Definition: qkd-graph.h:124
Gnuplot2dDataset m_datasetWorkingState_1
Definition: qkd-graph.h:130
void ProcessMCurrent(uint32_t value)
MCurrent value of the QKDBuffer changed, so plot it on the graph.
Definition: qkd-graph.cc:235
double m_simulationTime
time value, x-axis
Definition: qkd-graph.h:123
void ProcessMThrStatus(uint32_t value)
The Mthr value of the QKDBuffer changed, so plot it on the graph.
Definition: qkd-graph.cc:243
Gnuplot2dDataset m_dataset
Definition: qkd-graph.h:127
uint32_t m_tempMax
get some boundaries for the graph
Definition: qkd-graph.h:118
Gnuplot2dDataset m_datasetWorkingState_2
Definition: qkd-graph.h:131
Gnuplot2dDataset m_datasetMinimum
Definition: qkd-graph.h:134
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.