A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
file-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 FILE_AGGREGATOR_H
25 #define FILE_AGGREGATOR_H
26 
27 #include <fstream>
28 #include <map>
29 #include <string>
30 #include "ns3/data-collection-object.h"
31 
32 namespace ns3 {
33 
38 {
39 public:
41  enum FileType
42  {
47  };
48 
49  static TypeId GetTypeId ();
50 
59  FileAggregator (const std::string &outputFileName,
60  enum FileType fileType = SPACE_SEPARATED);
61 
62  virtual ~FileAggregator ();
63 
71  void SetFileType (enum FileType fileType);
72 
82  void SetHeading (const std::string &heading);
83 
90  void Set1dFormat (const std::string &format);
91 
98  void Set2dFormat (const std::string &format);
99 
106  void Set3dFormat (const std::string &format);
107 
114  void Set4dFormat (const std::string &format);
115 
122  void Set5dFormat (const std::string &format);
123 
130  void Set6dFormat (const std::string &format);
131 
138  void Set7dFormat (const std::string &format);
139 
146  void Set8dFormat (const std::string &format);
147 
154  void Set9dFormat (const std::string &format);
155 
162  void Set10dFormat (const std::string &format);
163 
164  // Below are hooked to connectors exporting data
165  // They are not overloaded since it confuses the compiler when made
166  // into callbacks
167 
174  void Write1d (std::string context,
175  double v1);
176 
184  void Write2d (std::string context,
185  double v1,
186  double v2);
187 
196  void Write3d (std::string context,
197  double v1,
198  double v2,
199  double v3);
200 
210  void Write4d (std::string context,
211  double v1,
212  double v2,
213  double v3,
214  double v4);
215 
226  void Write5d (std::string context,
227  double v1,
228  double v2,
229  double v3,
230  double v4,
231  double v5);
232 
244  void Write6d (std::string context,
245  double v1,
246  double v2,
247  double v3,
248  double v4,
249  double v5,
250  double v6);
251 
264  void Write7d (std::string context,
265  double v1,
266  double v2,
267  double v3,
268  double v4,
269  double v5,
270  double v6,
271  double v7);
272 
286  void Write8d (std::string context,
287  double v1,
288  double v2,
289  double v3,
290  double v4,
291  double v5,
292  double v6,
293  double v7,
294  double v8);
295 
310  void Write9d (std::string context,
311  double v1,
312  double v2,
313  double v3,
314  double v4,
315  double v5,
316  double v6,
317  double v7,
318  double v8,
319  double v9);
320 
336  void Write10d (std::string context,
337  double v1,
338  double v2,
339  double v3,
340  double v4,
341  double v5,
342  double v6,
343  double v7,
344  double v8,
345  double v9,
346  double v10);
347 
348 private:
350  std::string m_outputFileName;
351 
353  std::ofstream m_file;
354 
357 
359  std::string m_separator;
360 
363 
365  std::string m_heading;
366 
368  std::string m_1dFormat;
369  std::string m_2dFormat;
370  std::string m_3dFormat;
371  std::string m_4dFormat;
372  std::string m_5dFormat;
373  std::string m_6dFormat;
374  std::string m_7dFormat;
375  std::string m_8dFormat;
376  std::string m_9dFormat;
377  std::string m_10dFormat;
378 
379 }; // class FileAggregator
380 
381 
382 } // namespace ns3
383 
384 #endif // FILE_AGGREGATOR_H