A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gnuplot-aggregator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Bucknell University
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: L. Felipe Perrone (perrone@bucknell.edu)
19  *
20  * Modified by: Mitch Watrous (watrous@u.washington.edu)
21  *
22  */
23 
24 #ifndef GNUPLOT_AGGREGATOR_H
25 #define GNUPLOT_AGGREGATOR_H
26 
27 #include <map>
28 #include <string>
29 #include "ns3/gnuplot.h"
30 #include "ns3/data-collection-object.h"
31 
32 namespace ns3 {
33 
38 {
39 public:
42  {
47  };
48 
49  static TypeId GetTypeId ();
50 
62  GnuplotAggregator (const std::string &outputFileNameWithoutExtension);
63 
64  virtual ~GnuplotAggregator ();
65 
66  // Below are hooked to connectors exporting data
67  // They are not overloaded since it confuses the compiler when made
68  // into callbacks
69 
79  void Write2d (std::string context, double x, double y);
80 
92  void Write2dWithXErrorDelta (std::string context,
93  double x,
94  double y,
95  double errorDelta);
96 
108  void Write2dWithYErrorDelta (std::string context,
109  double x,
110  double y,
111  double errorDelta);
112 
125  void Write2dWithXYErrorDelta (std::string context,
126  double x,
127  double y,
128  double xErrorDelta,
129  double yErrorDelta);
130 
131  // Methods to configure the plot
132 
137  void SetTerminal (const std::string &terminal);
138 
142  void SetTitle (const std::string &title);
143 
148  void SetLegend (const std::string &xLegend, const std::string &yLegend);
149 
153  void SetExtra (const std::string &extra);
154 
158  void AppendExtra (const std::string &extra);
159 
160  // Methods for datasets
161 
174  void Add2dDataset (const std::string &dataset, const std::string &title);
175 
182  static void Set2dDatasetDefaultExtra (const std::string &extra);
183 
193  void Set2dDatasetExtra (const std::string &dataset, const std::string &extra);
194 
206  void Write2dDatasetEmptyLine (const std::string &dataset);
207 
213  static void Set2dDatasetDefaultStyle (enum Gnuplot2dDataset::Style style);
214 
224  void Set2dDatasetStyle (const std::string &dataset, enum Gnuplot2dDataset::Style style);
225 
231  static void Set2dDatasetDefaultErrorBars (enum Gnuplot2dDataset::ErrorBars errorBars);
232 
247  void Set2dDatasetErrorBars (const std::string &dataset, enum Gnuplot2dDataset::ErrorBars errorBars);
248 
254  void SetKeyLocation (enum KeyLocation keyLocation);
255 
256 private:
259 
261  std::string m_graphicsFileName;
262 
264  std::string m_title;
265 
267  std::string m_terminal;
268 
270  std::string m_xLegend;
271 
273  std::string m_yLegend;
274 
277  std::string m_extra;
278 
281 
284 
287 
289  std::map<std::string, Gnuplot2dDataset> m_2dDatasetMap;
290 
291 }; // class GnuplotAggregator
292 
293 
294 } // namespace ns3
295 
296 #endif // GNUPLOT_AGGREGATOR_H