20 #ifndef BASIC_DATA_CALCULATORS_H
21 #define BASIC_DATA_CALCULATORS_H
26 #include "ns3/type-name.h"
39 template <
typename T = u
int32_t>
164 template <
typename T>
174 m_varianceCurr =
NaN;
180 template <
typename T>
185 template <
typename T>
194 template <
typename T>
198 static TypeId tid =
TypeId(
"ns3::MinMaxAvgTotalCalculator<" + TypeNameGet<T>() +
">")
200 .SetGroupName(
"Stats")
205 template <
typename T>
214 m_squareTotal += i * i;
223 m_min = (i < m_min) ? i : m_min;
224 m_max = (i > m_max) ? i : m_max;
249 m_varianceCurr = m_sCurr;
254 m_meanPrev = m_meanCurr;
258 m_meanCurr = m_meanPrev + (i - m_meanPrev) / m_count;
259 m_sCurr = m_sPrev + (i - m_meanPrev) * (i - m_meanCurr);
260 m_varianceCurr = m_sCurr / (m_count - 1);
266 template <
typename T>
277 m_varianceCurr =
NaN;
284 template <
typename T>
299 template <
typename T = u
int32_t>
346 template <
typename T>
352 template <
typename T>
358 template <
typename T>
362 static TypeId tid =
TypeId(
"ns3::CounterCalculator<" + TypeNameGet<T>() +
">")
364 .SetGroupName(
"Stats")
369 template <
typename T>
377 template <
typename T>
388 template <
typename T>
399 template <
typename T>
407 template <
typename T>
Introspection did not find any typical Config paths.
Template class CounterCalculator.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const double NaN
Stored representation of NaN.