请转载者注明出处:http://jpingy.spaces.live.com 第一类接口: tcl中的语句: set chan($j) [new WimshChannel] c++对应的语句: 1.定义WimshChannel类 class WimshChannel:public TclObject {}; 2.做好两层的接口 static class WimshChannelClass : public TclClass { public: WimshChannelClass() : TclClass("WimshChannel") {} TclObject* create(int, const char*const*) { return (new WimshChannel); } } class_wimsh_channel; 第二类接口: tcl中的语句: $chan($j) topology $topo c++中对应的语句: int WimshChannel::command(int argc, const char*const* argv) if ( argc == 3 && strcmp (argv[1], "topology") == 0 ) { topology_ = (WimshTopologySimple*) TclObject::lookup(argv[2]); return TCL_OK; } 第三类接口: tcl中对应的语句: Mac/802_11e set basicRate_ 1Mb c++中对应的语句: Tcl& tcl = Tcl::instance(); tcl.evalf("Mac/802_11e set basicRate_"); if (strcmp(tcl.result(), "0") != 0) bind_bw("basicRate_", &basicRate_); else
basicRate_ = bandwidth_; |
沒有留言:
張貼留言