1 // This may look like C code, but it is really -*- C++ -*-
3 Copyright (C) 1988 Free Software Foundation
4 written by Dirk Grunwald (grunwald@cs.uiuc.edu)
6 This file is part of GNU CC.
8 GNU CC is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY. No author or distributor
10 accepts responsibility to anyone for the consequences of using it
11 or for whether it serves any particular purpose or works at all,
12 unless he says so in writing. Refer to the GNU CC General Public
13 License for full details.
15 Everyone is granted permission to copy, modify and redistribute
16 GNU CC, but only under the conditions described in the
17 GNU CC General Public License. A copy of this license is
18 supposed to have been given to you along with GNU CC so you
19 can know your rights and responsibilities. It should be in a
20 file named COPYING. Among other things, the copyright notice
21 and this notice must be preserved on all copies.
24 #ifndef SampleHistogram_h
29 #define SampleHistogram_h 1
34 extern const int SampleHistogramMinimum
;
35 extern const int SampleHistogramMaximum
;
37 class SampleHistogram
: public SampleStatistic
46 SampleHistogram(double low
, double hi
, double bucketWidth
= -1.0);
51 virtual void operator+=(double);
53 int similarSamples(double);
57 double bucketThreshold(int i
);
59 void printBuckets(ostream
&);
63 #if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
65 inline int SampleHistogram:: buckets() { return(howManyBuckets
); };
67 inline double SampleHistogram:: bucketThreshold(int i
) {
68 if (i
< 0 || i
>= howManyBuckets
)
69 error("invalid bucket access");
70 return(bucketLimit
[i
]);
73 inline int SampleHistogram:: inBucket(int i
) {
74 if (i
< 0 || i
>= howManyBuckets
)
75 error("invalid bucket access");
76 return(bucketCount
[i
]);