]> git.mxchange.org Git - simgear.git/blob - simgear/structure/SGSmplstat.hxx
Remove SVN sync code.
[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, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, 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 totalTime, cumulativeTime;
34
35 public:
36   SampleStatistic ();
37   inline virtual ~ SampleStatistic ();
38   virtual void reset ();
39
40   virtual void operator += (double);
41   int samples () const;
42   double mean () const;
43   double stdDev () const;
44   double var () const;
45   double min () const;
46   double max () const;
47   double total () const;
48   double cumulative () const;
49   double confidence (int p_percentage) const;
50   double confidence (double p_value) const;
51
52   void error (const char *msg);
53 };
54
55
56 inline SampleStatistic::SampleStatistic ()
57 {
58   cumulativeTime = 0;
59   reset ();
60 }
61
62 inline int SampleStatistic::samples () const
63 {
64   return (n);
65 }
66
67 inline double SampleStatistic::min () const
68 {
69   return (minValue);
70 }
71
72 inline double SampleStatistic::max () const
73 {
74   return (maxValue);
75 }
76
77 inline double SampleStatistic::total () const
78 {
79   return (totalTime);
80 }
81
82 inline double SampleStatistic::cumulative () const
83 {
84   return (cumulativeTime);
85 }
86
87 inline SampleStatistic::~SampleStatistic ()
88 {
89 }
90
91 #endif