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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Joe Kopena (tjkopena@cs.drexel.edu)
7 */
8
9#ifndef DATA_COLLECTOR_H
10#define DATA_COLLECTOR_H
11
12#include "ns3/object.h"
13
14#include <list>
15#include <string>
16
17namespace ns3
18{
19
20class DataCalculator;
21
22//------------------------------------------------------------
23//--------------------------------------------
24/**
25 * List of Ptrs to DataCalculator objects
26 */
27typedef std::list<Ptr<DataCalculator>> DataCalculatorList;
28/**
29 * List of pairs of strings representing metadata
30 */
31typedef std::list<std::pair<std::string, std::string>> MetadataList;
32
33/**
34 * \ingroup dataoutput
35 * \class DataCollector
36 * \brief Collects data
37 */
38class DataCollector : public Object
39{
40 public:
42 ~DataCollector() override;
43
44 /**
45 * Register this type.
46 * \return The TypeId.
47 */
48 static TypeId GetTypeId();
49
50 /**
51 * Provide specific parameters to the DataCollector
52 * \param experiment Label for the experiment
53 * \param strategy Label for the strategy
54 * \param input Label for the input
55 * \param runID Label for the runID
56 * \param description Description
57 */
58 void DescribeRun(std::string experiment,
59 std::string strategy,
60 std::string input,
61 std::string runID,
62 std::string description = "");
63
64 /**
65 * Return the experiment label
66 * \return Experiment label
67 */
68 std::string GetExperimentLabel() const
69 {
70 return m_experimentLabel;
71 }
72
73 /**
74 * Return the strategy label
75 * \return Strategy label
76 */
77 std::string GetStrategyLabel() const
78 {
79 return m_strategyLabel;
80 }
81
82 /**
83 * Return the input label
84 * \return Input label
85 */
86 std::string GetInputLabel() const
87 {
88 return m_inputLabel;
89 }
90
91 /**
92 * Return the runID label
93 * \return Run label
94 */
95 std::string GetRunLabel() const
96 {
97 return m_runLabel;
98 }
99
100 /**
101 * Return the description label
102 * \return Description label
103 */
104 std::string GetDescription() const
105 {
106 return m_description;
107 }
108
109 /**
110 * Add the key and the value as a pair of strings to the metadata list
111 * \param key Key value to include
112 * \param value Value to include of type string
113 */
114 void AddMetadata(std::string key, std::string value);
115 /**
116 * Add the key and the value as a pair of strings to the metadata list
117 * \param key Key value to include
118 * \param value Value to include of type double
119 */
120 void AddMetadata(std::string key, double value);
121 /**
122 * Add the key and the value as a pair of strings to the metadata list
123 * \param key Key value to include
124 * \param value Value to include of type uint32_t
125 */
126 void AddMetadata(std::string key, uint32_t value);
127 /**
128 * Returns an iterator to the beginning of the metadata list
129 * \return Iterator pointing to the first value of the metadata list
130 */
131 MetadataList::iterator MetadataBegin();
132 /**
133 * Returns an iterator to the past-the-end of the metadata list
134 * \return Iterator pointing to the past-the-end element of the metadata list
135 */
136 MetadataList::iterator MetadataEnd();
137
138 /**
139 * Add a DataCalculator object to the DataCollector
140 * \param datac DataCalculator object to be added
141 */
143 /**
144 * Returns an iterator to the beginning of the DataCalculator list
145 * \return Iterator pointing to the first value of the DataCalculator list
146 */
147 DataCalculatorList::iterator DataCalculatorBegin();
148 /**
149 * Returns an iterator to the past-the-end of the DataCalculator list
150 * \return Iterator pointing to the past-the-end element of the DataCalculator list
151 */
152 DataCalculatorList::iterator DataCalculatorEnd();
153
154 protected:
155 void DoDispose() override;
156
157 private:
158 std::string m_experimentLabel; //!< Experiment label
159 std::string m_strategyLabel; //!< Strategy label
160 std::string m_inputLabel; //!< Input label
161 std::string m_runLabel; //!< Run label
162 std::string m_description; //!< Description label
163
164 MetadataList m_metadata; //!< List of experiment metadata
165 DataCalculatorList m_calcList; //!< List of data calculators
166
167 // end class DataCollector
168};
169
170// end namespace ns3
171}; // namespace ns3
172
173#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:78
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
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.