00001 // This may look like C code, but it is really -*- C++ -*- 00002 /* 00003 Copyright (C) 1988 Free Software Foundation 00004 written by Dirk Grunwald (grunwald@cs.uiuc.edu) 00005 00006 This file is part of the GNU C++ Library. This library is free 00007 software; you can redistribute it and/or modify it under the terms of 00008 the GNU Library General Public License as published by the Free 00009 Software Foundation; either version 2 of the License, or (at your 00010 option) any later version. This library is distributed in the hope 00011 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00012 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the GNU Library General Public License for more details. 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef SampleStatistic_h 00020 #define SampleStatistic_h 1 00021 00022 #ifdef __GNUG__ 00023 #pragma interface 00024 #endif 00025 00026 class SampleStatistic { 00027 protected: 00028 long unsigned n; 00029 double x; 00030 double x2; 00031 double minValue, maxValue; 00032 00033 public : 00034 00035 SampleStatistic(); 00036 virtual ~SampleStatistic(); 00037 virtual void reset(); 00038 00039 virtual void operator+=(double); 00040 long samples()const; 00041 double mean()const; 00042 double stdDev()const; 00043 double var()const; 00044 double min()const; 00045 double max()const; 00046 double confidence(int p_percentage)const; 00047 double confidence(double p_value)const; 00048 00049 // void error(const char* msg); 00050 }; 00051 00052 // error handlers 00053 /* 00054 extern void default_SampleStatistic_error_handler(const char*); 00055 extern one_arg_error_handler_t SampleStatistic_error_handler; 00056 00057 extern one_arg_error_handler_t 00058 set_SampleStatistic_error_handler(one_arg_error_handler_t f); 00059 */ 00060 inline long SampleStatistic:: samples()const {return (long)n;} 00061 inline double SampleStatistic:: min() const{return(minValue);} 00062 inline double SampleStatistic:: max() const{return(maxValue);} 00063 inline SampleStatistic::~SampleStatistic() {} 00064 00065 #endif
1.2.3 written by Dimitri van Heesch,
© 1997-2000