A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
file-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 FILE_HELPER_H
22 #define FILE_HELPER_H
23 
24 #include <map>
25 #include <string>
26 #include "ns3/object-factory.h"
27 #include "ns3/ptr.h"
28 #include "ns3/probe.h"
29 #include "ns3/file-aggregator.h"
30 #include "ns3/time-series-adaptor.h"
31 
32 namespace ns3 {
33 
38 {
39 public:
44  FileHelper ();
45 
56  FileHelper (const std::string &outputFileNameWithoutExtension,
58 
59  virtual ~FileHelper ();
60 
72  void ConfigureFile (const std::string &outputFileNameWithoutExtension,
74 
100  void WriteProbe (const std::string &typeId,
101  const std::string &path,
102  const std::string &probeTraceSource);
103 
111  void AddProbe (const std::string &typeId,
112  const std::string &probeName,
113  const std::string &path);
114 
120  void AddTimeSeriesAdaptor (const std::string &adaptorName);
121 
130  void AddAggregator (const std::string &aggregatorName,
131  const std::string &outputFileName,
132  bool onlyOneAggregator);
133 
139  Ptr<Probe> GetProbe (std::string probeName) const;
140 
148 
158  Ptr<FileAggregator> GetAggregatorMultiple (const std::string &aggregatorName,
159  const std::string &outputFileName);
160 
170  void SetHeading (const std::string &heading);
171 
178  void Set1dFormat (const std::string &format);
179 
186  void Set2dFormat (const std::string &format);
187 
194  void Set3dFormat (const std::string &format);
195 
202  void Set4dFormat (const std::string &format);
203 
210  void Set5dFormat (const std::string &format);
211 
218  void Set6dFormat (const std::string &format);
219 
226  void Set7dFormat (const std::string &format);
227 
234  void Set8dFormat (const std::string &format);
235 
242  void Set9dFormat (const std::string &format);
243 
250  void Set10dFormat (const std::string &format);
251 
252 private:
268  void ConnectProbeToAggregator (const std::string &typeId,
269  const std::string &matchIdentifier,
270  const std::string &path,
271  const std::string &probeTraceSource,
272  const std::string &outputFileNameWithoutExtension,
273  bool onlyOneAggregator);
274 
277 
280 
283  std::map<std::string, Ptr<FileAggregator> > m_aggregatorMap;
284 
286  std::map<std::string, std::pair <Ptr<Probe>, std::string> > m_probeMap;
287 
289  std::map<std::string, Ptr<TimeSeriesAdaptor> > m_timeSeriesAdaptorMap;
290 
293 
296 
299 
302 
304  std::string m_heading;
305 
307  std::string m_1dFormat;
308  std::string m_2dFormat;
309  std::string m_3dFormat;
310  std::string m_4dFormat;
311  std::string m_5dFormat;
312  std::string m_6dFormat;
313  std::string m_7dFormat;
314  std::string m_8dFormat;
315  std::string m_9dFormat;
316  std::string m_10dFormat;
317 
318 }; // class FileHelper
319 
320 
321 } // namespace ns3
322 
323 #endif // FILE_HELPER_H