A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
data-collector.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_COLLECTOR_H
21#define DATA_COLLECTOR_H
22
23#include "ns3/object.h"
24
25#include <list>
26#include <string>
27
28namespace ns3
29{
30
31class DataCalculator;
32
33//------------------------------------------------------------
34//--------------------------------------------
35/**
36 * List of Ptrs to DataCalculator objects
37 */
38typedef std::list<Ptr<DataCalculator>> DataCalculatorList;
39/**
40 * List of pairs of strings representing metadata
41 */
42typedef std::list<std::pair<std::string, std::string>> MetadataList;
43
44/**
45 * \ingroup dataoutput
46 * \class DataCollector
47 * \brief Collects data
48 */
49class DataCollector : public Object
50{
51 public:
53 ~DataCollector() override;
54
55 /**
56 * Register this type.
57 * \return The TypeId.
58 */
59 static TypeId GetTypeId();
60
61 /**
62 * Provide specific parameters to the DataCollector
63 * \param experiment Label for the experiment
64 * \param strategy Label for the strategy
65 * \param input Label for the input
66 * \param runID Label for the runID
67 * \param description Description
68 */
69 void DescribeRun(std::string experiment,
70 std::string strategy,
71 std::string input,
72 std::string runID,
73 std::string description = "");
74
75 /**
76 * Return the experiment label
77 * \return Experiment label
78 */
79 std::string GetExperimentLabel() const
80 {
81 return m_experimentLabel;
82 }
83
84 /**
85 * Return the strategy label
86 * \return Strategy label
87 */
88 std::string GetStrategyLabel() const
89 {
90 return m_strategyLabel;
91 }
92
93 /**
94 * Return the input label
95 * \return Input label
96 */
97 std::string GetInputLabel() const
98 {
99 return m_inputLabel;
100 }
101
102 /**
103 * Return the runID label
104 * \return Run label
105 */
106 std::string GetRunLabel() const
107 {
108 return m_runLabel;
109 }
110
111 /**
112 * Return the description label
113 * \return Description label
114 */
115 std::string GetDescription() const
116 {
117 return m_description;
118 }
119
120 /**
121 * Add the key and the value as a pair of strings to the metadata list
122 * \param key Key value to include
123 * \param value Value to include of type string
124 */
125 void AddMetadata(std::string key, std::string value);
126 /**
127 * Add the key and the value as a pair of strings to the metadata list
128 * \param key Key value to include
129 * \param value Value to include of type double
130 */
131 void AddMetadata(std::string key, double value);
132 /**
133 * Add the key and the value as a pair of strings to the metadata list
134 * \param key Key value to include
135 * \param value Value to include of type uint32_t
136 */
137 void AddMetadata(std::string key, uint32_t value);
138 /**
139 * Returns an iterator to the beginning of the metadata list
140 * \return Iterator pointing to the first value of the metadata list
141 */
142 MetadataList::iterator MetadataBegin();
143 /**
144 * Returns an iterator to the past-the-end of the metadata list
145 * \return Iterator pointing to the past-the-end element of the metadata list
146 */
147 MetadataList::iterator MetadataEnd();
148
149 /**
150 * Add a DataCalculator object to the DataCollector
151 * \param datac DataCalculator object to be added
152 */
154 /**
155 * Returns an iterator to the beginning of the DataCalculator list
156 * \return Iterator pointing to the first value of the DataCalculator list
157 */
158 DataCalculatorList::iterator DataCalculatorBegin();
159 /**
160 * Returns an iterator to the past-the-end of the DataCalculator list
161 * \return Iterator pointing to the past-the-end element of the DataCalculator list
162 */
163 DataCalculatorList::iterator DataCalculatorEnd();
164
165 protected:
166 void DoDispose() override;
167
168 private:
169 std::string m_experimentLabel; //!< Experiment label
170 std::string m_strategyLabel; //!< Strategy label
171 std::string m_inputLabel; //!< Input label
172 std::string m_runLabel; //!< Run label
173 std::string m_description; //!< Description label
174
175 MetadataList m_metadata; //!< List of experiment metadata
176 DataCalculatorList m_calcList; //!< List of data calculators
177
178 // end class DataCollector
179};
180
181// end namespace ns3
182}; // namespace ns3
183
184#endif /* DATA_COLLECTOR_H */
Collects data.
std::string m_strategyLabel
Strategy label.
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Register this type.
std::string GetExperimentLabel() const
Return the experiment label.
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
std::string GetDescription() const
Return the description label.
std::string m_experimentLabel
Experiment label.
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
DataCalculatorList m_calcList
List of data calculators.
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.
std::string m_description
Description label.
std::string GetStrategyLabel() const
Return the strategy label.
void AddMetadata(std::string key, std::string value)
Add the key and the value as a pair of strings to the metadata list.
std::string m_inputLabel
Input label.
std::string GetRunLabel() const
Return the runID label.
void AddDataCalculator(Ptr< DataCalculator > datac)
Add a DataCalculator object to the DataCollector.
~DataCollector() override
MetadataList m_metadata
List of experiment metadata.
void DescribeRun(std::string experiment, std::string strategy, std::string input, std::string runID, std::string description="")
Provide specific parameters to the DataCollector.
std::string m_runLabel
Run label.
std::string GetInputLabel() const
Return the input label.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
void experiment(std::string queue_disc_type)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::list< Ptr< DataCalculator > > DataCalculatorList
List of Ptrs to DataCalculator objects.
std::list< std::pair< std::string, std::string > > MetadataList
List of pairs of strings representing metadata.