Hi Itishi, thx again for the reply, 
actually it appears that the problem that i have been stacked in for a month 😞 
is that the function static Node* get_node_by_address(nsaddr_t);

is static so it can be called by itself independently of any object by using 
the class name and the scope resolution operator, 
so i can call it from the aodv.cc and then do the rest of the work.
thanks 😊. 
Xoce.

Date: Sat, 20 Apr 2013 20:42:17 +0800
From: itish...@yahoo.com
Subject: Re: [ns] How to get a reference of a node from AODV?‏
To: jose-...@hotmail.com; ns-users@ISI.EDU

        Hi Jose, Using the following function definition you can create object 
of the node class.now using the c_node object of the node class you can access 
methinds of the node class.  Node* c_node=Node::get_node_by_address(index);   
Regards,Itishi
        From: jose nmrd <jose-...@hotmail.com>
 To: itishi saxena <itish...@yahoo.com> 
 Sent: Thursday, 18 April 2013 12:03 PM
 Subject: RE: [ns] How to get a reference of a node from AODV?‏
   



Hi Itishi and thanks for the reply,
i know i have to create objects to access them, but currently in the class 
AODV.cc there only one variable index of type nsaddr_t which represents the 
address of the node [nsaddr_t        index;                    // IP Address of 
this node] but i don't know how to get the whole structure of Node because with 
this variable index i can't access the attributes of the node. in other words 
how to access classes AODV.cc and Node.cc from one to another? just by making 
them friends? 
for
 example if i put: $ns node-config -adhocRouting AODV, 
if i have a node N0 i want to get access to it from the AODV attached to it. 
Thank you very much again.
Xoce.

Date: Thu, 18 Apr 2013 06:31:23 +0800
From: itish...@yahoo.com
Subject: Re: [ns] How to get a reference of a node from AODV?‏
To: jose-...@hotmail.com; ns-users@ISI.EDU

Hello Jose,

For getting access to the node attribut you have to play with node.cc inside 
common folder in ns-2.34.

It is basically how you
 access method of one class toanother in c++.

so you have two classes aodv.cc and node.cc

you have to create object of one of them to access methods and they have to be 
friend of each other.

I hope it will give you sufficient hint for your task.


Itishi


        From: jose nmrd <jose-...@hotmail.com>

 To: "ns-users@isi.edu" <ns-users@ISI.EDU> 
 Sent: Wednesday, 17 April 2013 5:30 PM
 Subject: [ns] How to get a reference of a node from AODV?‏
   





Hi everyone,
here is the problem, i have added some 
code to the class Node to do some computations, i'm modifying the 
protocol AODV where i have to use the computations added in the class 
Node, but after looking at the class AODV composition there is just the 
address of the Node, not the reference to the whole structure of the 
Node. so my question is how to get the reference of the node that the 
AODV agent is associated to so that i can access the attributes and 
functions and of course my added code of the class Node? if any one can 
help,
 thx in advance
 .
Xoce.                           

                                          


                                          

Reply via email to