Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

ExponentialRandomVariable Class Reference

#include <ranvar.h>

Inheritance diagram for ExponentialRandomVariable:

Inheritance graph
[legend]
Collaboration diagram for ExponentialRandomVariable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual double value ()
 ExponentialRandomVariable ()
 ExponentialRandomVariable (double)
double * avgp ()
virtual double avg ()
void setavg (double d)
int command (int argc, const char *const *argv)
int seed (char *)

Protected Attributes

RNGrng_

Private Attributes

double avg_

Constructor & Destructor Documentation

ExponentialRandomVariable::ExponentialRandomVariable  ) 
 

Definition at line 108 of file ranvar.cc.

References avg_.

00109 {
00110         bind("avg_", &avg_);
00111 }

ExponentialRandomVariable::ExponentialRandomVariable double   ) 
 

Definition at line 113 of file ranvar.cc.

References avg_.

00114 {
00115         avg_ = avg;
00116 }


Member Function Documentation

virtual double ExponentialRandomVariable::avg  )  [inline, virtual]
 

Implements RandomVariable.

Definition at line 67 of file ranvar.h.

References avg_.

00067 { return avg_; };

double* ExponentialRandomVariable::avgp  )  [inline]
 

Definition at line 66 of file ranvar.h.

References avg_.

Referenced by EXPOO_Traffic::EXPOO_Traffic().

00066 { return &avg_; };

int RandomVariable::command int  argc,
const char *const *  argv
[inherited]
 

Reimplemented in EmpiricalRandomVariable.

Definition at line 32 of file ranvar.cc.

References RandomVariable::rng_, and RandomVariable::value().

Referenced by EmpiricalRandomVariable::command().

00033 {
00034         Tcl& tcl = Tcl::instance();
00035 
00036         if (argc == 2) {
00037                 if (strcmp(argv[1], "value") == 0) {
00038                         tcl.resultf("%6e", value());
00039                         return(TCL_OK);
00040                 }
00041         }
00042         if (argc == 3) {
00043                 if (strcmp(argv[1], "use-rng") == 0) {
00044                         rng_ = (RNG*)TclObject::lookup(argv[2]);
00045                         if (rng_ == 0) {
00046                                 tcl.resultf("no such RNG %s", argv[2]);
00047                                 return(TCL_ERROR);
00048                         }
00049                         return(TCL_OK);
00050                 }
00051         }
00052         return(TclObject::command(argc, argv));
00053 }

Here is the call graph for this function:

int RandomVariable::seed char *   )  [inherited]
 

Definition at line 60 of file ranvar.cc.

References RandomVariable::rng_.

Referenced by EXPOO_Traffic::command().

00060                                 {
00061         
00062         Tcl& tcl = Tcl::instance();
00063 
00064                 rng_ = (RNG*)TclObject::lookup(x);
00065                 if (rng_ == 0) {
00066                         tcl.resultf("no such RNG %s", x);
00067                         return(TCL_ERROR);
00068                 }
00069                 return(TCL_OK);
00070  
00071 }

void ExponentialRandomVariable::setavg double  d  )  [inline]
 

Definition at line 68 of file ranvar.h.

References avg_.

Referenced by EXPOO_Traffic::init().

00068 { avg_ = d; };

double ExponentialRandomVariable::value  )  [virtual]
 

Implements RandomVariable.

Definition at line 118 of file ranvar.cc.

References avg_, RNG::exponential(), and RandomVariable::rng_.

Referenced by EXPOO_Traffic::next_interval().

00119 {
00120         return(rng_->exponential(avg_));
00121 }

Here is the call graph for this function:


Member Data Documentation

double ExponentialRandomVariable::avg_ [private]
 

Definition at line 70 of file ranvar.h.

Referenced by avg(), avgp(), ExponentialRandomVariable(), setavg(), and value().

RNG* RandomVariable::rng_ [protected, inherited]
 

Definition at line 41 of file ranvar.h.

Referenced by RandomVariable::command(), RandomVariable::RandomVariable(), RandomVariable::seed(), EmpiricalRandomVariable::value(), LogNormalRandomVariable::value(), NormalRandomVariable::value(), ParetoIIRandomVariable::value(), ParetoRandomVariable::value(), value(), and UniformRandomVariable::value().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:46:17 2004 for NS2.26SourcesOriginal by doxygen 1.3.3