[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble with bind




John:
Thanks for the reply.

  >> It sounds like the otcl inheritance is not working correctly.
  >> Since it works for other classes, I recommend you check how you're
  >> declaring your derived class's TclClass.

RenoTcpAgent is a little differnt from what I am doing. 
The Reno example is a case where class B is a superclass of class A,
and B::B() performs the bind. No bind erros occur here.
RenoTcpAgent example is something like:

  class A : public B { ...

In my case, object A  *contains*  object B (not inherited from),
and B performs the binds. This is as follows:

  class A : {
             class B* b_object;
   }

B::B() perfoms a bind. The bind error occurs when executing B().
This is what results in bind errors (example in the code at the end of message).
Note that classes A and B are both declared in C++.
In Otcl, we define such structures, without getting bind errors. 
However, this was the first time, I tried to do it in C++.

Do you know an examples of such structures in the C++ part of ns-2 ?
I will look it up. Like I said, RenoTcpAgent does not do this. Also, 
I do not recall seeing anything similar in other ns-2 code that I
have seen so far. One example that comes close is in snoop.cc
where several Snoop objects are defined within a LL/LLSnoop object,
and Snoop() does binds. However. the Snoop objects are created
in an Otcl proc, not in C++ procedure.

By the way, I tried to add a member of type DropTail to a
completely different class declaration, to see if the problem
would repeat itself there - it does repeat. So I am more inclined
to think that the bug is not in my code. Of course, I have
been shown wrong before -:)

Regards.

- nitin

P.S. - In my code, NewClass is actually named DropTailLL,
       although I do not think that is relevant.
      

  >> X-url: http://www.isi.edu/~johnh/
  >> To: Nitin Vaidya <Nitin.Vaidya@Eng>
  >> Cc: [email protected]
  >> Subject: Re: trouble with bind 
  >> Date: Mon, 17 Aug 1998 22:14:30 -0700
  >> From: John Heidemann <[email protected]>
  >> 
  >> On Sat, 15 Aug 1998 15:27:32 PDT, Nitin Vaidya wrote: 
  >> >John:
  >> >Continuing on my previous mail ...
  >> >
  >> >I may have been too quick to decide that the bug was with my makedepend.
  >> >Turns out that the scenario I described below still reappears. Here is 
what
  >> >makes the error go away (please refer the code in attached mail).
  >> >If I add to ns-defaults.tcl
  >> >	NewClass set drop-front_ false
  >> >the error goes away.
  >> >This is strange, as drop-front_ is not a member of
  >> >or accessed in NewClass (or any member functions). I also did a grep
  >> >for "drop-front_" to see if it was being accessed in any other
  >> >tcl files in tcl/*/* or ns-2/*.h,*.c - not accessed anywhere.
  >> >
  >> >I do see why I would need
  >> >    	DropTail set drop-front_ false
  >> >    &   a corresponding bind in DropTail()
  >> >but do not see why I need a similar declaration in NewClass.
  >> >
  >> >May be I am doing something wrong ... but could not figure out what
  >> >that is.
  >> >
  >> >Regards.
  >> >
  >> >- nitin
  >> >
  >> >
  >> >
  >> >  >>   >> 
  >> >  >>   >> At 04:16 PM 8/14/98 -0700, Nitin Vaidya wrote:
  >> >  >>   >> >
  >> >  >>   >> >
  >> >  >>   >> >I seem to have come across a feature/bug in bind, perhaps due 
to 
  >> >misuse
  >> >  >>   >> >on my part.
  >> >  >>   >> >
  >> >  >>   >> >
  >> >  >>   >> >Here is my scenario:
  >> >  >>   >> >
  >> >  >>   >> >   DropTail::DropTail() {
  >> >  >>   >> >	...
  >> >  >>   >> >	bind("drop-front_", &drop_front_);
  >> >  >>   >> >	...
  >> >  >>   >> >   }
  >> >  >>   >> >   
  >> >  >>   >> >   
  >> >  >>   >> >   NewClass::NewClass() {
  >> >  >>   >> >   
  >> >  >>   >> >   	DropTail *Q = new DropTail;
  >> >  >>   >> >   	
  >> >  >>   >> >   } new_class ;
  >> >  >>   >> >   
  >> >  >>   >> >   
  >> >  >>   >> > When the constructor for "new_class" is executed, I get the
  >> >  >>   >> > runt-time warning  
  >> >  >>   >> > 
  >> >  >>   >> >      warning: no class variable NewClass::drop-front_
  >> >  >>   >> > 
  >> >  >>   >> > Why does this warning appear?
  >> >  >>   >> > The warning is issued when executing the "bind" when the 
constructor
  >> >  >>   >> > for object Q (class DropTail) is executed.
  >> >  >>   >> > If the constructor is for DropTail class, why does the Warning 
refer 
  >> >to
  >> >  >>   >> > class NewClass ?
  >> >  >>   >> > NewClass does not declare or use drop-front_ anywhere.
  >> >  >>   >> > 
  >> >  >>   >> > Any clarification would be appreciated.
  >> >  >>   >> > 
  >> >  >>   >> > Regards.
  >> >  >>   >> > 
  >> >  >>   >> > - nitin
  >> >  >>   >> > 
  >> >  >>   >> >
  >> >  >>   >> >
  >> >  >> 
  >> >
  >> 
  >> It sounds like the otcl inheritance is not working correctly.
  >> Since it works for other classes, I recommend you check how you're
  >> declaring your derived class's TclClass.
  >> 
  >> You can compare how TcpRenoClass is done as a sub-class of TcpClass.
  >> 
  >>    -John Heidemann