Sunday, July 12, 2009

[AIT09] instvar classifier_ and next_rtm_ of class RtModule

This question is from Wattanadej

1. Why the instvar classifier_ and next_rtm_ of RtModule(OTcl) are not bind with the variable classifier_ and next_rtm_ of the compiled class(C++)?

2. What is the C++ class corresponding to the OTcl class RtModule?

11 comments:

Anonymous said...

[Nakrop Jinaporn,107936]

From the Question 2,

the C++ class corresponding to the OTcl class RtModule is RoutingModule

Anonymous said...

[Nakrop Jinaporn,107936]

For the Question 2,

In OTcl domain, Class RtModule has two instvars: classifier_ and next_rtm_. Instvar classifier_ stores a reference to the associated classifier. Instvar next_rtm_ provides a support to create a linked list of routing module. This instvar has no relationship with variable next_rtm_ of the compiled class, since the bound is not created in the constructor of the C++ class RoutingModule.

Anonymous said...

[Nakrop Jinaporn,107936]

I am sorry, the second comment is the answer of Question 1.

Anonymous said...

[Wattanadej, 107971]
Yes, they are not related and I understand that the one who makes the simulation run properly is on OTcl side, am I right? What about the C++ side(classifier_ and next_rtm_) what are their duties are their being used or not?

Teerawat Issariyakul said...

It gets interesting isn't it? Let help answer question of Wattanadej.

What are the duties of classifier_ and next_rtm_ in C++ domain?

Unknown said...

The main duty of Variable classifier_ is to point a Classifier object. To provide a single pointer of management for a group of classifiers, and routing modules form a linked list using their pointers next_rtm_ to another RoutingModule object in C++ domain while in OTCL Domain bound to the compiled variable with the same name, instvar classifier_ stores a reference to the associated classifier. Instvar next_rtm_ provides a support to create a linked list of routing module. This instvar has no relationship with variable next_rtm_ of the compiled class, since the bond is not created in the constructor of the C++ class RoutingModule .

RoutingModule::RoutingModule() :
next_rtm_(NULL), n_(NULL), classifier_(NULL) {
bind("classifier_", (TclObject**)&classifier_);
}

RoutingModule is the C++ class which is corresponding to the OTcl class RtModule.

Unknown said...

In C++ variable classifier_ acts as a pointer to a class Classifier object in order to provide a single pointer of management for a group of classifiers, routing modules form a linked list using their pointers next_rtm_ to another class RoutingModule object. Also the variable classifier_ is bound to an OTcl instvar with the same name.

Anonymous said...

[Wattanadej, 107971]

I'm really confuse are they bond together or not? From the code they are not (-//ns/routing/rtmodule.h) or they are not bonded together in the constructure, but it does somewhere else where I don't know?

Anonymous said...

[Nawat,108113]
It is not declared in ~//ns/routing/rtmodule.h, but it is declared in line 140 (constructor of RoutingModule) of file ~//ns/routing/rtmodule.cc

Anonymous said...

[Nawat,108113]
From Shujat's comment, I think that classifier_ is variable used in both hierarchy (compiled and interpreted), so binding has been created in ~//ns/routing/rtmodule.cc.

In contrast, next_rtm_ is variable used in compiled hierarchy only, it is not necessary to create variable in interpreted hierarchy (binding is not created).

Teerawat Issariyakul said...

If you are still confused which question is the correct one, you should look at the comments of your friends, and go through the NS2 code yourself. By seeing the code, you will know the right answer.