[ns] Example of Simple Timer
Scott Novich
boomtechnology at gmail.com
Mon Sep 8 09:05:12 PDT 2008
Hi Mubashir!
Many many thanks! I'll be heading in to try this out in a bit.
I have two questions about this -
- First, in MyTimer(AODV* ms) - so some sort of an agent class must be
provided? (I saw this in the manual but did not understand why) I'm guessing
it doesn't matter what agent, but do you know why this is?
- Second, what is the variable "check" used for, and where is it be defined?
Once again, thanks so much for your help!
Best,
Scott
On Mon, Sep 8, 2008 at 2:03 AM, Mubashir Rehmani <mshrehmani at gmail.com>wrote:
> Hi Scott Novich
>
> Here is the example of simple timer
>
>
> *Declare this timer in the header fil**e*
>
>
> class MyTimer : public TimerHandler {
> public:
>
> MyTimer(AODV* ms) : TimerHandler() {ms_=ms;};
>
> protected:
> virtual void expire(Event* e);
> AODV* ms_;
>
>
> };
>
>
> MyTimer MS_timer_;
>
>
> *Declare in the .cc file *
>
> void MyTimer::expire(Event*) {
>
>
> if(check==0)
> {
> ms_->MS_timer_.resched(10); //delay of 10 seconds
> cout<<"time is : "<<Scheduler::instance().clock()<<endl;
> //call any function which you want to schedule....
> }
> }
>
>
>
> Hope it satisfies your needs.
>
> Regards
>
>
>
> --
> Mubashir Husain Rehmani
>
> Mobile : 00 33 (0)6 32 00 89 35
>
>
More information about the Ns-users
mailing list