Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / g++-include / SmplHist.h
CommitLineData
15637ed4
RG
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Dirk Grunwald (grunwald@cs.uiuc.edu)
5
6This file is part of GNU CC.
7
8GNU CC is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY. No author or distributor
10accepts responsibility to anyone for the consequences of using it
11or for whether it serves any particular purpose or works at all,
12unless he says so in writing. Refer to the GNU CC General Public
13License for full details.
14
15Everyone is granted permission to copy, modify and redistribute
16GNU CC, but only under the conditions described in the
17GNU CC General Public License. A copy of this license is
18supposed to have been given to you along with GNU CC so you
19can know your rights and responsibilities. It should be in a
20file named COPYING. Among other things, the copyright notice
21and this notice must be preserved on all copies.
22*/
23
24#ifndef SampleHistogram_h
25#ifdef __GNUG__
26#pragma once
27#pragma interface
28#endif
29#define SampleHistogram_h 1
30
31#include <stream.h>
32#include <SmplStat.h>
33
34extern const int SampleHistogramMinimum;
35extern const int SampleHistogramMaximum;
36
37class SampleHistogram : public SampleStatistic
38{
39protected:
40 short howManyBuckets;
41 int *bucketCount;
42 double *bucketLimit;
43
44public:
45
46 SampleHistogram(double low, double hi, double bucketWidth = -1.0);
47
48 ~SampleHistogram();
49
50 virtual void reset();
51 virtual void operator+=(double);
52
53 int similarSamples(double);
54
55 int buckets();
56
57 double bucketThreshold(int i);
58 int inBucket(int i);
59 void printBuckets(ostream&);
60
61};
62
63#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
64
65 inline int SampleHistogram:: buckets() { return(howManyBuckets); };
66
67 inline double SampleHistogram:: bucketThreshold(int i) {
68 if (i < 0 || i >= howManyBuckets)
69 error("invalid bucket access");
70 return(bucketLimit[i]);
71 }
72
73 inline int SampleHistogram:: inBucket(int i) {
74 if (i < 0 || i >= howManyBuckets)
75 error("invalid bucket access");
76 return(bucketCount[i]);
77 }
78
79
80#endif
81
82#endif