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

Re: [ns] Timers Constructor??????



MyTimer Timer_Instance;  // merely declares data of type MyTimer.
                         // ok inside a struct or class definition.
                         // e.g the definition of MyAgent in tcp.h

// Before you use the Timer_Instance, you need to instantiate it with
// the correct call to its constructor. hence you need to call the
// following in the constructor of MyAgent (in tcp.cc):

Timer_Instance(this);

// hope this answers your question.

-neeraj

>From: Anis Koubaa <[email protected]>
>To: [email protected]
>Subject: [ns] Timers Constructor??????
>Date: Wed, 26 Apr 2000 13:03:53 +0200
>MIME-Version: 1.0
>Received: from [128.32.130.10] by hotmail.com (3.2) with ESMTP id 
>MHotMailBAD01D380090D82197A78020820A0D540; Wed Apr 26 04:25:47 2000
>Received: (from majrdomo@localhost)by mash.CS.Berkeley.EDU (8.9.3/8.9.1) id 
>EAA51662for ns-users-list; Wed, 26 Apr 2000 04:04:37 -0700 (PDT)
>Received: from lorraine.loria.fr (lorraine.loria.fr [152.81.1.17])by 
>mash.CS.Berkeley.EDU (8.9.3/8.9.1) with ESMTP id EAA51656for 
><[email protected]>; Wed, 26 Apr 2000 04:04:26 -0700 (PDT)
>Received: from loria.fr (IDENT:[email protected] [152.81.11.123])by 
>lorraine.loria.fr (8.9.3/8.9.3/8.9.3/JCG-DG) with ESMTP id NAA09737for 
><[email protected]>; Wed, 26 Apr 2000 13:03:55 +0200 (MET DST)
>From [email protected] Wed Apr 26 04:29:38 2000
>X-Authentication-Warning: mash.CS.Berkeley.EDU: majrdomo set sender to 
>[email protected] using -f
>Message-ID: <[email protected]>
>Organization: LORIA
>X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.2.9 i686)
>X-Accept-Language: en
>Sender: [email protected]
>Precedence: bulk
>X-MIME-Autoconverted: from 8bit to quoted-printable by mash.CS.Berkeley.EDU 
>id EAA51662
>
>Hi
>I have decalred a timer like that
>/*******************************************************************/
>  class MyTimer : public TimerHandler {
>         public:
>             MyTimer(MyAgent *a) : TimerHandler() { a_ = a; }
>         protected:
>             virtual void expire(Event *e);
>             MyAgent *a_;
>         };
>/********************************************************************/
>
>When I declare the instance of the class of timers like it is shown in
>ns doc and either in the tcp exemple :
>
>/***************************/
>MyTimer Timer_Instance;
>/*****************************/
>the compiler tell me that there is no constructor MyTimer::MyTimer();
>there is only MyTimer::MyTimer(MyAgent* a);
>So Must I define a defalut constructor MyTimer::MyTimer() or i must
>declare the instance as follow ????
>/*************************/
>MyTimer Timer_Instance(this);
>/**************************/
>or it exist an other trick.
>
>What I Don't understant is that in the tcp agent it is defined with out
>any problem?? Why?
>?????????
>Thank you
>--
>--------------------------------------------------------------------------
>         Cordialement
>
>Koubaa Anis
>Organization : LORIA Nancy
>Equipe : RESEDAS
>Adresse : CU Haute Malgrange Vandeoeuvre Nancy Bloc C 528
>Mail : [email protected]
>Projet : Comparaison des Protocoles de cl�s de distribution de cl� de
>groupe en utilisant NS
>--------------------------------------------------------------------------

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com