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

Line Class Reference

#include <srm-topo.h>

Inheritance diagram for Line:

Inheritance graph
[legend]
Collaboration diagram for Line:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Line (int n, int src)
void flood (int, int)
Interface_Listoif (int node, int iif)
double backoff (int dst)
double delay (int src, int dst)
int command (int argc, const char *const *argv)
int idx ()
SrmNodenode (int nn)
double delay ()
double D ()
int rtt_estimated ()

Protected Attributes

int src_
int c_
double alpha_
double beta_
int c2func_
SrmNodenode_
int idx_
double delay_
double D_
double frac_
double det_
double rand_
int rtt_est_

Constructor & Destructor Documentation

Line::Line int  n,
int  src
[inline]
 

Definition at line 168 of file srm-topo.h.

References alpha_, beta_, c2func_, c_, and topology.

00168                              : Topology(n, src) { 
00169                 topology = this; 
00170                 bind("c_", &c_);
00171                 bind("alpha_", &alpha_);
00172                 bind("beta_", &beta_);          
00173                 bind("c2func_", &c2func_);              
00174         }


Member Function Documentation

double Line::backoff int  dst  )  [virtual]
 

Implements Topology.

Definition at line 82 of file srm-topo.cc.

References c2func_, CONSTANT, Topology::D_, Topology::delay(), Topology::det_, Topology::frac_, LINEAR, LOG, Topology::rand_, Topology::rtt_estimated(), SQRT, topology, and Random::uniform().

00083 {
00084         double rtt;
00085 
00086         if (topology->rtt_estimated() == 1)
00087                 rtt = delay(dst, 0);
00088         else rtt = D_ * frac_;
00089         double b;
00090         double sqroot = sqrt(rtt);
00091         double r = Random::uniform(0.0, 1.0);
00092 
00093         switch(c2func_) {
00094         case LOG :
00095                 b = rtt * (det_ +  rand_ * r * log(rtt)/log(D_));
00096                 break;
00097         case SQRT :
00098                 b = rtt * (det_ +  rand_ * r * sqroot/sqrt(D_));
00099                 break;
00100         case LINEAR :
00101                 b = rtt * (det_ +  rand_ * r * rtt/D_);
00102                 break;
00103         case CONSTANT :
00104                 b = rtt * (det_ +  rand_ * r * 1.);
00105                 break;
00106         }
00107         return b;
00108 }

Here is the call graph for this function:

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

Definition at line 53 of file srm-topo.cc.

References Topology::flood().

00054 {
00055         //Tcl& tcl = Tcl::instance();
00056         if (argc == 3) {
00057                 if (strcmp(argv[1], "flood") == 0) {
00058                         flood(0, atoi(argv[2]));
00059                         return (TCL_OK);
00060                 }
00061         }
00062         return (TclObject::command(argc, argv));
00063 }

Here is the call graph for this function:

double Topology::D  )  [inline, inherited]
 

Definition at line 146 of file srm-topo.h.

References Topology::D_.

Referenced by BTree::backoff().

00146 { return D_;}

double Topology::delay  )  [inline, inherited]
 

Definition at line 145 of file srm-topo.h.

References Topology::delay_.

Referenced by Star::backoff(), BTree::backoff(), backoff(), and SrmNode::send().

00145 { return delay_;}

double Line::delay int  src,
int  dst
[virtual]
 

Implements Topology.

Definition at line 156 of file srm-topo.cc.

References abs(), Topology::D_, and Topology::delay_.

00157 {
00158         if (src == 0 || dst == 0) 
00159                 return D_ + delay_ * abs(dst - src - 1);
00160         else
00161                 return delay_ * abs(dst - src);
00162 }

Here is the call graph for this function:

void Line::flood int  ,
int 
[virtual]
 

Implements Topology.

Definition at line 197 of file srm-topo.cc.

References Topology::node_, SrmNode::send(), and SRM_DATA.

