24 #include "ns3/simulator.h" 27 #define DEFAULT_BIN_WIDTH 1 82 uint32_t index = (uint32_t)std::floor (value/
m_binWidth);
107 os << std::string (
indent,
' ' ) <<
"<" << elementName
112 #if 1 // two alternative forms of representing bin data, one more verbose than the other one 113 for (uint32_t index = 0; index <
m_histogram.size (); index++)
117 os << std::string (
indent,
' ' );
119 <<
" index=\"" << (index) <<
"\"" 127 os << std::string (
indent+2,
' ' );
128 for (uint32_t index = 0; index <
m_histogram.size (); index++)
139 os << std::string (
indent,
' ' ) <<
"</" << elementName <<
">\n";
double GetBinEnd(uint32_t index)
Returns the bin end, i.e., (index+1)*binWidth.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
std::vector< uint32_t > m_histogram
Histogram data.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetNBins() const
Returns the number of bins in the histogram.
void SerializeToXmlStream(std::ostream &os, uint16_t indent, std::string elementName) const
Serializes the results to an std::ostream in XML format.
double m_binWidth
Bin width.
def indent(source, debug, level)
#define DEFAULT_BIN_WIDTH
void SetDefaultBinWidth(double binWidth)
Set the bin width.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetBinCount(uint32_t index)
Get the number of data added to the bin.
double GetBinWidth(uint32_t index) const
Returns the bin width.
double GetBinStart(uint32_t index)
Returns the bin start, i.e., index*binWidth.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void AddValue(double value)
Add a value to the histogram.