Out_List Class Reference

#include <iflist.h>

Inheritance diagram for Out_List:

From_List Agent_List Collaboration diagram for Out_List:

Collaboration graph
[legend]

Detailed Description

Definition at line 148 of file iflist.h.

Public Member Functions

void CalRange ()
PrvCurPtr Find (Agent_List **, ns_addr_t)
void FreeAll (Agent_List **)
void InsertFront (Agent_List **, Agent_List *)
void NormalizeGradient ()
 Out_List ()
virtual void print ()
void Remove (Agent_List **, Agent_List *)
void Union (Agent_List **, Agent_List *)
Out_ListWhereToGo ()
virtual ~Out_List ()

Data Fields

ns_addr_t agent_addr
double from
float gradient
bool is_sink
Agent_Listnext
int num_data_send
int num_neg_recv
int num_pos_recv
int rank
double timeout
double to


Constructor & Destructor Documentation

Out_List::Out_List  )  [inline]
 

Definition at line 158 of file iflist.h.

References from, gradient, num_data_send, num_neg_recv, num_pos_recv, timeout, and to.

00158              : From_List() { gradient = 0; from=0.0; to=0.0; num_data_send=0; 
00159                              timeout = 0.0; num_neg_recv = 0; num_pos_recv=0;}

virtual Out_List::~Out_List  )  [inline, virtual]
 

Definition at line 160 of file iflist.h.

00160 {}


Member Function Documentation

void Out_List::CalRange  ) 
 

Definition at line 172 of file iflist.cc.

References FROM_SLOT, GRADIENT, OUT_NEXT, and TO_SLOT.

00173 {
00174   Out_List *cur_out=this;
00175   double cur_slot=0.0;
00176 
00177   for (cur_out = this; cur_out != NULL; cur_out = OUT_NEXT(cur_out) ) {
00178 
00179     if ( GRADIENT(cur_out) <= 0.0 ) {
00180       FROM_SLOT(cur_out) = -1.0;
00181       TO_SLOT(cur_out) = -1.0;
00182       continue;
00183     }
00184 
00185     FROM_SLOT(cur_out) = cur_slot;
00186     cur_slot = cur_slot + GRADIENT(cur_out);
00187     TO_SLOT(cur_out) = cur_slot;
00188   }   
00189 
00190   return;
00191 }

PrvCurPtr Agent_List::Find Agent_List **  ,
ns_addr_t 
[inherited]
 

Definition at line 91 of file iflist.cc.

References ns_addr_t::addr_, PrvCurPtr::cur, Agent_List::next, NODE_ADDR, PORT, ns_addr_t::port_, and PrvCurPtr::prv.

Referenced by Agent_List::Union().

00092 {
00093   PrvCurPtr RetVal;
00094   Agent_List **prv, *cur;
00095 
00096   for (prv= start, cur=*start; cur != NULL; prv= &(cur->next), cur=cur->next) {
00097     if ( NODE_ADDR(cur) == addr.addr_ && PORT(cur)==addr.port_) 
00098       break;
00099   }
00100  
00101   RetVal.prv = prv;
00102   RetVal.cur = cur;
00103 
00104   return RetVal;
00105 }

void Agent_List::FreeAll Agent_List **   )  [inherited]
 

Definition at line 77 of file iflist.cc.

References Agent_List::next.

00078 {
00079   Agent_List *temp;
00080   Agent_List *next;
00081 
00082   for (temp = *prev; temp != NULL; temp=next) {
00083     next = temp->next;
00084     delete temp;
00085   }
00086 
00087   *prev = NULL;
00088 }

void Agent_List::InsertFront Agent_List **  ,
Agent_List
[inherited]
 

Definition at line 58 of file iflist.cc.

References Agent_List::next.

Referenced by Agent_List::Union().

00059 {
00060   if (cur == NULL)
00061      return;
00062 
00063   cur->next = *start;
00064   *start = cur;
00065 }

void Out_List::NormalizeGradient  ) 
 

Definition at line 194 of file iflist.cc.

References GRADIENT, num, and OUT_NEXT.

00195 {
00196   Out_List *cur;
00197   float sum=0.0;
00198   int   num=0; 
00199 
00200   for (cur=this; cur!=NULL; cur=OUT_NEXT(cur)) {
00201     sum = sum + GRADIENT(cur);
00202     num++;
00203   }
00204 
00205   if (num == 0) return;
00206 
00207   if (sum == 0.0) {
00208     float share= 1.0/num;
00209 
00210     for (cur=this; cur != NULL; cur = OUT_NEXT(cur)) {
00211       GRADIENT(cur) = share;
00212     }
00213     
00214     return;
00215   }
00216 
00217   for (cur=this; cur != NULL; cur = OUT_NEXT(cur)) {
00218     GRADIENT(cur) = GRADIENT(cur)/sum;
00219   }
00220 }

