Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

cvarhist.h

00001 //==========================================================================
00002 //
00003 //   CVARHIST.H - header for
00004 //                             OMNeT++
00005 //            Discrete System Simulation in C++
00006 //
00007 //
00008 //  Declaration of the following classes:
00009 //    cVarHistogram : Variable bin size histogram
00010 //
00011 //==========================================================================
00012 
00013 /*--------------------------------------------------------------*
00014   Copyright (C) 1992-2003 Andras Varga
00015 
00016   This file is distributed WITHOUT ANY WARRANTY. See the file
00017   `license' for details on this and other legal matters.
00018 *--------------------------------------------------------------*/
00019 
00020 #ifndef __CVARHIST_H
00021 #define __CVARHIST_H
00022 
00023 #include "chist.h"
00024 
00025 //==========================================================================
00026 //  transform types for cVarHistogram
00027 //
00028 // HIST_TR_NO_TRANSFORM: no transformation; uses bin boundaries
00029 //                       previously defined by addBinBound()/appendBinBound()
00030 // HIST_TR_AUTO_EPC_DBL: automatically creates equiprobable cells
00031 // HIST_TR_AUTO_EPC_INT: like the above, but uses a different hack :-)
00032 
00033 enum {
00034    HIST_TR_NO_TRANSFORM=1,
00035    HIST_TR_AUTO_EPC_DBL=0,
00036    HIST_TR_AUTO_EPC_INT=2
00037 };
00038 
00039 //==========================================================================
00040 
00078 class SIM_API cVarHistogram : public cHistogramBase //--LG
00079 {
00080   protected:
00081     int transform_type;     // one of the HIST_TR_xxx constants
00082     int max_num_cells;      // the length of the allocated cellv
00083     double *bin_bounds;     // bin/cell boundaries
00084 
00085     // the boundaries of the ordinary cells/bins are:
00086     // rangemin=bin_bounds[0], bin_bounds[1], ... bin_bounds[num_cells]=rangemax
00087     // consequence: sizeof(binbounds)=sizeof(cellv)+1
00088 
00089   protected:
00093     void createEquiProbableCells();
00094 
00095   public:
00098 
00102     cVarHistogram(const cVarHistogram& r) : cHistogramBase(r)
00103        {setName(r.name());bin_bounds=NULL;operator=(r);}
00104 
00109     explicit cVarHistogram(const char *name=NULL,
00110                            int numcells=11,
00111                            int transformtype=HIST_TR_AUTO_EPC_DBL);
00112 
00116     virtual ~cVarHistogram();
00117 
00121     cVarHistogram& operator=(const cVarHistogram& res);
00123 
00126 
00131     virtual cObject *dup() const    {return new cVarHistogram(*this);}
00132 
00138     virtual int netPack();
00139 
00145     virtual int netUnpack();
00147 
00150 
00154     virtual void clearResult();
00155 
00160     virtual void transform();
00161 
00166     virtual void collectTransformed(double val);
00167 
00171     virtual double random() const;
00172 
00176     virtual double pdf(double x) const; // --LG
00177 
00181     virtual double cdf(double x) const; // --LG
00182 
00186     virtual double basepoint(int k) const; // --LG
00187 
00191     virtual double cell(int k) const;
00192 
00196     virtual void saveToFile(FILE *) const; //--LG
00197 
00201     virtual void loadFromFile(FILE *);  //--LG
00203 
00206 
00213     virtual void addBinBound(double x);
00215 };
00216 
00217 #endif
00218 
00219 

Generated at Mon Jun 16 23:37:31 2003 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001