A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
histogram.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2009 INESC Porto
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 // Author: Pedro Fortuna <pedro.fortuna@inescporto.pt> <pedro.fortuna@gmail.com>
19 //
20 
21 #ifndef NS3_HISTOGRAM_H
22 #define NS3_HISTOGRAM_H
23 
24 #include <vector>
25 #include <stdint.h>
26 #include <ostream>
27 
28 namespace ns3 {
29 
30 class Histogram
31 {
32 public:
33 
34  // --- basic methods ---
35  Histogram (double binWidth);
36  Histogram ();
37 
38  // Methods for Getting the Histogram Results
39  uint32_t GetNBins () const;
40  double GetBinStart (uint32_t index);
41  double GetBinEnd (uint32_t index);
42  double GetBinWidth (uint32_t index) const;
43  void SetDefaultBinWidth (double binWidth);
44  uint32_t GetBinCount (uint32_t index);
45 
46  // Method for adding values
47  void AddValue (double value);
48 
49 
50  void SerializeToXmlStream (std::ostream &os, int indent, std::string elementName) const;
51 
54 
55 private:
56  std::vector<uint32_t> m_histogram;
57  double m_binWidth;
58 };
59 
60 
61 } // namespace ns3
62 
63 #endif /* NS3_HISTOGRAM_H */
double GetBinEnd(uint32_t index)
Definition: histogram.cc:54
double GetBinWidth(uint32_t index) const
Definition: histogram.cc:60
std::vector< uint32_t > m_histogram
Definition: histogram.h:56
double m_binWidth
Definition: histogram.h:57
uint32_t GetNBins() const
Definition: histogram.cc:42
void SetDefaultBinWidth(double binWidth)
Definition: histogram.cc:66
uint32_t GetBinCount(uint32_t index)
Definition: histogram.cc:73
double GetBinStart(uint32_t index)
Definition: histogram.cc:48
void AddValue(double value)
Definition: histogram.cc:80
void SerializeToXmlStream(std::ostream &os, int indent, std::string elementName) const
Definition: histogram.cc:106