A Discrete-Event Network Simulator
API
gnuplot-helper.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 University of Washington
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: Mitch Watrous (watrous@u.washington.edu)
19 */
20
21#ifndef GNUPLOT_HELPER_H
22#define GNUPLOT_HELPER_H
23
24#include <map>
25#include <utility>
26#include <string>
27#include "ns3/object-factory.h"
28#include "ns3/ptr.h"
29#include "ns3/probe.h"
30#include "ns3/gnuplot-aggregator.h"
31#include "ns3/time-series-adaptor.h"
32
33namespace ns3 {
34
40{
41public:
50
66 GnuplotHelper (const std::string &outputFileNameWithoutExtension,
67 const std::string &title,
68 const std::string &xLegend,
69 const std::string &yLegend,
70 const std::string &terminalType = "png");
71
72 virtual ~GnuplotHelper ();
73
90 void ConfigurePlot (const std::string &outputFileNameWithoutExtension,
91 const std::string &title,
92 const std::string &xLegend,
93 const std::string &yLegend,
94 const std::string &terminalType = "png");
95
122 void PlotProbe (const std::string &typeId,
123 const std::string &path,
124 const std::string &probeTraceSource,
125 const std::string &title,
127
133 void AddTimeSeriesAdaptor (const std::string &adaptorName);
134
140 Ptr<Probe> GetProbe (std::string probeName) const;
141
150
151private:
152
160 void AddProbe (const std::string &typeId,
161 const std::string &probeName,
162 const std::string &path);
163
167 void ConstructAggregator ();
168
179 void ConnectProbeToAggregator (const std::string &typeId,
180 const std::string &matchIdentifier,
181 const std::string &path,
182 const std::string &probeTraceSource,
183 const std::string &title);
184
187
190
192 std::map<std::string, std::pair <Ptr<Probe>, std::string> > m_probeMap;
193
195 std::map<std::string, Ptr<TimeSeriesAdaptor> > m_timeSeriesAdaptorMap;
196
199
202
204 std::string m_title;
205
207 std::string m_xLegend;
208
210 std::string m_yLegend;
211
213 std::string m_terminalType;
214
215}; // class GnuplotHelper
216
217
218} // namespace ns3
219
220#endif // GNUPLOT_HELPER_H
KeyLocation
The location of the key in the plot.
Helper class used to make gnuplot plots.
void ConfigurePlot(const std::string &outputFileNameWithoutExtension, const std::string &title, const std::string &xLegend, const std::string &yLegend, const std::string &terminalType="png")
std::string m_title
Title string to use for this plot.
GnuplotHelper()
Constructs a gnuplot helper that will create a space separated gnuplot data file named "gnuplot-helpe...
void AddTimeSeriesAdaptor(const std::string &adaptorName)
Adds a time series adaptor to be used to make the plot.
Ptr< GnuplotAggregator > m_aggregator
The aggregator used to make the plots.
Ptr< Probe > GetProbe(std::string probeName) const
Gets the specified probe.
void PlotProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource, const std::string &title, enum GnuplotAggregator::KeyLocation keyLocation=GnuplotAggregator::KEY_INSIDE)
std::string m_terminalType
Terminal type for the plot.
std::map< std::string, std::pair< Ptr< Probe >, std::string > > m_probeMap
Maps probe names to probes.
std::string m_outputFileNameWithoutExtension
The name of the output file to created without its extension.
uint32_t m_plotProbeCount
Number of plot probes that have been created.
virtual ~GnuplotHelper()
ObjectFactory m_factory
Used to create the probes and collectors as they are added.
std::string m_yLegend
Legend for the y axis.
std::map< std::string, Ptr< TimeSeriesAdaptor > > m_timeSeriesAdaptorMap
Maps time series adaptor names to time series adaptors.
void AddProbe(const std::string &typeId, const std::string &probeName, const std::string &path)
Adds a probe to be used to make the plot.
void ConnectProbeToAggregator(const std::string &typeId, const std::string &matchIdentifier, const std::string &path, const std::string &probeTraceSource, const std::string &title)
Connects the probe to the aggregator.
void ConstructAggregator()
Constructs the aggregator.
std::string m_xLegend
Legend for the x axis.
Ptr< GnuplotAggregator > GetAggregator()
Gets the aggregator.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Every class exported by the ns3 library is enclosed in the ns3 namespace.