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

Star Class Reference

#include <srm-topo.h>

Inheritance diagram for Star:

Inheritance graph
[legend]
Collaboration diagram for Star:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Star (int n, int src)
void flood (int, int)
Interface_Listoif (int node, int iif)
double backoff (int dst)
int c ()
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_
SrmNodenode_
int idx_
double delay_
double D_
double frac_
double det_
double rand_
int rtt_est_

Constructor & Destructor Documentation

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

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

References alpha_, beta_, c_, and topology.

00224                              : Topology(n, src) { 
00225                 topology = this; 
00226 
00227                 bind("c_", &c_);
00228                 bind("alpha_", &alpha_);
00229                 bind("beta_", &beta_);
00230         }


Member Function Documentation

double Star::backoff int  dst  )  [virtual]
 

Implements Topology.

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

References alpha_, beta_, c_, Topology::delay(), Topology::det_, Topology::idx(), Topology::rand_, topology, and Random::uniform().

00512 {
00513         double rtt = topology->delay(id, 0);
00514         double rbackoff;
00515         double p = Random::uniform(0.0, 1.0);
00516         static int bin = 0;
00517         int copies = c_;
00518         int size = topology->idx();
00519         
00520         if (p <= copies * 1./size) {
00521                 rbackoff = Random::uniform(0.0, alpha_);
00522                 bin ++;
00523         } else {
00524                 rbackoff = Random::uniform(beta_, 1.0 + beta_);
00525         }
00526         return (rtt * (det_ + rand_ * rbackoff));
00527 }

Here is the call graph for this function:

int Star::c  )  [inline]
 

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

References c_.

00235 { return c_; }

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 backoff(), BTree::backoff(), Line::backoff(), and SrmNode::send().

00145 { return delay_;}

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

Implements Topology.

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

References Topology::D_, and Topology::delay_.

00166 {
00167         if (src == 0 || dst == 0) 
00168                 return D_;
00169         else
00170                 return delay_;
00171 }

void Star::flood int  ,
int 
[virtual]
 

Implements Topology.

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

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

00487 {
00488         SRM_Event *se = new SRM_Event(seqno, SRM_DATA, start);
00489         node_[start].send(se);
00490 }

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 backoff(), and 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 * Star::oif int  node,
int  iif
[virtual]
 

Implements Topology.

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

References Interface_List::append(), Topology::idx(), and topology.

00493 {
00494         int i;
00495         Interface_List *ilist = new Interface_List;
00496 
00497         /* Make a list with every node except myself */
00498         for (i = 0; i < topology->idx(); i ++)
00499         {
00500                 if (i != node && i != iif) {
00501                         ilist->append(i);
00502                 }
00503         }
00504 
00505         return (ilist);
00506 }

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 Line::backoff().

00148 { return rtt_est_; }


Member Data Documentation

double Star::alpha_ [protected]
 

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

Referenced by backoff(), and Star().

double Star::beta_ [protected]
 

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

Referenced by backoff(), and Star().

int Star::c_ [protected]
 

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

Referenced by backoff(), c(), and Star().

double Topology::D_ [protected, inherited]
 

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

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

double Topology::delay_ [protected, inherited]
 

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

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

double Topology::det_ [protected, inherited]
 

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

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

double Topology::frac_ [protected, inherited]
 

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

Referenced by BTree::backoff(), Line::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 Line::oif().

SrmNode* Topology::node_ [protected, inherited]
 

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

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

double Topology::rand_ [protected, inherited]
 

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

Referenced by backoff(), BTree::backoff(), Line::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 Star::src_ [protected]
 

Reimplemented from Topology.

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


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