sipxportlib  Version 3.3
UtlHistogram.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _UtlHistogram_h_
12 #define _UtlHistogram_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include "utl/UtlString.h"
18 
19 // DEFINES
20 // MACROS
21 // EXTERNAL FUNCTIONS
22 // EXTERNAL VARIABLES
23 // CONSTANTS
24 // STRUCTS
25 // TYPEDEFS
26 // FORWARD DECLARATIONS
27 
65 {
66 /* //////////////////////////// PUBLIC //////////////////////////////////// */
67  public:
68 
69 /* ============================ CREATORS ================================== */
70 
74  UtlHistogram(unsigned int bins, int base, unsigned int size,
75  const char* outputFormat = "", unsigned int outputWidth = 0);
76 
80  ~UtlHistogram();
81 
82 /* ============================ MANIPULATORS ============================== */
83 
88  unsigned int tally(int);
89 
93  void clear();
94 
95 /* ============================ ACCESSORS ================================= */
96 
101  unsigned int getNoOfBins();
102 
106  unsigned int getBase();
107 
111  unsigned int getBinSize();
112 
116  unsigned int getCount();
117 
122  unsigned int operator[](unsigned int i);
123 
124 /* ============================ INQUIRY =================================== */
125 
130  UtlString* show();
131 
132 /* //////////////////////////// PROTECTED ///////////////////////////////// */
133  protected:
134 
135 /* //////////////////////////// PRIVATE /////////////////////////////////// */
136  private:
137 
138  // Number of bins.
139  unsigned int mNoOfBins;
140  // Lowest value in bin 0.
141  int mBase;
142  // Size of each bin:
143  unsigned int mBinSize;
144  // Pointer to an array of mNoOfBins int's.
145  unsigned int* mpBins;
146  // Total number of counts.
147  unsigned int mCount;
148 
149  // Format used to output values.
150  const char* mOutputFormat;
151  // Width of output that format will generate.
152  unsigned int mOutputWidth;
153 };
154 
155 /* ============================ INLINE METHODS ============================ */
156 
157 #endif // _UtlHistogram_h_
Definition: UtlHistogram.h:64
unsigned int getBinSize()
Definition: UtlHistogram.cpp:116
unsigned int getNoOfBins()
Definition: UtlHistogram.cpp:100
unsigned int tally(int)
Definition: UtlHistogram.cpp:68
unsigned int operator[](unsigned int i)
Definition: UtlHistogram.cpp:132
UtlString * show()
Definition: UtlHistogram.cpp:147
unsigned int getCount()
Definition: UtlHistogram.cpp:124
void clear()
Definition: UtlHistogram.cpp:82
unsigned int getBase()
Definition: UtlHistogram.cpp:108
Definition: UtlString.h:48
~UtlHistogram()
Definition: UtlHistogram.cpp:60
UtlHistogram(unsigned int bins, int base, unsigned int size, const char *outputFormat="", unsigned int outputWidth=0)
Definition: UtlHistogram.cpp:30