23 #include "ns3/qkd-graph-manager.h"
45 m_totalGraph = CreateObject<QKDTotalGraph> (
"QKD\_Total\_Graph",
"png");
68 for (std::vector<std::vector<QKDGraph *> >::iterator i =
m_graphs.begin();i !=
m_graphs.end(); ++i)
70 for (std::vector<QKDGraph *>::iterator j = i->begin(); j != i->end(); ++j)
86 m_graphs[nodeID][bufferPosition]->ProcessMCurrent(value);
93 m_graphs[nodeID][bufferPosition]->ProcessMStatus(value);
100 m_graphs[nodeID][bufferPosition]->ProcessMThrStatus(value);
108 int bufferPosition=0;
109 std::sscanf(context.c_str(),
"/NodeList/%d/$ns3::QKDControl/BufferList/%d/*", &nodeId, &bufferPosition);
119 int bufferPosition=0;
120 std::sscanf(context.c_str(),
"/NodeList/%d/$ns3::QKDControl/BufferList/%d/*", &nodeId, &bufferPosition);
130 int bufferPosition=0;
131 std::sscanf(context.c_str(),
"/NodeList/%d/$ns3::QKDControl/BufferList/%d/*", &nodeId, &bufferPosition);
170 uint32_t bufferPosition,
171 std::string graphName,
172 std::string graphType
176 uint32_t nodeID = c->GetNode()->GetId();
177 uint32_t nodeMax = nodeID;
178 if(nodeMax < src->GetId()){
179 nodeMax = src->
GetId();
181 if(nodeMax < dst->GetId()){
182 nodeMax = dst->
GetId();
190 m_graphs[nodeID] = std::vector<QKDGraph *> ();
193 if(
m_graphs[nodeID].size() <= bufferPosition){
194 m_graphs[nodeID].resize(bufferPosition+1);
198 std::string graphTypeFilter = (graphType==
"svg" || graphType==
"png" || graphType==
"tex") ? graphType :
"png";
199 m_graphs[nodeID][bufferPosition] =
new QKDGraph (c, src, dst, bufferPosition, graphName, graphTypeFilter);
201 std::ostringstream currentPath;
202 currentPath <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/CurrentChange";
204 std::string query(currentPath.str());
208 std::ostringstream statusPath;
209 statusPath <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/StatusChange";
210 std::string query2(statusPath.str());
214 std::ostringstream MthrPath;
215 MthrPath <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/ThresholdChange";
216 std::string query3 (MthrPath.str());
222 std::ostringstream currentPathIncrease;
223 currentPathIncrease <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/CurrentIncrease";
224 std::string query4(currentPathIncrease.str());
228 std::ostringstream currentPathDecrease;
229 currentPathDecrease <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/CurrentDecrease";
230 std::string query5(currentPathDecrease.str());
234 std::ostringstream currentPathMthrIncrease;
235 currentPathMthrIncrease <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/ThresholdIncrease";
236 std::string query6(currentPathMthrIncrease.str());
240 std::ostringstream currentPathMthrDecrease;
241 currentPathMthrDecrease <<
"/NodeList/" << nodeID <<
"/$ns3::QKDControl/BufferList/" << bufferPosition <<
"/ThresholdDecrease";
242 std::string query7(currentPathMthrDecrease.str());
246 m_graphs[nodeID][bufferPosition]->InitTotalGraph();
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
QKD graphs are implemented to allow straightforward access to QKD buffers' state and convenient monit...
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.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...