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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Joe Kopena (tjkopena@cs.drexel.edu)
7 */
8
9#ifndef DATA_OUTPUT_INTERFACE_H
10#define DATA_OUTPUT_INTERFACE_H
11
12#include "data-calculator.h"
13
14#include "ns3/nstime.h"
15#include "ns3/object.h"
16
17namespace ns3
18{
19
20class DataCollector;
21
22//------------------------------------------------------------
23//--------------------------------------------
24/**
25 * \ingroup dataoutput
26 *
27 * \brief Abstract Data Output Interface class
28s */
30{
31 public:
33 ~DataOutputInterface() override;
34
35 /**
36 * Register this type.
37 * \return The TypeId.
38 */
39 static TypeId GetTypeId();
40
41 /**
42 * Outputs information from the provided DataCollector
43 * \param dc DataCollector object
44 */
45 virtual void Output(DataCollector& dc) = 0;
46
47 /**
48 * Sets the DataOutputInterface prefix to the provided prefix
49 * \param prefix prefix as a string
50 */
51 void SetFilePrefix(const std::string prefix);
52 /**
53 * Gets the file prefix of the DataOutputInterface
54 * \return File prefix as a string
55 */
56 std::string GetFilePrefix() const;
57
58 protected:
59 void DoDispose() override;
60
61 std::string m_filePrefix; //!< File prefix for the DataOutputInterface
62
63 // end class DataOutputInterface
64};
65
66/**
67 * \ingroup dataoutput
68 *
69 * \brief Callback class for the DataOutput classes
70 *
71 */
73{
74 public:
75 /**
76 * Destructor
77 */
79 {
80 }
81
82 /**
83 * Outputs the data from the specified StatisticalSummary
84 * \param key Key value of a DataCalculator
85 * \param variable Name of the variable for which statistics are being provided
86 * \param statSum Pointer to a StatisticalSummary object
87 */
88 virtual void OutputStatistic(std::string key,
89 std::string variable,
90 const StatisticalSummary* statSum) = 0;
91
92 /**
93 * Associates the integer value with the variable name for a specific output format
94 * \param key Key value of a DataCalculator
95 * \param variable Name of the variable for which statistics are being provided
96 * \param val Value to be stored
97 */
98 virtual void OutputSingleton(std::string key, std::string variable, int val) = 0;
99
100 /**
101 * Associates the uint32_t value with the variable name for a specific output format
102 * \param key Key value of a DataCalculator
103 * \param variable Name of the variable for which statistics are being provided
104 * \param val Value to be stored
105 */
106 virtual void OutputSingleton(std::string key, std::string variable, uint32_t val) = 0;
107
108 /**
109 * Associates the double value with the variable name for a specific output format
110 * \param key Key value of a DataCalculator
111 * \param variable Name of the variable for which statistics are being provided
112 * \param val Value to be stored
113 */
114 virtual void OutputSingleton(std::string key, std::string variable, double val) = 0;
115
116 /**
117 * Associates the string value with the variable name for a specific output format
118 * \param key Key value of a DataCalculator
119 * \param variable Name of the variable for which statistics are being provided
120 * \param val Value to be stored
121 */
122 virtual void OutputSingleton(std::string key, std::string variable, std::string val) = 0;
123
124 /**
125 * Associates the Time value with the variable name for a specific output format
126 * \param key Key value of a DataCalculator
127 * \param variable Name of the variable for which statistics are being provided
128 * \param val Value to be stored
129 */
130 virtual void OutputSingleton(std::string key, std::string variable, Time val) = 0;
131 // end class DataOutputCallback
132};
133
134// end namespace ns3
135}; // namespace ns3
136
137#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:78
Abstract class for calculating statistical data.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.