Agent_List Class Reference

#include <iflist.h>

Inheritance diagram for Agent_List:

From_List In_List Out_List Collaboration diagram for Agent_List:

Collaboration graph
[legend]

Detailed Description

Definition at line 114 of file iflist.h.

Public Member Functions

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

Data Fields

ns_addr_t agent_addr
Agent_Listnext


Constructor & Destructor Documentation

Agent_List::Agent_List  )  [inline]
 

Definition at line 119 of file iflist.h.

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

00119                { 
00120     next = NULL; 
00121     agent_addr.addr_=0;
00122     agent_addr.port_=0;
00123   }

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

Definition at line 125 of file iflist.h.

00125 {}


Member Function Documentation

PrvCurPtr Agent_List::Find Agent_List **  ,
ns_addr_t 
 

Definition at line 91 of file iflist.cc.

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

Referenced by 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 **   ) 
 

Definition at line 77 of file iflist.cc.

References 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
 

Definition at line 58 of file iflist.cc.

References next.

Referenced by Union().

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

void Agent_List::print  )  [virtual]
 

Definition at line 125 of file iflist.cc.

References ns_addr_t::addr_, agent_addr, 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
 

Definition at line 68 of file iflist.cc.

References next.

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

void Agent_List::Union Agent_List **  ,
Agent_List
 

Definition at line 110 of file iflist.cc.

References AGENT_NEXT, AGT_ADDR, PrvCurPtr::cur, Find(), and 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:


Field Documentation

ns_addr_t Agent_List::agent_addr
 

Definition at line 116 of file iflist.h.

Referenced by Agent_List(), and print().

Agent_List* Agent_List::next
 

Definition at line 117 of file iflist.h.

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


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