[ns] Question about get-link-head error.
Sun Weiqiang
sunwq@mail.ustc.edu.cn
Sun Apr 28 18:25:02 2002
hi All,
I did the following to define a node:
in C++:
DWDMNodeClass() : TclClass("Node/DWDM") {}
in tcl:
Node/DWDM instproc init args {
eval $self next $args
#...
}
Simulator instproc RWAnode args {
$self instvar linked_DWDMnodes_
set tmp [Simulator set node_factory_]
Simulator set node_factory_ Node/DWDM
set n [$self node]
lappend linked_DWDMnodes_ $n
Simulator set node_factory_ $tmp
return $n
}
and in my simulation scripts:
set ns [new Simulator]
set n1 [$ns RWAnode]
set n2 [$ns RWAnode]
I can see that my c++ code was put into the class hierarchy,
but when I do the routing staff on such nodes, I got the following error:
$ns rtproto DV
$ns compute-routes
ns: [Simulator instance] get-link-head -1 1: can't read "link_(-1:1)": no such element in array
while executing
"$link_($n1:$n2) head"
(procedure "_o4" line 3)
(Simulator get-link-head line 3)
invoked from within
"[Simulator instance] get-link-head -1 1"
It seems that something wrong with the hash value of such node objects when handled by tcl
(ie. Tcl_CreateHashEntry and Tcl_SetHashValue).
What should I do to solve this problem?
Thank you for your time,
Weiqiang