Boost logo

Boost Users :

Subject: Re: [Boost-users] [statechart] Non-Const Machine Pass-throughs andstate_cast
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2009-08-10 03:48:25


Hi Grant

> The machine is effectively a timer and wraps another internal timer class
> that can be stopped/started and suspended/resumed. This is all the machine
> does. The internal timer class can get/set its interval and can also
> get/set
> a delegate, that is called (if set) when the timer fires. These internal
> timer management interfaces are "passed through" to the state machine
> interface, such that application/test code is as follows:
[snip code]

> Where I have run into a problem is that my machine "pass through" setter
> methods allowing the delegate to be set or the timer interval to be
> changed
> (neither of which materially alter the state of the machine) cannot be
> called as they are non-const qualified whereas their corresponding getters
> work fine since they are const qualified.

So both the values of the delegate and the interval are orthogonal to the
state the machine has? If so, I'm wondering why they're not members of
struct Timer? This would make ITimerManagement unnecessary and also save
quite a bit of code?

If they absolutely must be members of Active then you best implement the Set
functions with events (e.g. EvSetInterval which would carry the new interval
as a data member) and leave the Get functions as they are.

What is the purpose of the IRunning & ISuspended structs?

HTH,

-- 
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net