21 #ifndef BASIC_DATA_CALCULATORS_H 22 #define BASIC_DATA_CALCULATORS_H 26 #include "ns3/type-name.h" 38 template <
typename T = u
int32_t>
129 template <
typename T>
139 m_varianceCurr =
NaN;
145 template <
typename T>
150 template <
typename T>
159 template <
typename T>
163 static TypeId tid =
TypeId ( (
"ns3::MinMaxAvgTotalCalculator<" 167 .SetGroupName (
"Stats")
173 template <
typename T>
181 m_squareTotal += i*i;
190 m_min = (i < m_min) ? i : m_min;
191 m_max = (i > m_max) ? i : m_max;
216 m_varianceCurr = m_sCurr;
221 m_meanPrev = m_meanCurr;
225 m_meanCurr = m_meanPrev + (i - m_meanPrev) / m_count;
226 m_sCurr = m_sPrev + (i - m_meanPrev) * (i - m_meanCurr);
227 m_varianceCurr = m_sCurr / (m_count - 1);
233 template <
typename T>
244 m_varianceCurr =
NaN;
251 template <
typename T>
267 template <
typename T = u
int32_t>
311 template <
typename T>
317 template <
typename T>
322 template <
typename T>
330 .SetGroupName (
"Stats")
336 template <
typename T>
340 DataCalculator::DoDispose ();
344 template <
typename T>
354 template <
typename T>
364 template <
typename T>
372 template <
typename T>
double getSum() const
Returns the sum.
Abstract class for calculating statistical data.
static TypeId GetTypeId(void)
Register this type.
double getMin() const
Returns the minimum value.
T m_min
Minimum value of MinMaxAvgTotalCalculator.
double getVariance() const
Returns the current variance.
T GetCount() const
Returns the count of the CounterCalculator.
T m_total
Total value of MinMaxAvgTotalCalculator.
double getSqrSum() const
Returns the sum of squares.
virtual ~MinMaxAvgTotalCalculator()
double getMax() const
Returns the maximum value.
void Reset()
Reinitializes all variables of MinMaxAvgTotalCalculator.
virtual void DoDispose(void)
Destructor implementation.
MinMaxAvgTotalCalculator()
const double NaN
Stored representation of NaN.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
T m_count
Count value of CounterCalculator.
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Register this type.
Template class MinMaxAvgTotalCalculator.
double m_meanPrev
Previous mean of MinMaxAvgTotalCalculator.
double m_meanCurr
Current mean of MinMaxAvgTotalCalculator.
virtual void Output(DataOutputCallback &callback) const
Outputs the data based on the provided callback.
Callback class for the DataOutput classes.
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
double m_varianceCurr
Current variance of MinMaxAvgTotalCalculator.
long getCount() const
Returns the count.
double m_sPrev
Previous s of MinMaxAvgTotalCalculator.
Calculates data during a simulation.
T m_max
Maximum value of MinMaxAvgTotalCalculator.
void Update()
Increments count by 1.
double getMean() const
Returns the mean value.
A base class which provides memory management and object aggregation.
virtual void OutputStatistic(std::string key, std::string variable, const StatisticalSummary *statSum)=0
Outputs the data from the specified StatisticalSummary.
Template class CounterCalculator.
virtual ~CounterCalculator()
virtual void OutputSingleton(std::string key, std::string variable, int val)=0
Associates the integer value with the variable name for a specific output format. ...
T m_squareTotal
Sum of squares value of MinMaxAvgTotalCalculator.
double m_sCurr
Current s of MinMaxAvgTotalCalculator.
a unique identifier for an interface.
virtual void Output(DataOutputCallback &callback) const
Outputs the data based on the provided callback.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual void DoDispose(void)
Destructor implementation.
uint32_t m_count
Count value of MinMaxAvgTotalCalculator.
double getStddev() const
Returns the standard deviation.