Well, to define a timer I used instructions: http://www.cubinlab.ee.unimelb.edu.au/~jrid/Docs/Manuel-NS2/node105.html like this: class MyTimer : public TimerHandler { public: MyTimer(MyAgentClass *a) : TimerHandler() { a_ = a; } virtual double expire(Event *e); protected: MyAgentClass *a_; };
Then define expire: MyTimer::expire(Event *e) { // do the work // return TIMER_HANDLED; // =\> do not reschedule timer // return delay; // =\> reschedule timer after delay } However, I want to change some variables of my Agent from inside my timer, and whenever I change them, this changes do not take effect outside the timer. For example, suppose I have a boolean variable called beTentativeHead in my agent, and before entering the timer::expire, it was false. If I try to set it true from inside timer::expire with : a_->beTentativeHead=true, it will remain true inside timer::expire, but if I try to access this variable inside my Agent, its value remains as the old false. Any idea of how should I proceed to solve this? I tried using a double pointer to my agent, even though I thought it was not necessary, and it did not work very well, anyway. Thanks in advance, -- Fernando Henrique Gielow - UFPR - NR2 Computer Science graduation student.