void Agent_List::print  )  [virtual, inherited]
 

Definition at line 125 of file iflist.cc.

References ns_addr_t::addr_, Agent_List::agent_addr, Agent_List::next, and ns_addr_t::port_.

00126 {
00127   Agent_List *cur;
00128 
00129   for (cur=this; cur!=NULL; cur=cur->next) {
00130     printf("(%d,%d)\n", cur->agent_addr.addr_, cur->agent_addr.port_);
00131   }
00132 }

void Agent_List::Remove Agent_List **  ,
Agent_List
[inherited]
 

Definition at line 68 of file iflist.cc.

References Agent_List::next.

00069 {
00070   if (cur == NULL)
00071     return;
00072 
00073   *prev = cur->next;  
00074 }

void Agent_List::Union Agent_List **  ,
Agent_List
[inherited]
 

Definition at line 110 of file iflist.cc.

References AGENT_NEXT, AGT_ADDR, PrvCurPtr::cur, Agent_List::Find(), and Agent_List::InsertFront().

00111 {
00112   PrvCurPtr RetVal;
00113   Agent_List *dupAgent;
00114   
00115   for (Agent_List *cur=list1; cur != NULL; cur=AGENT_NEXT(cur)) {
00116     RetVal = Find(result, AGT_ADDR(cur));
00117     if (RetVal.cur == NULL) {
00118       dupAgent = new Agent_List;
00119       *dupAgent = *cur;
00120       InsertFront(result, dupAgent);
00121     }
00122   }
00123 }

Here is the call graph for this function:

Out_List * Out_List::WhereToGo  ) 
 

Definition at line 155 of file iflist.cc.

References FROM_SLOT, OUT_NEXT, TO_SLOT, and Random::uniform().

00156 {
00157   Out_List *cur_out;
00158   double slot = Random::uniform();
00159 
00160   for (cur_out = this; cur_out!=NULL; cur_out = OUT_NEXT(cur_out) ) {
00161     if (slot >= FROM_SLOT(cur_out) && slot < TO_SLOT(cur_out) )
00162       return cur_out;
00163   }
00164 
00165   if (cur_out == NULL && this != NULL)
00166     printf("Something must be wrong! \n");
00167 
00168   return cur_out;
00169 }

Here is the call graph for this function:


Field Documentation

ns_addr_t Agent_List::agent_addr [inherited]
 

Definition at line 116 of file iflist.h.

Referenced by Agent_List::Agent_List(), and Agent_List::print().

double Out_List::from
 

Definition at line 152 of file iflist.h.

Referenced by Out_List().

float Out_List::gradient
 

Definition at line 150 of file iflist.h.

Referenced by DiffusionProb::CalGradient(), and Out_List().

bool From_List::is_sink [inherited]
 

Definition at line 140 of file iflist.h.

Referenced by DiffusionProb::add_outlist(), DiffusionProb::consider_new(), DiffusionProb::consider_old(), and From_List::From_List().

Agent_List* Agent_List::next [inherited]
 

Definition at line 117 of file iflist.h.

Referenced by Agent_List::Agent_List(), DiffusionRate::consider_new(), DiffusionProb::consider_new(), DiffusionProb::consider_old(), OmniMcastAgent::ConsiderNew(), FloodingAgent::ConsiderNew(), Agent_List::Find(), Agent_List::FreeAll(), Agent_List::InsertFront(), Agent_List::print(), and Agent_List::Remove().

int Out_List::num_data_send
 

Definition at line 154 of file iflist.h.

Referenced by DiffusionProb::ForwardData(), and Out_List().

int Out_List::num_neg_recv
 

Definition at line 155 of file iflist.h.

Referenced by Out_List().

int Out_List::num_pos_recv
 

Definition at line 156 of file iflist.h.

Referenced by Out_List().

int From_List::rank [inherited]
 

Definition at line 139 of file iflist.h.

Referenced by DiffusionProb::add_outlist(), DiffusionProb::CalGradient(), DiffusionProb::consider_new(), DiffusionProb::consider_old(), and From_List::From_List().

double Out_List::timeout
 

Definition at line 151 of file iflist.h.

Referenced by Out_List().

double Out_List::to
 

Definition at line 153 of file iflist.h.

Referenced by Out_List().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:23:45 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6