forked from nsnam/ns-3-dev-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata-collector.h
164 lines (146 loc) · 4.84 KB
/
data-collector.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 Drexel University
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Joe Kopena ([email protected])
*/
#ifndef DATA_COLLECTOR_H
#define DATA_COLLECTOR_H
#include <list>
#include <string>
#include "ns3/object.h"
namespace ns3 {
class DataCalculator;
//------------------------------------------------------------
//--------------------------------------------
/**
* List of Ptrs to DataCalculator objects
*/
typedef std::list<Ptr<DataCalculator> > DataCalculatorList;
/**
* List of pairs of strings representing metadata
*/
typedef std::list<std::pair<std::string, std::string> > MetadataList;
/**
* \ingroup dataoutput
* \class DataCollector
* \brief Collects data
*/
class DataCollector : public Object {
public:
DataCollector();
virtual ~DataCollector();
/**
* Register this type.
* \return The TypeId.
*/
static TypeId GetTypeId (void);
/**
* Provide specific parameters to the DataCollector
* \param experiment Label for the experiment
* \param strategy Label for the strategy
* \param input Label for the input
* \param runID Label for the runID
* \param description Description
*/
void DescribeRun (std::string experiment,
std::string strategy,
std::string input,
std::string runID,
std::string description = "");
/**
* Return the experiment label
* \return Experiment label
*/
std::string GetExperimentLabel () const { return m_experimentLabel; }
/**
* Return the strategy label
* \return Strategy label
*/
std::string GetStrategyLabel () const { return m_strategyLabel; }
/**
* Return the input label
* \return Input label
*/
std::string GetInputLabel () const { return m_inputLabel; }
/**
* Return the runID label
* \return Run label
*/
std::string GetRunLabel () const { return m_runLabel; }
/**
* Return the description label
* \return Description label
*/
std::string GetDescription () const { return m_description; }
/**
* Add the key and the value as a pair of strings to the metadata list
* \param key Key value to include
* \param value Value to include of type string
*/
void AddMetadata (std::string key, std::string value);
/**
* Add the key and the value as a pair of strings to the metadata list
* \param key Key value to include
* \param value Value to include of type double
*/
void AddMetadata (std::string key, double value);
/**
* Add the key and the value as a pair of strings to the metadata list
* \param key Key value to include
* \param value Value to include of type uint32_t
*/
void AddMetadata (std::string key, uint32_t value);
/**
* Returns an iterator to the beginning of the metadata list
* \return Iterator pointing to the first value of the metadata list
*/
MetadataList::iterator MetadataBegin ();
/**
* Returns an iterator to the past-the-end of the metadata list
* \return Iterator pointing to the past-the-end element of the metadata list
*/
MetadataList::iterator MetadataEnd ();
/**
* Add a DataCalculator object to the DataCollector
* \param datac DataCalculator object to be added
*/
void AddDataCalculator (Ptr<DataCalculator> datac);
/**
* Returns an iterator to the beginning of the DataCalculator list
* \return Iterator pointing to the first value of the DataCalculator list
*/
DataCalculatorList::iterator DataCalculatorBegin ();
/**
* Returns an iterator to the past-the-end of the DataCalculator list
* \return Iterator pointing to the past-the-end element of the DataCalculator list
*/
DataCalculatorList::iterator DataCalculatorEnd ();
protected:
virtual void DoDispose ();
private:
std::string m_experimentLabel; //!< Experiment label
std::string m_strategyLabel; //!< Strategy label
std::string m_inputLabel; //!< Input label
std::string m_runLabel; //!< Run label
std::string m_description; //!< Description label
MetadataList m_metadata; //!< List of experiment metadata
DataCalculatorList m_calcList; //!< List of data calculators
// end class DataCollector
};
// end namespace ns3
};
#endif /* DATA_COLLECTOR_H */