00198 {
00199         SRM_Event *se = new SRM_Event(seqno, SRM_DATA, start);
00200         node_[start].send(se);
00201 }

Here is the call graph for this function:

int Topology::idx  )  [inline, inherited]
 

Definition at line 142 of file srm-topo.h.

References Topology::idx_.

Referenced by Star::backoff(), and Star::oif().

00142 { return idx_; }

SrmNode * Topology::node int  nn  )  [inherited]
 

Definition at line 65 of file srm-topo.cc.

References Topology::idx_, and Topology::node_.

Referenced by SrmNode::send().

00066 { 
00067         if (nn < 0 || nn >= idx_) return 0;
00068         return &(node_[nn]); 
00069 }

Interface_List * Line::oif int  node,
int  iif
[virtual]
 

Implements Topology.

Definition at line 136 of file srm-topo.cc.

References Interface_List::append(), Topology::idx_, and SRM_NOIF.

00137 {
00138         //int oif;
00139         Interface_List *ilist = new Interface_List;
00140 
00141         /* If there are no more nodes downstream, return -1 */
00142         if ((iif <= node && node >= idx_ - 1) ||  (iif > node && node == 0))
00143                 return 0;
00144 
00145         if (iif == SRM_NOIF) 
00146         {
00147                 ilist->append(node + 1);
00148                 ilist->append(node - 1);
00149         } else if (iif <= node) 
00150                 ilist->append(node + 1);
00151         else 
00152                 ilist->append(node - 1);
00153         return (ilist);
00154 }

Here is the call graph for this function:

int Topology::rtt_estimated  )  [inline, inherited]
 

Definition at line 148 of file srm-topo.h.

References Topology::rtt_est_.

Referenced by BTree::backoff(), and backoff().

00148 { return rtt_est_; }


Member Data Documentation

double Line::alpha_ [protected]
 

Definition at line 182 of file srm-topo.h.

Referenced by Line().

double Line::beta_ [protected]
 

Definition at line 183 of file srm-topo.h.

Referenced by Line().

int Line::c2func_ [protected]
 

Definition at line 184 of file srm-topo.h.

Referenced by backoff(), and Line().

int Line::c_ [protected]
 

Definition at line 181 of file srm-topo.h.

Referenced by Line().

double Topology::D_ [protected, inherited]
 

Definition at line 156 of file srm-topo.h.

Referenced by BTree::backoff(), backoff(), Topology::D(), BTree::delay(), Star::delay(), delay(), and Topology::Topology().

double Topology::delay_ [protected, inherited]
 

Definition at line 155 of file srm-topo.h.

Referenced by Topology::delay(), BTree::delay(), Star::delay(), delay(), and Topology::Topology().

double Topology::det_ [protected, inherited]
 

Definition at line 158 of file srm-topo.h.

Referenced by Star::backoff(), BTree::backoff(), backoff(), and Topology::Topology().

double Topology::frac_ [protected, inherited]
 

Definition at line 157 of file srm-topo.h.

Referenced by BTree::backoff(), backoff(), and Topology::Topology().

int Topology::idx_ [protected, inherited]
 

Definition at line 152 of file srm-topo.h.

Referenced by Topology::idx(), Topology::node(), and oif().

SrmNode* Topology::node_ [protected, inherited]
 

Definition at line 151 of file srm-topo.h.

Referenced by Star::flood(), BTree::flood(), flood(), Topology::node(), Topology::Topology(), and Topology::~Topology().

double Topology::rand_ [protected, inherited]
 

Definition at line 159 of file srm-topo.h.

Referenced by Star::backoff(), BTree::backoff(), backoff(), and Topology::Topology().

int Topology::rtt_est_ [protected, inherited]
 

Definition at line 160 of file srm-topo.h.

Referenced by Topology::rtt_estimated(), and Topology::Topology().

int Line::src_ [protected]
 

Reimplemented from Topology.

Definition at line 180 of file srm-topo.h.


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