A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
33 namespace ns3 {
34 
39 {
40 public:
48  GnuplotHelper ();
49 
65  GnuplotHelper (const std::string &outputFileNameWithoutExtension,
66  const std::string &title,
67  const std::string &xLegend,
68  const std::string &yLegend,
69  const std::string &terminalType = "png");
70 
71  virtual ~GnuplotHelper ();
72 
89  void ConfigurePlot (const std::string &outputFileNameWithoutExtension,
90  const std::string &title,
91  const std::string &xLegend,
92  const std::string &yLegend,
93  const std::string &terminalType = "png");
94 
116  void PlotProbe (const std::string &typeId,
117  const std::string &path,
118  const std::string &probeTraceSource,
119  const std::string &title,
121 
129  void AddProbe (const std::string &typeId,
130  const std::string &probeName,
131  const std::string &path);
132 
138  void AddTimeSeriesAdaptor (const std::string &adaptorName);
139 
145  Ptr<Probe> GetProbe (std::string probeName) const;
146 
154 
155 private:
159  void ConstructAggregator ();
160 
171  void ConnectProbeToAggregator (const std::string &typeId,
172  const std::string &matchIdentifier,
173  const std::string &path,
174  const std::string &probeTraceSource,
175  const std::string &title);
176 
179 
182 
184  std::map<std::string, std::pair <Ptr<Probe>, std::string> > m_probeMap;
185 
187  std::map<std::string, Ptr<TimeSeriesAdaptor> > m_timeSeriesAdaptorMap;
188 
191 
194 
196  std::string m_title;
197 
199  std::string m_xLegend;
200 
202  std::string m_yLegend;
203 
205  std::string m_terminalType;
206 
207 }; // class GnuplotHelper
208 
209 
210 } // namespace ns3
211 
212 #endif // GNUPLOT_HELPER_H