[ns] passing variables in C++ to Otcl
al ch
mlgbwk at hotmail.com
Tue Oct 14 18:48:57 PDT 2008
Hello,
I want to pass some variables from C++ to otcl.
they are defined in .tcl file at the beginning of simulation as:
$myagent set my_var1_otcl 2$myagent set my_var2_otcl 3.14
These variables will be updated during simulation so their value will change at the end of simulation, in my c++ file,
MyAgent::MyAgent() : Agent(PT_UDP) { bind("my_var1_otcl", &my_var1); bind("my_var2_otcl", &my_var2);}
void MyAgent::computation(void) {
my_var1 = my_var1 + +;my_var2 = my_var1*2;
}
But when I print the value of my_var1 and my_var2 in tcl at the end of simulation by:
puts "$my_var1 $my_val2"
their values seem never updated, however when I use printf in c++ to debug , theie values did change.
Anyone can tell me what's the problem?
Thanks!
Tony
_________________________________________________________________
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/
More information about the Ns-users
mailing list