|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2008 Drexel 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: Joe Kopena (tjkopena@cs.drexel.edu) |
|
19 */ |
|
20 |
|
21 #ifndef __OMNET_DATA_OUTPUT_H__ |
|
22 #define __OMNET_DATA_OUTPUT_H__ |
|
23 |
|
24 #include "ns3/nstime.h" |
|
25 |
|
26 #include "data-output-interface.h" |
|
27 |
|
28 namespace ns3 { |
|
29 |
|
30 |
|
31 //------------------------------------------------------------ |
|
32 //-------------------------------------------- |
|
33 class OmnetDataOutput : public DataOutputInterface { |
|
34 public: |
|
35 OmnetDataOutput(); |
|
36 virtual ~OmnetDataOutput(); |
|
37 |
|
38 virtual void Output(DataCollector &dc); |
|
39 |
|
40 void SetFilePrefix(const std::string prefix); |
|
41 std::string GetFilePrefix() const; |
|
42 |
|
43 protected: |
|
44 virtual void DoDispose(); |
|
45 |
|
46 private: |
|
47 class OmnetOutputCallback : public DataOutputCallback { |
|
48 public: |
|
49 OmnetOutputCallback(std::ostream *scalar); |
|
50 |
|
51 void OutputSingleton(std::string key, |
|
52 std::string variable, |
|
53 int val); |
|
54 |
|
55 void OutputSingleton(std::string key, |
|
56 std::string variable, |
|
57 uint32_t val); |
|
58 |
|
59 void OutputSingleton(std::string key, |
|
60 std::string variable, |
|
61 double val); |
|
62 |
|
63 void OutputSingleton(std::string key, |
|
64 std::string variable, |
|
65 std::string val); |
|
66 |
|
67 void OutputSingleton(std::string key, |
|
68 std::string variable, |
|
69 Time val); |
|
70 |
|
71 private: |
|
72 std::ostream *m_scalar; |
|
73 // end class OmnetOutputCallback |
|
74 }; |
|
75 |
|
76 std::string m_filePrefix; |
|
77 // end class OmnetDataOutput |
|
78 }; |
|
79 |
|
80 // end namespace ns3 |
|
81 }; |
|
82 |
|
83 |
|
84 #endif // __OMNET_DATA_OUTPUT_H__ |