Re: TTimer - discussive

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Aug 10 1998 - 19:02:14 MEST


Hi Valeriy,

   simpler in this case is to include a LiveObjectTimer as datamember
in your LiveObject class and redirect all timer functions via this special
timer. In the ctor of the LiveObjectTimer you pass a pointer to the
LiveObject and you should be able to do what you want without big
changes.

Cheers, Fons.



Valeriy Onuchin wrote:
> 
> Hello, Rooters.
> 
>   To simplify event-driven programming
> it whould be nice to make possible to have
> classes similar the following
> 
>  class LiveObject: public TObject, public TTimer
> {
> public:
>   LiveObject() {gSystem->AddTimer(this);}
> 
> void  ExecuteEvent(Int_t event, Int_t px, Int_t py)
> { some actions in responce to graphic events
>  (for example, if(event==kButton1Up) TTimer::Remove();)
> }
> 
> Bool_t Notify() {SomeAction(); Reset(); return kFALSE;}
> };
> 
> The only obstacle which prevents having this is  that
> TTimer is original from TObject (TObject->TSysEvtHandler->TTimer).
> 
>   Is it possible to have inheritance like this:
> 
>   TSysEvtHandler -> TVirtualTimer
>   TVirtualTimer + TObject -> TTimer
> 
> or it requires dramatic modifications of ROOT?
> 
>                   With best regards,     Valery

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:36 MET