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;
222 m_varianceCurr = m_sCurr;
227 m_meanPrev = m_meanCurr;
231 m_meanCurr = m_meanPrev + (i - m_meanPrev) / m_count;
232 m_sCurr = m_sPrev + (i - m_meanPrev) * (i - m_meanCurr);
233 m_varianceCurr = m_sCurr / (m_count - 1);
239 template <
typename T>
250 m_varianceCurr =
NaN;
257 template <
typename T>
273 template <
typename T = u
int32_t>
317 template <
typename T>
323 template <
typename T>
328 template <
typename T>
336 .SetGroupName (
"Stats")
342 template <
typename T>
350 template <
typename T>
360 template <
typename T>
370 template <
typename T>
378 template <
typename T>
double getSum() const
Returns the sum.
Abstract class for calculating statistical data.
double getMax() const
Returns the maximum value.
static TypeId GetTypeId(void)
Register this type.
T m_min
Minimum value of MinMaxAvgTotalCalculator.
double getMin() const
Returns the minimum value.
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 getVariance() const
Returns the current variance.
virtual void Output(DataOutputCallback &callback) const
Outputs the data based on the provided callback.
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.
Callback class for the DataOutput classes.
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
double getStddev() const
Returns the standard deviation.
double m_varianceCurr
Current variance of MinMaxAvgTotalCalculator.
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.
virtual void Output(DataOutputCallback &callback) const
Outputs the data based on the provided callback.
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.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
long getCount() const
Returns the count.
virtual void DoDispose(void)
Destructor implementation.
uint32_t m_count
Count value of MinMaxAvgTotalCalculator.