NS中的接口

    xiaoxiao2021-03-25  100

    第一类接口:

    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_;

    转载请注明原文地址: https://ju.6miu.com/read-19149.html

    最新回复(0)