[ns] a loop or a start and stop methods

Nabila khedimi khedimi at hotmail.com
Thu Nov 8 10:15:31 PST 2007


Hi,
I want to execute a ping agent continuously during the simulation, regarding the schedular object in NS, is there any the difference between making a infinite loop inside the tcl code or define a start and a stop method inside the ping agent code(which is a c++ program)
Thanks for help
Nabila
 
> To: khedimi at hotmail.com; ns-users at isi.edu> Subject: RE: [ns] access to TCL instance variables> From: teerawat at ece.ubc.ca> Date: Tue, 6 Nov 2007 10:05:46 -0800> > > Nabila,> > To print the value, you may do something like> > puts [$myagent set myvar_]> > Cheers,> Teerawat> > On 11/6/2007, "Nabila khedimi" <khedimi at hotmail.com> wrote:> > >> >This is what I did, we can set a value to the variable like you did but how to get its value, for printing for example> > > >> To: khedimi at hotmail.com; ns-users at ISI.EDU> Subject: Re: [ns] access to TCL instance variables> From: teerawat at ece.ubc.ca> Date: Tue, 6 Nov 2007 08:13:30 -0800> > > Hi Nabila,> > First of all, you need to bind your OTcl class Agent/MyAgentOtcl to, for> example, MyAgent. Secondly, suppose you need to access variable my_var_> of class MyAgent. You need to bind this variable to the OTcl domain.> This can be done in the constructor:> > MyAgent:MyAgent()> {> bind("my_var_", &my_var_);> }> > Then you will be able to access varaible my_var_ from the OTcl domain:> > set myagent [new Agent/MyAgentOtcl]> $myagent set my_var_ 10> > Good Luck> Teerawat> > On 11/6/2007, "Nabila khedimi" <khedimi at hotmail.com> wrote:> > >> >> >Hi,How do we access instance variables of a c++ class in tcl code I tried thefolowing: set myagent [new Agent/MyAgentOtcl]# Set configurable parameters of MyAgent$myagent set my_var1_otcl 4$myagent set my_var2_otcl 3.14$myagent call-my-priv-funcset intvar 0set intvar [Agent/MyAgentOtcl my_var1_otcl] puts "my_var1_otcl = $intvar" I have had this:my_var1_otcl= my_var1_otclthe name instead of th value, what's the problem, neither set intvar $myagent my_var1_otcl works Thanks for helpnabila> >_________________________________________________________________> >Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now.> >http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033> >> >_________________________________________________________________> >Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare!> >http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline


More information about the Ns-users mailing list