27 #include "ns3/abort.h"
28 #include "ns3/assert.h"
29 #include "ns3/config.h"
31 #include "ns3/get-wildcard-matches.h"
40 m_outputFileNameWithoutExtension (
"gnuplot-helper"),
41 m_title (
"Gnuplot Helper Plot"),
42 m_xLegend (
"X Values"),
43 m_yLegend (
"Y Values"),
44 m_terminalType (
"png")
53 const std::string &title,
54 const std::string &xLegend,
55 const std::string &yLegend,
56 const std::string &terminalType)
59 m_outputFileNameWithoutExtension (outputFileNameWithoutExtension),
63 m_terminalType (terminalType)
78 const std::string &title,
79 const std::string &xLegend,
80 const std::string &yLegend,
81 const std::string &terminalType)
84 << xLegend << yLegend << terminalType);
90 " may be destroyed if no references remain.");
106 const std::string &path,
107 const std::string &probeTraceSource,
108 const std::string &title,
111 NS_LOG_FUNCTION (
this << typeId << path << probeTraceSource << title << keyLocation);
125 std::string pathWithoutLastToken;
126 std::string lastToken;
129 bool pathHasNoWildcards = path.find (
"*") == std::string::npos;
132 size_t lastSlash = path.find_last_of (
"/");
133 if (lastSlash == std::string::npos)
135 pathWithoutLastToken = path;
141 pathWithoutLastToken = path.substr (0, lastSlash);
144 lastToken = path.substr (lastSlash + 1, std::string::npos);
150 uint32_t matchCount = matches.
GetN ();
153 std::string matchIdentifier;
156 if (matchCount == 1 && pathHasNoWildcards)
161 matchIdentifier =
"0";
168 else if (matchCount > 0)
171 for (uint32_t i = 0; i < matchCount; i++)
174 std::ostringstream matchIdentifierStream;
175 matchIdentifierStream << i;
176 matchIdentifier = matchIdentifierStream.str ();
180 std::string wildcardSeparator =
" ";
191 title +
"-" + wildcardMatches);
203 const std::string &probeName,
204 const std::string &path)
225 probe->SetName (probeName);
228 probe->ConnectByPath (path);
234 m_probeMap[probeName] = std::make_pair (probe, typeId);
245 NS_ABORT_MSG (
"That time series adaptor has already been added");
252 timeSeriesAdaptor->
Enable ();
262 std::map<std::string, std::pair <Ptr<Probe>, std::string> >::const_iterator mapIterator =
m_probeMap.find (probeName);
267 return mapIterator->second.first;
308 const std::string &matchIdentifier,
309 const std::string &path,
310 const std::string &probeTraceSource,
311 const std::string &title)
313 NS_LOG_FUNCTION (
this << typeId << matchIdentifier << path << probeTraceSource
322 std::ostringstream probeNameStream;
324 std::string probeName = probeNameStream.str ();
327 std::string probeContext = probeName
328 +
"/" + matchIdentifier +
"/" + probeTraceSource;
340 if (
m_probeMap[probeName].second ==
"ns3::DoubleProbe")
342 m_probeMap[probeName].first->TraceConnectWithoutContext
347 else if (
m_probeMap[probeName].second ==
"ns3::BooleanProbe")
349 m_probeMap[probeName].first->TraceConnectWithoutContext
354 else if (
m_probeMap[probeName].second ==
"ns3::PacketProbe")
356 m_probeMap[probeName].first->TraceConnectWithoutContext
361 else if (
m_probeMap[probeName].second ==
"ns3::ApplicationPacketProbe")
363 m_probeMap[probeName].first->TraceConnectWithoutContext
368 else if (
m_probeMap[probeName].second ==
"ns3::Ipv4PacketProbe")
370 m_probeMap[probeName].first->TraceConnectWithoutContext
375 else if (
m_probeMap[probeName].second ==
"ns3::Ipv6PacketProbe")
377 m_probeMap[probeName].first->TraceConnectWithoutContext
382 else if (
m_probeMap[probeName].second ==
"ns3::Uinteger8Probe")
384 m_probeMap[probeName].first->TraceConnectWithoutContext
389 else if (
m_probeMap[probeName].second ==
"ns3::Uinteger16Probe")
391 m_probeMap[probeName].first->TraceConnectWithoutContext
396 else if (
m_probeMap[probeName].second ==
"ns3::Uinteger32Probe")
398 m_probeMap[probeName].first->TraceConnectWithoutContext
405 NS_FATAL_ERROR (
"Unknown probe type " <<
m_probeMap[probeName].second <<
"; need to add support in the helper for this");
409 std::string adaptorTraceSource =
"Output";