Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

Erlang.h

00001 //   -*- C++ -*-
00002 /*****************************************************************************
00003  *
00004  *   |_|_|_  |_|_    |_    |_|_|_  |_                C O M M U N I C A T I O N
00005  * |_        |_  |_  |_  |_        |_                          N E T W O R K S
00006  * |_        |_  |_  |_  |_        |_                                C L A S S
00007  *   |_|_|_  |_    |_|_    |_|_|_  |_|_|_|_                      L I B R A R Y
00008  *
00009  * $Id: Erlang.h,v 1.4 2002/01/14 11:37:33 spee Exp $
00010  *
00011  * CNClass: CNErlang --- CNErlang-k distributed random numbers
00012  *
00013  *****************************************************************************
00014  * Copyright (C) 1992-2002   Communication Networks
00015  *                           Aachen University of Technology
00016  *                           D-52056 Aachen
00017  *                           Germany
00018  *                           Email: cncl-adm@comnets.rwth-aachen.de
00019  *****************************************************************************
00020  * This file is part of the CN class library. All files marked with
00021  * this header are free software; you can redistribute it and/or modify
00022  * it under the terms of the GNU Library General Public License as
00023  * published by the Free Software Foundation; either version 2 of the
00024  * License, or (at your option) any later version.  This library is
00025  * distributed in the hope that it will be useful, but WITHOUT ANY
00026  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00027  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00028  * License for more details.  You should have received a copy of the GNU
00029  * Library General Public License along with this library; if not, write
00030  * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
00031  * USA.
00032  *****************************************************************************
00033  * original Copyright:
00034  * -------------------
00035  * Copyright (C) 1988 Free Software Foundation
00036  *    written by Dirk Grunwald (grunwald@cs.uiuc.edu)
00037  * 
00038  * This file is part of the GNU C++ Library.  This library is free
00039  * software; you can redistribute it and/or modify it under the terms of
00040  * the GNU Library General Public License as published by the Free
00041  * Software Foundation; either version 2 of the License, or (at your
00042  * option) any later version.  This library is distributed in the hope
00043  * that it will be useful, but WITHOUT ANY WARRANTY; without even the
00044  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00045  * PURPOSE.  See the GNU Library General Public License for more details.
00046  * You should have received a copy of the GNU Library General Public
00047  * License along with this library; if not, write to the Free Software
00048  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00049  *****************************************************************************/
00050 
00051 #ifndef __Erlang_h
00052 #define __Erlang_h
00053 
00054 
00055 #include <CNCL/Class.h>
00056 #include <CNCL/Param.h>
00057 
00058 #include <CNCL/Random.h>                // Base class
00059 
00060 extern CNClassDesc CN_ERLANG;   // CNClass CNErlang description
00061 
00062 
00066 class CNErlang : public CNRandom
00067 {
00068 protected:
00070     double pMean;
00072     double pVariance;
00074     int k;
00076     double a;
00078     void setState();
00079 
00080 public:
00082     double mean();
00084     double mean(double x);
00086     double variance();
00088     double variance(double x);
00089 
00091     virtual double operator()() ;
00092 
00093     /****** Constructors ******************************************************/
00094 public:
00096     CNErlang();                 
00098     CNErlang(CNParam *param);                   
00102     CNErlang(double mean, double variance, CNRNG *gen);
00103 
00104     /****** Member functions required by CNCL *********************************/
00105 public:
00106     virtual CNClassDesc class_desc() const      // CNClass description
00107     {
00108         return CN_ERLANG;
00109     };
00110             
00112     virtual bool is_a(CNClassDesc desc) const
00113     {
00114         return desc == CN_ERLANG ? TRUE : CNRandom::is_a(desc);
00115     };
00116         
00118     static CNErlang *cast_from_object(CNObject *obj)
00119     {
00120 #   ifdef NO_TYPE_CHECK
00121         return (CNErlang *)obj;
00122 #   else
00123         return (CNErlang *)( !obj || obj->is_a(CN_ERLANG)
00124                ? obj : fatal_type(obj->class_desc(), CN_ERLANG) );
00125 #   endif
00126     }
00127     
00129     static CNObject *new_object(CNParam *param = NIL)
00130     { return param ? new CNErlang(param) : new CNErlang; }
00131     
00133     virtual void print(ostream &strm = cout) const ;
00135     virtual void dump (ostream &strm = cout) const ;
00136 };
00137 
00138 #endif 

Generated on Fri Feb 1 19:53:48 2002 for CNCL by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001