21 #ifndef DATA_CALCULATOR_H 22 #define DATA_CALCULATOR_H 24 #include "ns3/object.h" 25 #include "ns3/nstime.h" 26 #include "ns3/simulator.h" 29 extern const double NaN;
36 inline bool isNaN (
double x) {
return x !=
x; }
38 class DataOutputCallback;
64 virtual double getSum ()
const = 0;
76 virtual double getMin ()
const = 0;
82 virtual double getMax ()
const = 0;
88 virtual double getMean ()
const = 0;
139 void SetKey (
const std::string key);
144 std::string
GetKey ()
const;
virtual void Output(DataOutputCallback &callback) const =0
Outputs data based on the provided callback.
Simulation virtual time values and global simulation resolution.
virtual double getMin() const =0
Returns the minimum of the values.
void SetKey(const std::string key)
Sets the DataCalculator key to the provided key.
Abstract class for calculating statistical data.
virtual double getSqrSum() const =0
static TypeId GetTypeId(void)
Register this type.
bool GetEnabled() const
Returns whether the DataCalculator is enabled.
bool m_enabled
Descendant classes must check & respect m_enabled!
virtual void Stop(const Time &stopTime)
Stops DataCalculator at a given time in the simulation.
virtual void Start(const Time &startTime)
Starts DataCalculator at a given time in the simulation.
EventId m_startEvent
Start event.
virtual double getStddev() const =0
Returns the standard deviation of the (weighted) observations.
virtual double getMean() const =0
Returns the mean of the (weighted) observations.
virtual double getMax() const =0
Returns the maximum of the values.
void Enable()
Enables DataCalculator when simulation starts.
virtual ~StatisticalSummary()
Destructor.
EventId m_stopEvent
Stop event.
virtual void DoDispose(void)
Destructor implementation.
std::string GetContext() const
Gets the DataCalculator context.
const double NaN
Stored representation of NaN.
void Disable()
Disables DataCalculator when simulation stops.
std::string GetKey() const
Gets the DataCalculator key.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback class for the DataOutput classes.
virtual ~DataCalculator()
virtual double getSum() const =0
virtual double getVariance() const =0
Returns the variance of the (weighted) observations.
std::string m_context
Context value.
Calculates data during a simulation.
An identifier for simulation events.
void SetContext(const std::string context)
Sets the DataCalculator context to the provided context.
bool isNaN(double x)
true if x is NaN
A base class which provides memory management and object aggregation.
virtual long getCount() const =0
Returns the number of observations.
a unique identifier for an interface.
std::string m_key
Key value.