Interface __ns2 in NS

Source: Internet
Author: User

First Class Interface:

The statement in Tcl:

Set Chan ($j) [New Wimshchannel]

C + + corresponding statement:

1. Define Wimshchannel Class

Class Wimshchannel:public Tclobject {};

2. Do the two-layer interface

Static class Wimshchannelclass:public Tclclass {

Public

Wimshchannelclass (): Tclclass ("Wimshchannel") {}

tclobject* Create (int, const char*const*) {

Return (new Wimshchannel);

}

} Class_wimsh_channel;

Type II Interface:

The statement in Tcl:

$chan ($j) Topology $topo

The corresponding statement in 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;

}

Type III Interface:

TCL in the corresponding statement:

mac/802_11e Set Basicrate_ 1Mb

The corresponding statement in 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_;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.