9#ifndef BASIC_DATA_CALCULATORS_H
10#define BASIC_DATA_CALCULATORS_H
15#include "ns3/type-name.h"
28template <
typename T = u
int32_t>
163 m_varianceCurr =
NaN;
189 .SetGroupName(
"Stats")
203 m_squareTotal += i * i;
212 m_min = (i < m_min) ? i : m_min;
213 m_max = (i > m_max) ? i : m_max;
238 m_varianceCurr = m_sCurr;
243 m_meanPrev = m_meanCurr;
247 m_meanCurr = m_meanPrev + (i - m_meanPrev) / m_count;
248 m_sCurr = m_sPrev + (i - m_meanPrev) * (i - m_meanCurr);
249 m_varianceCurr = m_sCurr / (m_count - 1);
266 m_varianceCurr =
NaN;
288template <
typename T = u
int32_t>
353 .SetGroupName(
"Stats")
Template class CounterCalculator.
void Update(const T i)
Increments count by i.
void DoDispose() override
Dispose of this Object.
T m_count
Count value of CounterCalculator.
~CounterCalculator() override
static TypeId GetTypeId()
Register this type.
void Output(DataOutputCallback &callback) const override
Outputs the data based on the provided callback.
T GetCount() const
Returns the count of the CounterCalculator.
void Update()
Increments count by 1.
Calculates data during a simulation.
void DoDispose() override
Destructor implementation.
Callback class for the DataOutput classes.
virtual void OutputStatistic(std::string key, std::string variable, const StatisticalSummary *statSum)=0
Outputs the data from the specified StatisticalSummary.
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.
Template class MinMaxAvgTotalCalculator.
T m_squareTotal
Sum of squares value of MinMaxAvgTotalCalculator.
double m_varianceCurr
Current variance of MinMaxAvgTotalCalculator.
~MinMaxAvgTotalCalculator() override
MinMaxAvgTotalCalculator()
T m_min
Minimum value of MinMaxAvgTotalCalculator.
void Reset()
Reinitializes all variables of MinMaxAvgTotalCalculator.
long getCount() const override
Returns the count.
static TypeId GetTypeId()
Register this type.
double getVariance() const override
Returns the current variance.
uint32_t m_count
Count value of MinMaxAvgTotalCalculator.
T m_max
Maximum value of MinMaxAvgTotalCalculator.
double getMax() const override
Returns the maximum value.
double m_sCurr
Current s of MinMaxAvgTotalCalculator.
double getSqrSum() const override
Returns the sum of squares.
double getSum() const override
Returns the sum.
double getStddev() const override
Returns the standard deviation.
double getMean() const override
Returns the mean value.
double getMin() const override
Returns the minimum value.
void Output(DataOutputCallback &callback) const override
Outputs the data based on the provided callback.
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
T m_total
Total value of MinMaxAvgTotalCalculator.
void DoDispose() override
Dispose of this Object.
double m_meanPrev
Previous mean of MinMaxAvgTotalCalculator.
double m_meanCurr
Current mean of MinMaxAvgTotalCalculator.
double m_sPrev
Previous s of MinMaxAvgTotalCalculator.
A base class which provides memory management and object aggregation.
Abstract class for calculating statistical data.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::string TypeNameGet()
Type name strings for AttributeValue types.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const double NaN
Stored representation of NaN.