[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] question about error in variable accessing via TCL
Try
virtual void delay_bind_init_all();
virtual int delay_bind_dispatch(const char *varName, const char
*localName, TclObject *tracer);
in the header file.
You should also define zz_ in the header file.
It might also help to take a look at how for example the variable
"window_" is defined in tcp.h & tcp.cc and ns_defaults.
On Wed, 26 Dec 2001, Joo-Han Song wrote:
> Thanks Navid for your reply.
> But I can't fix my problem, error messages are still same.
>
> As like what you said, I defined two member funtions at aodv.h
> like
>
> void delay_bind_init_all();
> int delay_bind_dispatch(const char *varName, const char *localName, TclObject *tracer);
>
> and did as following at aodv.c
>
> void
> AODV::delay_bind_init_all()
> {
> delay_bind_init_one("zz_");
> }
>
> int
> AODV::delay_bind_dispatch(const char *varName, const char *localName, TclObject *tracer)
> {
> if(delay_bind(varName, localName, "zz_", &zz_, tracer))
> return TCL_OK;
> }
>
> Sorry to bother you again but actually even I am not sure why I have to do like this.
> Thank you and hope you could have some spare time for answering.
>
> Joo-Han
>
> ----- Original Message -----
> From: "Navid Ehsan" <[email protected]>
> To: "Joo-Han Song" <[email protected]>
> Cc: "ns-users" <[email protected]>
> Sent: Wednesday, December 26, 2001 2:44 PM
> Subject: Re: [ns] question about error in variable accessing via TCL
>
>
> > You should define the variable in the header file.
> > Then in .cc file use
> >
> > delay_bind_init_one("zz_");
> > in
> > ?????::delay_bind_init_all()
> >
> > and
> >
> > if (delay_bind(varName, localName, "zz_", &zz_, tracer)) return
> > TCL_OK;
> > in
> > ?????::delay_bind_dispatch(const char *varName, const char
> > *localName, TclObject *tracer)
> >
> > Hope it helps.
> > -Navid
> >
> > On Wed, 26 Dec 2001, Joo-Han Song wrote:
> >
> > > HI users,
> > >
> > > I tried to create a new variable zz_ in C++ and want to bind it to zz_ in otcl.
> > > This variable is protected member variable of AODV class of type Agent/AODV, so I set
> > >
> > > Agent/AODV set zz_ 1 in ~ns/lib/ns-default.tcl.
> > >
> > > In the file ~ns/aodv/aodv.h, I defined the var zz_ as integer, and bound it in ~ns/aodv/aodv.cc by
> > >
> > > bind("zz_", &zz_).
> > >
> > > But, when I try to access the variable zz_ in my test script like
> > >
> > >
> > > set testing [new Agent/AODV]
> > >
> > > $testing set zz_
> > >
> > >
> > > it gave an error saying like following.
> > >
> > > can't read "zz_": no such variable
> > > while executing
> > > "subst $[subst $var"
> > > (procedure "_o1175" line 5)
> > > (Object next line 5)
> > > invoked from within
> > > "_o1175 next zz_"
> > > ("eval" body line 1)
> > > invoked from within
> > > "eval $self next $args"
> > > (procedure "_o1175" line 18)
> > > (Agent set line 18)
> > > invoked from within
> > > "$testing set zz_"
> > > (file "50_40_100_aodv_final_m.tcl" line 137)
> > >
> > >
> > > Any help will be really appreciated.
> > > Thank you.
> > >
> > > Joo-Han
> > >
> >
>