A Discrete-Event Network Simulator
API
 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 //----------------------------------------------
35  // end DataCollector::DataCollector
36 }
37 
40  // end DataCollector::~DataCollector
41 }
42 
45 
46  m_calcList.clear ();
47  m_metadata.clear ();
48 
50  // end DataCollector::DoDispose
51 }
52 
53 void
55  std::string strategy,
56  std::string input,
57  std::string runID,
58  std::string description)
59 {
60 
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
72 {
73 
74  m_calcList.push_back (datac);
75 
76  // end DataCollector::AddDataCalculator
77 }
78 
79 DataCalculatorList::iterator
81 {
82  return m_calcList.begin ();
83  // end DataCollector::DataCalculatorBegin
84 }
85 DataCalculatorList::iterator
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
122 {
123  return m_metadata.begin ();
124  // end DataCollector::MetadataBegin
125 }
126 MetadataList::iterator
128 {
129  return m_metadata.end ();
130  // end DataCollector::MetadataEnd
131 }
std::string m_strategyLabel
Strategy label.
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
void experiment(bool enableCtsRts)
Run single 10 seconds experiment with enabled or disabled RTS/CTS mechanism.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:336
std::string m_description
Description label.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log.h:309
virtual ~DataCollector()
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
void AddDataCalculator(Ptr< DataCalculator > datac)
Add a DataCalculator object to the DataCollector.
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_experimentLabel
Experiment label.
std::string m_runLabel
Run label.
DataCalculatorList m_calcList
List of data calculators.
std::string m_inputLabel
Input label.
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
void DescribeRun(std::string experiment, std::string strategy, std::string input, std::string runID, std::string description="")
Provide specific parameters to the DataCollector.
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
MetadataList m_metadata
List of experiment metadata.
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.