A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
data-output-interface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 Drexel University
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Joe Kopena (tjkopena@cs.drexel.edu)
18 */
19
20#ifndef DATA_OUTPUT_INTERFACE_H
21#define DATA_OUTPUT_INTERFACE_H
22
23#include "data-calculator.h"
24
25#include "ns3/nstime.h"
26#include "ns3/object.h"
27
28namespace ns3
29{
30
31class DataCollector;
32
33//------------------------------------------------------------
34//--------------------------------------------
35/**
36 * \ingroup dataoutput
37 *
38 * \brief Abstract Data Output Interface class
39s */
41{
42 public:
44 ~DataOutputInterface() override;
45
46 /**
47 * Register this type.
48 * \return The TypeId.
49 */
50 static TypeId GetTypeId();
51
52 /**
53 * Outputs information from the provided DataCollector
54 * \param dc DataCollector object
55 */
56 virtual void Output(DataCollector& dc) = 0;
57
58 /**
59 * Sets the DataOutputInterface prefix to the provided prefix
60 * \param prefix prefix as a string
61 */
62 void SetFilePrefix(const std::string prefix);
63 /**
64 * Gets the file prefix of the DataOutputInterface
65 * \return File prefix as a string
66 */
67 std::string GetFilePrefix() const;
68
69 protected:
70 void DoDispose() override;
71
72 std::string m_filePrefix; //!< File prefix for the DataOutputInterface
73
74 // end class DataOutputInterface
75};
76
77/**
78 * \ingroup dataoutput
79 *
80 * \brief Callback class for the DataOutput classes
81 *
82 */
84{
85 public:
86 /**
87 * Destructor
88 */
90 {
91 }
92
93 /**
94 * Outputs the data from the specified StatisticalSummary
95 * \param key Key value of a DataCalculator
96 * \param variable Name of the variable for which statistics are being provided
97 * \param statSum Pointer to a StatisticalSummary object
98 */
99 virtual void OutputStatistic(std::string key,
100 std::string variable,
101 const StatisticalSummary* statSum) = 0;
102
103 /**
104 * Associates the integer value with the variable name for a specific output format
105 * \param key Key value of a DataCalculator
106 * \param variable Name of the variable for which statistics are being provided
107 * \param val Value to be stored
108 */
109 virtual void OutputSingleton(std::string key, std::string variable, int val) = 0;
110
111 /**
112 * Associates the uint32_t value with the variable name for a specific output format
113 * \param key Key value of a DataCalculator
114 * \param variable Name of the variable for which statistics are being provided
115 * \param val Value to be stored
116 */
117 virtual void OutputSingleton(std::string key, std::string variable, uint32_t val) = 0;
118
119 /**
120 * Associates the double value with the variable name for a specific output format
121 * \param key Key value of a DataCalculator
122 * \param variable Name of the variable for which statistics are being provided
123 * \param val Value to be stored
124 */
125 virtual void OutputSingleton(std::string key, std::string variable, double val) = 0;
126
127 /**
128 * Associates the string value with the variable name for a specific output format
129 * \param key Key value of a DataCalculator
130 * \param variable Name of the variable for which statistics are being provided
131 * \param val Value to be stored
132 */
133 virtual void OutputSingleton(std::string key, std::string variable, std::string val) = 0;
134
135 /**
136 * Associates the Time value with the variable name for a specific output format
137 * \param key Key value of a DataCalculator
138 * \param variable Name of the variable for which statistics are being provided
139 * \param val Value to be stored
140 */
141 virtual void OutputSingleton(std::string key, std::string variable, Time val) = 0;
142 // end class DataOutputCallback
143};
144
145// end namespace ns3
146}; // namespace ns3
147
148#endif /* DATA_OUTPUT_INTERFACE_H */
Collects data.
Callback class for the DataOutput classes.
virtual void OutputSingleton(std::string key, std::string variable, uint32_t val)=0
Associates the uint32_t value with the variable name for a specific output format.
virtual ~DataOutputCallback()
Destructor.
virtual void OutputSingleton(std::string key, std::string variable, std::string val)=0
Associates the string value with the variable name for a specific output format.
virtual void OutputStatistic(std::string key, std::string variable, const StatisticalSummary *statSum)=0
Outputs the data from the specified StatisticalSummary.
virtual void OutputSingleton(std::string key, std::string variable, Time val)=0
Associates the Time value with the variable name for a specific output format.
virtual void OutputSingleton(std::string key, std::string variable, double val)=0
Associates the double value with the variable name for a specific output format.
virtual void OutputSingleton(std::string key, std::string variable, int val)=0
Associates the integer value with the variable name for a specific output format.
Abstract Data Output Interface class s.
void DoDispose() override
Destructor implementation.
virtual void Output(DataCollector &dc)=0
Outputs information from the provided DataCollector.
std::string GetFilePrefix() const
Gets the file prefix of the DataOutputInterface.
static TypeId GetTypeId()
Register this type.
std::string m_filePrefix
File prefix for the DataOutputInterface.
void SetFilePrefix(const std::string prefix)
Sets the DataOutputInterface prefix to the provided prefix.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Abstract class for calculating statistical data.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.