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 #ifndef __CVARHIST_H
00014 #define __CVARHIST_H
00015 
00016 #include <iostream.h>
00017 #include "chist.h"
00018 
00019 //==========================================================================
00020 //  transform types for cVarHistogram
00021 //
00022 // HIST_TR_NO_TRANSFORM: no transformation; uses bin boundaries
00023 //                       previously defined by addBinBound()/appendBinBound()
00024 // HIST_TR_AUTO_EPC_DBL: automatically creates equiprobable cells
00025 // HIST_TR_AUTO_EPC_INT: like the above, but uses a different hack :-)
00026 
00027 enum {
00028    HIST_TR_NO_TRANSFORM=1,
00029    HIST_TR_AUTO_EPC_DBL=0,
00030    HIST_TR_AUTO_EPC_INT=2
00031 };
00032 
00033 //==========================================================================
00034 
00072 class SIM_API cVarHistogram : public cHistogramBase //--LG
00073 {
00074   protected:
00075     int transform_type;     // one of the HIST_TR_xxx constants
00076     int max_num_cells;      // the length of the allocated cellv
00077     double *bin_bounds;     // bin/cell boundaries
00078 
00079     // the boundaries of the ordinary cells/bins are:
00080     // rangemin=bin_bounds[0], bin_bounds[1], ... bin_bounds[num_cells]=rangemax
00081     // consequence: sizeof(binbounds)=sizeof(cellv)+1
00082 
00083   protected:
00087     void createEquiProbableCells();
00088 
00089   public:
00092 
00096     cVarHistogram(const cVarHistogram& r) : cHistogramBase(r)
00097        {setName(r.name());bin_bounds=NULL;operator=(r);}
00098 
00103     explicit cVarHistogram(const char *name=NULL,
00104                            int numcells=11,
00105                            int transformtype=HIST_TR_AUTO_EPC_DBL);
00106 
00110     virtual ~cVarHistogram();
00111 
00115     cVarHistogram& operator=(const cVarHistogram& res);
00117 
00120 
00124     virtual const char *className() const {return "cVarHistogram";}
00125 
00130     virtual cObject *dup() const    {return new cVarHistogram(*this);}
00131 
00137     virtual int netPack();
00138 
00144     virtual int netUnpack();
00146 
00149 
00153     virtual void clearResult();
00154 
00159     virtual void transform();
00160 
00165     virtual void collectTransformed(double val);
00166 
00170     virtual double random() const;
00171 
00175     virtual double pdf(double x) const; // --LG
00176 
00180     virtual double cdf(double x) const; // --LG
00181 
00185     virtual double basepoint(int k) const; // --LG
00186 
00190     virtual double cell(int k) const;
00191 
00195     virtual void saveToFile(FILE *) const; //--LG
00196 
00200     virtual void loadFromFile(FILE *);  //--LG
00202 
00205 
00212     virtual void addBinBound(double x);
00214 };
00215 
00216 #endif
00217 
00218 

Generated at Sat May 4 15:45:48 2002 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001