25 #include "ns3/nstime.h"
60 bool decimalPtSeen =
false;
61 bool exponentSeen =
false;
64 for (std::string::const_iterator it = s.begin (); it != s.end (); it++)
66 if ((*it ==
'.') && (decimalPtSeen))
70 else if ((*it ==
'e') && exponentSeen)
75 decimalPtSeen =
false;
77 else if (*it ==
'-' && it != s.begin () && last !=
'e')
89 std::ofstream scalarFile;
91 scalarFile.open (fn.c_str (), std::ios_base::out);
94 scalarFile <<
"run " << dc.
GetRunLabel () << std::endl;
100 <<
"\"" << std::endl;
102 <<
"\"" << std::endl;
106 std::pair<std::string, std::string> blob = (*i);
107 scalarFile <<
"attr \"" << blob.first <<
"\" \"" << blob.second <<
"\""
111 scalarFile << std::endl;
113 scalarFile <<
"scalar . measurement \"" << dc.
GetInputLabel ()
114 <<
"\"" << std::endl;
118 std::pair<std::string, std::string> blob = (*i);
120 scalarFile <<
"scalar . \"" << blob.first <<
"\" \"" << blob.second <<
"\""
128 (*i)->Output (callback);
131 scalarFile << std::endl << std::endl;
139 (std::ostream *scalar) :
153 (*m_scalar) <<
"statistic " << context <<
" " << name << std::endl;
155 (*m_scalar) <<
"field count " << statSum->
getCount () << std::endl;
157 (*m_scalar) <<
"field sum " << statSum->
getSum () << std::endl;
159 (*m_scalar) <<
"field mean " << statSum->
getMean () << std::endl;
161 (*m_scalar) <<
"field min " << statSum->
getMin () << std::endl;
163 (*m_scalar) <<
"field max " << statSum->
getMax () << std::endl;
165 (*m_scalar) <<
"field sqrsum " << statSum->
getSqrSum () << std::endl;
167 (*m_scalar) <<
"field stddev " << statSum->
getStddev () << std::endl;
179 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
192 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
205 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
218 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val << std::endl;
231 (*m_scalar) <<
"scalar " << context <<
" " << name <<
" " << val.
GetTimeStep () << std::endl;
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
keep track of time values and allow control of global simulation resolution
virtual double getMin() const =0
Returns the minimum of the values.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
Abstract class for calculating statistical data.
virtual double getSqrSum() const =0
std::string GetRunLabel() const
Return the runID label.
virtual void Output(DataCollector &dc)
Outputs information from the provided DataCollector.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
virtual ~OmnetDataOutput()
virtual double getStddev() const =0
Returns the standard deviation of the (weighted) observations.
virtual double getMean() const =0
Returns the mean of the (weighted) observations.
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
virtual double getMax() const =0
Returns the maximum of the values.
OmnetOutputCallback(std::ostream *scalar)
Constructor.
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
std::string GetStrategyLabel() const
Return the strategy label.
void OutputStatistic(std::string context, std::string name, const StatisticalSummary *statSum)
Generates data statistics.
Class to generate OMNeT output.
bool isNumeric(const std::string &s)
std::string GetExperimentLabel() const
Return the experiment label.
std::string m_filePrefix
File prefix for the DataOutputInterface.
int64_t GetTimeStep(void) const
virtual double getSum() const =0
std::string GetDescription() const
Return the description label.
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
bool isNaN(double x)
true if x is NaN
std::string GetInputLabel() const
Return the input label.
void OutputSingleton(std::string context, std::string name, int val)
Generates a single data output.
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
virtual long getCount() const =0
Returns the number of observations.
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.