Re: Lahman, how ya doing?
- From: glhansen@xxxxxxxxxxxxxxxxxxxxx (Gregory L. Hansen)
- Date: Tue, 26 Apr 2005 17:50:03 +0000 (UTC)
In article <gNtbe.1007$pc7.41@trndny05>,
H. S. Lahman <hsl@xxxxxxxxxxxxxxxxx> wrote:
>Responding to Hansen...
>
>> I'd started with a Timer class that keeps the total time separately in
>> each individual instantiation, but I thought that wasn't quite logically
>> representative since there's only one time. I thought it still wasn't
>> worthwhile changing that until I realized that main() was pretty much
>> doing what I'd have Clock doing anyway.
>
>As you noted, you only need one timer if you have different events for
>different frequencies. The timer just spits out the right event after
>the proper number of internal "ticks". If you use a single FIFO event
>queue, then the ordering of operations will Just Work.
>
>But that leaves the problem of "registering" the right receivers for
>those events so that Timer can address them correctly. Since there is
>nothing dynamic about that assignment, I agree with Martin that it seems
>like something timer.add would do. [If the listener assignments were
>more dynamic in nature a pattern like Observer might be relevant.]
Yes, I'm working on Martin's idea now. What I had was sort of an
evolution of what I'd started with. That doesn't always turn out looking
the cleanest to a third party.
I also need jobs that do task 1 at time interval 1, and task 2 at time
interval 2. But it won't be hard to add a
time.add_task(&c3, 5, 20);
Well, I had a little trouble getting it to work before, I think it must
have had to do with typecasting the pointers. For a container holding a
double event job I wound up rewriting a few member functions in the
derived class identically except for different pointer types. Maybe
there was a better way, but what was rewritten was short enough that there
didn't seem to be any point in getting fancy.
--
"Is that plutonium on your gums?"
"Shut up and kiss me!"
-- Marge and Homer Simpson
.
- Follow-Ups:
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- References:
- Lahman, how ya doing?
- From: Gregory L. Hansen
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Lahman, how ya doing?
- Prev by Date: Re: Who can find this paper on the net?
- Next by Date: DOES ANY GLASS CLEANERS WANT THEIR PAPER WORK DONE EVERY DAY
- Previous by thread: Re: Lahman, how ya doing?
- Next by thread: Re: Lahman, how ya doing?
- Index(es):
Relevant Pages
|