[ns] Passing NS object into another class

Peter Dimopoulos dimpet at cs.rmit.edu.au
Thu Jan 29 20:53:09 PST 2004


What is the correct way to pass the ns object into another class that uses it?

I want to have a new class in a separate file from my main ns script that uses 
the ns object. The ns object is passed in the constructor of the new class.

Eg
File 1 
-------
set ns [new Simulator]


set nonSrc [new NonPerSource ns $ftp]

File 2
-------

Class NonPerSource

NonPerSource instproc init { ns ftp }
{
   $ns at 0.001 "$ftp start"
}


When I do something like this I get 
backwards compatability warnings for some reason and this cause my tcl script 
that is executing the "File 1" with an exec to exit with an error.

Any ideas on how to get around this?

Thanks



----------------------------
Peter Dimopoulos
Computer Science Phd
RMIT University



More information about the Ns-users mailing list