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

Re: [ns] How to introduce a new OTcl class that inherist from class Node?



Did you take a look at the constructor of the link classes. Tehy are quite
useful/ 

Debo 

On Mon, 24 Sep 2001, Raffaele Bruno wrote:

> Hi all,
> 
> I am a novice to ns-2.1b7a and I am in a great trouble. I have to define in OTcl a
> new Class BTNode that inherits from the Class Node. To this end I wrote a
> file ns-btnode.tcl
> 
> Class BTNode  - superclass Node
> 
> BTNode instproc init {ipAddr bdAddr Xpos Ypos} {
>     eval $self next $ipAddr
>     $self instvar bthost_ btbaseband_ classifier_
>     .........
> }
> 
> I sourced the file in ns-lib.tcl and introduced it in the Makefile. I have
> also written several C++ classes and methods. The compile phase does not
> give problem. However, when I execute a testing script with the following command:
> 
> set btnode0 [new BTNode 0 0 0 0] #node with IP_addr=0 e BD_addr=0 in position 0,0
> 
> on the output all the tcl files sourced in the ns-lib.tcl file before my ns-btnode.tcl are printed and I received the following error
> :
>  uneven number of args
>     (Object init line 1)
>     invoked from within
> "BTNode init - superclass Node"
>     (Class create line 1)
> invoked from within
> "Class create BTNode - superclass Node"
>     ("eval" body line 1)
>     invoked from within
> "eval [list $self] create [list $m] $args
>     (procedure "class" line 5)
>     (Class unknown line 5)
>     invoked from within
> "Class BTNode - superclass Node"
> 
> I believe that the problem is in the invocation of the constructor for class Node, ie, eval $self next $ipAddr . 
> 
> Any suggestions will be greatly appreciated
> 
> Raffaele
> ps: I have adopted the same syntax that I have found in the the Bluehoc code for the declaration of a new class that inherits from the Class Node. It works for Bluehoc (I have installed it successfully), I do not understand why it doesn't work in my case.
> 
> 
> 
>