dehistogram.h

Go to the documentation of this file.
00001 /*
00002   $Id: dehistogram.h,v 1.3 2004/12/12 23:44:44 pecos Exp $
00003 */
00004 
00005 /* *********
00006 *  
00007 *  This file is part of:
00008 *  NePSing, Network Protocol Simulator next generation
00009 *  
00010 *  Copyright (C) 2004  Tommaso Pecorella <tpecorella@mac.com>
00011 *  
00012 *  This library is free software; you can redistribute it and/or
00013 *  modify it under the terms of the GNU Lesser General Public
00014 *  License as published by the Free Software Foundation; either
00015 *  version 2.1 of the License, or (at your option) any later version.
00016 *  
00017 *  This library is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 *  Lesser General Public License for more details.
00021 *  
00022 *  You should have received a copy of the GNU Lesser General Public
00023 *  License along with this library; if not, write to the Free Software
00024 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *  
00026 ********* */
00027 
00034 #ifndef ___DEHISTOGRAM_H___
00035 #define ___DEHISTOGRAM_H___
00036 
00037 #include <vector>
00038 
00039 using namespace std ;
00040 
00042 
00058 class DEHistogram
00059 {
00060 protected:
00061   // Sum of values
00062   double Sum;
00063 
00064   // Sum of square values
00065   double SqSum;
00066 
00067   // Number of values collected
00068   double N;
00069 
00070   // Width of the interval used to estimate the histogram
00071   double BinWidth;
00072 
00073   // Position of the beginning of the bin from 0
00074   double BinStart;
00075 
00076   // Left half of Histogram
00077   vector<unsigned int> HistoL;
00078 
00079   // Right half of Histogram
00080   vector<unsigned int> HistoR;
00081 
00082   // True if posOffs is set correctly
00083   bool posOk;
00084 
00085   // Is the position of the first element of the rigth half of the histogram
00086   int posOffs;
00087   
00088 public:
00090     DEHistogram (double _BinWidth = 1.0, 
00091                  double _BinStart = 0.0  
00092                  );
00093 
00095 
00099   bool SetParams (double _BinWidth = 1.0,  
00100                   double _BinStart = 0.0   
00101                   );
00102   
00104   void Reset();
00105 
00107   void AddValue(double x);
00108 
00110   double Mean();
00111 
00113   double SqMean();
00114 
00116   double Variance();
00117 
00119   double Num();
00120 
00122 
00145   void printHisto(ostream &s);
00146 };
00147 
00148 #endif
00149 
00150 /*
00151 
00152 $Log: dehistogram.h,v $
00153 Revision 1.3  2004/12/12 23:44:44  pecos
00154 Added Copyright message - LGPL
00155 
00156 Revision 1.2  2004/12/11 23:53:25  pecos
00157 Added DoxyGen comments
00158 
00159 Revision 1.1.1.1  2004/07/08 16:59:33  pecos
00160 NePSing framework
00161 
00162 Revision 1.1  2001/04/03 15:49:50  pecos
00163 Old class histogram
00164 
00165 Revision 1.2  1999/05/25 10:28:53  pecos
00166 *** empty log message ***
00167 
00168 Revision 1.1.1.1  1999/05/24 15:59:57  inesis
00169 INeSiS Project
00170 
00171 Revision 1.1.1.1  1999/05/24 15:17:20  inesis
00172 INeSiS Project
00173 
00174 Revision 1.2  1999/01/26 11:24:22  pecos
00175 *** empty log message ***
00176 
00177 Revision 1.1  1999/01/02 09:25:36  nanni
00178 *** empty log message ***
00179 
00180 
00181 */

Generated on Wed Dec 22 23:23:47 2004 for NePSing by doxygen 1.3.9.1 ---- Hosted by SourceForge.net Logo