[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] add a function to




The command function (provided it is declared in the class-definition)
should be no different from any other class functions.
--Padma.

On Wed, 28 Feb 2001, Chen Wen-Jen wrote:


> hi...
>
> I add a public data member "int test" to drop-tail class.
> (drop-tail.h)
>
> And then, add following codes to drop-tail.cc
> First, at DropTail::command function:
>         if (argc == 3) {
>                 if (strcmp(argv[1], "my_function")==0) {
>                   printf("%d",test);
>                 }
>              }
> Second, at DropTail::enque function
>        test = 10;
>
> Now, every enque action will make test to be 10.
> And then, whenever I invoke "$drop-tail-q1 my_function"
> in my ns script, it should print out 10.
> But this doesn't work.
> It seems that test at enque and command functions are different instance.
> Why?
> and how to get enque function's data within command function?
>
> thanks a lot... :)
>
>                  Jay...
>

-- 
------------------------------------------------
Be true to your work, your word, and your friend.
--Thoreau

Padmaparna Haldar