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>
132 template <
typename T>
142 m_varianceCurr =
NaN;
148 template <
typename T>
153 template <
typename T>
162 template <
typename T>
166 static TypeId tid =
TypeId (
"ns3::MinMaxAvgTotalCalculator<"
170 .SetGroupName (
"Stats")
176 template <
typename T>
184 m_squareTotal += i*i;
193 m_min = (i < m_min) ? i : m_min;
194 m_max = (i > m_max) ? i : m_max;
219 m_varianceCurr = m_sCurr;
224 m_meanPrev = m_meanCurr;
228 m_meanCurr = m_meanPrev + (i - m_meanPrev) / m_count;
229 m_sCurr = m_sPrev + (i - m_meanPrev) * (i - m_meanCurr);
230 m_varianceCurr = m_sCurr / (m_count - 1);
236 template <
typename T>
247 m_varianceCurr =
NaN;
254 template <
typename T>
270 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>
Template class CounterCalculator.
virtual void Output(DataOutputCallback &callback) const
Outputs the data based on the provided callback.
void Update(const T i)
Increments count by i.
virtual void DoDispose(void)
Dispose of this Object.
static TypeId GetTypeId(void)
Register this type.
T m_count
Count value of CounterCalculator.
T GetCount() const
Returns the count of the CounterCalculator.
void Update()
Increments count by 1.
virtual ~CounterCalculator()
Calculates data during a simulation.
virtual void DoDispose(void)
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.
double getSqrSum() const
Returns the sum of squares.
T m_squareTotal
Sum of squares value of MinMaxAvgTotalCalculator.
double m_varianceCurr
Current variance of MinMaxAvgTotalCalculator.
MinMaxAvgTotalCalculator()
T m_min
Minimum value of MinMaxAvgTotalCalculator.
virtual void Output(DataOutputCallback &callback) const
Outputs the data based on the provided callback.
virtual ~MinMaxAvgTotalCalculator()
void Reset()
Reinitializes all variables of MinMaxAvgTotalCalculator.
virtual void DoDispose(void)
Dispose of this Object.
long getCount() const
Returns the count.
uint32_t m_count
Count value of MinMaxAvgTotalCalculator.
T m_max
Maximum value of MinMaxAvgTotalCalculator.
double getSum() const
Returns the sum.
double getStddev() const
Returns the standard deviation.
double getMean() const
Returns the mean value.
double m_sCurr
Current s of MinMaxAvgTotalCalculator.
double getVariance() const
Returns the current variance.
double getMax() const
Returns the maximum value.
static TypeId GetTypeId(void)
Register this type.
double getMin() const
Returns the minimum value.
void Update(const T i)
Updates all variables of MinMaxAvgTotalCalculator.
T m_total
Total value of MinMaxAvgTotalCalculator.
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.