A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
histogram.h
Go to the documentation of this file.
1
//
2
// Copyright (c) 2009 INESC Porto
3
//
4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License version 2 as
6
// published by the Free Software Foundation;
7
//
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
//
17
// Author: Pedro Fortuna <pedro.fortuna@inescporto.pt> <pedro.fortuna@gmail.com>
18
//
19
20
#ifndef NS3_HISTOGRAM_H
21
#define NS3_HISTOGRAM_H
22
23
#include <ostream>
24
#include <stdint.h>
25
#include <vector>
26
27
namespace
ns3
28
{
29
45
class
Histogram
46
{
47
public
:
48
// --- basic methods ---
53
Histogram
(
double
binWidth);
54
Histogram
();
55
56
// Methods for Getting the Histogram Results
61
uint32_t
GetNBins
()
const
;
67
double
GetBinStart
(uint32_t index)
const
;
73
double
GetBinEnd
(uint32_t index)
const
;
82
double
GetBinWidth
(uint32_t index)
const
;
90
void
SetDefaultBinWidth
(
double
binWidth);
96
uint32_t
GetBinCount
(uint32_t index)
const
;
97
98
// Method for adding values
103
void
AddValue
(
double
value);
104
108
void
Clear
();
109
116
void
SerializeToXmlStream
(std::ostream& os, uint16_t indent, std::string elementName)
const
;
117
118
private
:
119
std::vector<uint32_t>
m_histogram
;
120
double
m_binWidth
;
121
};
122
123
}
// namespace ns3
124
125
#endif
/* NS3_HISTOGRAM_H */
ns3::Histogram
Class used to store data and make an histogram of the data frequency.
Definition:
histogram.h:46
ns3::Histogram::Clear
void Clear()
Clear the histogram content.
Definition:
histogram.cc:96
ns3::Histogram::GetBinWidth
double GetBinWidth(uint32_t index) const
Returns the bin width.
Definition:
histogram.cc:61
ns3::Histogram::GetBinCount
uint32_t GetBinCount(uint32_t index) const
Get the number of data added to the bin.
Definition:
histogram.cc:74
ns3::Histogram::m_histogram
std::vector< uint32_t > m_histogram
Histogram data.
Definition:
histogram.h:119
ns3::Histogram::SetDefaultBinWidth
void SetDefaultBinWidth(double binWidth)
Set the bin width.
Definition:
histogram.cc:67
ns3::Histogram::m_binWidth
double m_binWidth
Bin width.
Definition:
histogram.h:120
ns3::Histogram::GetNBins
uint32_t GetNBins() const
Returns the number of bins in the histogram.
Definition:
histogram.cc:43
ns3::Histogram::SerializeToXmlStream
void SerializeToXmlStream(std::ostream &os, uint16_t indent, std::string elementName) const
Serializes the results to an std::ostream in XML format.
Definition:
histogram.cc:112
ns3::Histogram::GetBinEnd
double GetBinEnd(uint32_t index) const
Returns the bin end, i.e., (index+1)*binWidth.
Definition:
histogram.cc:55
ns3::Histogram::AddValue
void AddValue(double value)
Add a value to the histogram.
Definition:
histogram.cc:81
ns3::Histogram::Histogram
Histogram()
Definition:
histogram.cc:106
ns3::Histogram::GetBinStart
double GetBinStart(uint32_t index) const
Returns the bin start, i.e., index*binWidth.
Definition:
histogram.cc:49
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
stats
model
histogram.h
Generated on Sun Mar 3 2024 17:11:08 for ns-3 by
1.9.1