A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
data-collector.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 Drexel University
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Joe Kopena (tjkopena@cs.drexel.edu)
19
*/
20
21
#include "ns3/object.h"
22
#include "ns3/log.h"
23
24
#include "
data-collector.h
"
25
#include "
data-calculator.h
"
26
27
using namespace
ns3;
28
29
NS_LOG_COMPONENT_DEFINE
(
"DataCollector"
);
30
31
//--------------------------------------------------------------
32
//----------------------------------------------
33
DataCollector::DataCollector
() {
34
NS_LOG_FUNCTION_NOARGS
();
35
// end DataCollector::DataCollector
36
}
37
38
DataCollector::~DataCollector
() {
39
NS_LOG_FUNCTION_NOARGS
();
40
// end DataCollector::~DataCollector
41
}
42
43
void
DataCollector::DoDispose
() {
44
NS_LOG_FUNCTION_NOARGS
();
45
46
m_calcList
.clear ();
47
m_metadata
.clear ();
48
49
Object::DoDispose
();
50
// end DataCollector::DoDispose
51
}
52
53
void
54
DataCollector::DescribeRun
(std::string experiment,
55
std::string strategy,
56
std::string input,
57
std::string runID,
58
std::string description)
59
{
60
61
m_experimentLabel
= experiment;
62
m_strategyLabel
= strategy;
63
m_inputLabel
= input;
64
m_runLabel
= runID;
65
m_description
= description;
66
67
// end DataCollector::DescribeRun
68
}
69
70
void
71
DataCollector::AddDataCalculator
(
Ptr<DataCalculator>
datac)
72
{
73
74
m_calcList
.push_back (datac);
75
76
// end DataCollector::AddDataCalculator
77
}
78
79
DataCalculatorList::iterator
80
DataCollector::DataCalculatorBegin
()
81
{
82
return
m_calcList
.begin ();
83
// end DataCollector::DataCalculatorBegin
84
}
85
DataCalculatorList::iterator
86
DataCollector::DataCalculatorEnd
()
87
{
88
return
m_calcList
.end ();
89
// end DataCollector::DataCalculatorEnd
90
}
91
92
void
93
DataCollector::AddMetadata
(std::string key, std::string value)
94
{
95
std::pair<std::string, std::string> blob (key, value);
96
m_metadata
.push_back (blob);
97
// end DataCollector::AddMetadata
98
}
99
void
100
DataCollector::AddMetadata
(std::string key, uint32_t value)
101
{
102
std::stringstream st;
103
st << value;
104
105
std::pair<std::string, std::string> blob (key, st.str ());
106
m_metadata
.push_back (blob);
107
// end DataCollector::AddMetadata
108
}
109
void
110
DataCollector::AddMetadata
(std::string key,
double
value)
111
{
112
std::stringstream st;
113
st << value;
114
115
std::pair<std::string, std::string> blob (key, st.str ());
116
m_metadata
.push_back (blob);
117
// end DataCollector::AddMetadata
118
}
119
120
MetadataList::iterator
121
DataCollector::MetadataBegin
()
122
{
123
return
m_metadata
.begin ();
124
// end DataCollector::MetadataBegin
125
}
126
MetadataList::iterator
127
DataCollector::MetadataEnd
()
128
{
129
return
m_metadata
.end ();
130
// end DataCollector::MetadataEnd
131
}
src
stats
model
data-collector.cc
Generated on Tue Oct 9 2012 16:45:46 for ns-3 by
1.8.1.2