CRandVar.h

00001 /*  _________________________________________________________________________
00002  *
00003  *  UTILIB: A utility library for developing portable C++ codes.
00004  *  Copyright (c) 2001, Sandia National Laboratories.
00005  *  This software is distributed under the GNU Lesser General Public License.
00006  *  For more information, see the README file in the top UTILIB directory.
00007  *  _________________________________________________________________________
00008  */
00009 
00010 //
00011 // CRandVar.h
00012 //
00022 #ifndef __CRandVar_h
00023 #define __CRandVar_h
00024 
00025 #ifndef ANSI_HDRS
00026 #include <math.h>
00027 #else
00028 #include <cmath>
00029 #endif
00030 #include "errmsg.h"
00031 #include "RNG.h"
00032 
00033 
00034 #ifdef SWIG
00035 class CRandVar {
00036 #else
00037 class UTILIB_API CRandVar {
00038 #endif
00039 
00040 public:
00041 
00043   CRandVar(RNG *generator);
00044 #ifndef SWIG
00045 
00046   virtual double operator()() = 0;
00047 #endif
00048 
00050   RNG *generator();
00052   void generator(RNG *p);
00053 
00054 protected:
00055 
00057   RNG            *pGenerator;
00058 
00059 };
00060 
00061 
00062 #ifndef SWIG
00063 inline CRandVar::CRandVar(RNG *gen)
00064 { pGenerator = gen; }
00065 
00066 inline RNG *CRandVar::generator()
00067 { return(pGenerator); }
00068  
00069 inline void CRandVar::generator(RNG *p)
00070 { pGenerator = p; }
00071 #endif
00072 
00073 #endif