NS2, Otcl: using a variable of an owned instance within a class
Posted
by Hussain
on Stack Overflow
See other posts from Stack Overflow
or by Hussain
Published on 2010-05-02T11:26:56Z
Indexed on
2010/05/02
11:37 UTC
Read the original article
Hit count: 341
Hello all, I'm using NS2 to create some new classes in C++ and then link them to otcl. The linkage and everything works, but when I try to use the otcl variables in an object, I'm having a trouble.
For example, suppose I have a class "Node" with the variable X. In the code I want to set this value and later on use it in some if-statements.
Setting the variable is no problem using this code: $node1 set x 4
Now the problem I'm having is when I try to use this variable x anywhere. In C++ we could use a general variable (i.e. y) and say "y=node.x and then use y in some if-statements. I have tried to look for a method to perform the same thing in otcl, but failed.
Any help is appriciated.
Thanks in Advance.
© Stack Overflow or respective owner