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

Integrator Class Reference

#include <integrator.h>

Inheritance diagram for Integrator:

Inheritance graph
[legend]
Collaboration diagram for Integrator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Integrator ()
void set (double x, double y)
void newPoint (double x, double y)
int command (int argc, const char *const *argv)

Protected Attributes

double lastx_
double lasty_
double sum_

Constructor & Destructor Documentation

Integrator::Integrator  ) 
 

Definition at line 51 of file integrator.cc.

References lastx_, lasty_, and sum_.

00051                        : lastx_(0.), lasty_(0.), sum_(0.)
00052 {
00053         bind("lastx_", &lastx_);
00054         bind("lasty_", &lasty_);
00055         bind("sum_", &sum_);
00056 }


Member Function Documentation

int Integrator::command int  argc,
const char *const *  argv
 

Definition at line 72 of file integrator.cc.

References newPoint(), and set().

00073 {
00074         if (argc == 2) {
00075                 if (strcmp(argv[1], "reset") == 0) {
00076                         set(0., 0.);
00077                         return (TCL_OK);
00078                 }
00079         } else if (argc == 4) {
00080                 if (strcmp(argv[1], "newpoint") == 0) {
00081                         double x = atof(argv[2]);
00082                         double y = atof(argv[3]);
00083                         newPoint(x, y);
00084                         return (TCL_OK);
00085                 }
00086         }
00087         return (TclObject::command(argc, argv));
00088 }

Here is the call graph for this function:

void Integrator::newPoint double  x,
double  y
 

Definition at line 65 of file integrator.cc.

References lastx_, lasty_, and sum_.

Referenced by command(), QueueMonitor::drop(), QueueMonitor::in(), and QueueMonitor::out().

00066 {
00067         sum_ += (x - lastx_) * lasty_;
00068         lastx_ = x;
00069         lasty_ = y;
00070 }

void Integrator::set double  x,
double  y
 

Definition at line 58 of file integrator.cc.

References lastx_, lasty_, and sum_.

Referenced by command().

00059 {
00060         lastx_ = x;
00061         lasty_ = y;
00062         sum_ = 0.;
00063 }


Member Data Documentation

double Integrator::lastx_ [protected]
 

Definition at line 49 of file integrator.h.

Referenced by Integrator(), newPoint(), and set().

double Integrator::lasty_ [protected]
 

Definition at line 50 of file integrator.h.

Referenced by Integrator(), newPoint(), and set().

double Integrator::sum_ [protected]
 

Definition at line 51 of file integrator.h.

Referenced by Integrator(), newPoint(), and set().


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