]> git.mxchange.org Git - simgear.git/blob - simgear/structure/SGSmplstat.hxx
Remove stray ';'
[simgear.git] / simgear / structure / SGSmplstat.hxx
1 // This may look like C code, but it is really -*- C++ -*-
2 /* 
3 Copyright (C) 1988 Free Software Foundation
4     written by Dirk Grunwald (grunwald@cs.uiuc.edu)
5
6 This file is part of the GNU C++ Library.  This library is free
7 software; you can redistribute it and/or modify it under the terms of
8 the GNU Library General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.  This library is distributed in the hope
11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE.  See the GNU Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #ifndef SampleStatistic_h
19
20 #define SampleStatistic_h 1
21
22
23 #undef min
24 #undef max
25
26 class SampleStatistic
27 {
28 protected:
29   int n;
30   double x;
31   double x2;
32   double minValue, maxValue;
33   double allTimeTotal;
34
35 public:  SampleStatistic ();
36   inline virtual ~ SampleStatistic ();
37   virtual void reset ();
38
39   virtual void operator += (double);
40   int samples () const;
41   double mean () const;
42   double stdDev () const;
43   double var () const;
44   double min () const;
45   double max () const;
46   double total () const;
47   double confidence (int p_percentage) const;
48   double confidence (double p_value) const;
49
50   void error (const char *msg);
51 };
52
53 // error handlers
54
55 //extern void default_SampleStatistic_error_handler (const char *);
56 //extern one_arg_error_handler_t SampleStatistic_error_handler;
57
58 //extern one_arg_error_handler_t
59 //set_SampleStatistic_error_handler (one_arg_error_handler_t f);
60
61 inline SampleStatistic::SampleStatistic ()
62 {
63   allTimeTotal = 0;
64   reset ();
65 }
66 inline int SampleStatistic::samples () const
67 {
68   return (n);
69 }
70 inline double SampleStatistic::min () const
71 {
72   return (minValue);
73 }
74 inline double SampleStatistic::max () const
75 {
76   return (maxValue);
77 }
78 inline double SampleStatistic::total () const
79 {
80   return (allTimeTotal);
81 }
82
83 inline SampleStatistic::~SampleStatistic ()
84 {
85 }
86
87 #endif