Boost logo

Boost :

From: Andreas Huber (ah2003_at_[hidden])
Date: 2004-09-15 17:58:23


Alexander Nasonov wrote:
>> Andreas Huber wrote:
>>> Hmmm, but I guess you still need to have the whole transition table
>>> in one translation unit, right?
>>
>> There is no "whole transition table" in my example. The process_event
>> function instantiates a part of the table for a given event,
>> Therefore,
>> it possible that they are instantiated in different TU.

You're right. However, it would be more useful the other way round (if
one could pack all the transitions for a each state in a different TU),
but I think spreading such an FSM over multiple TUs is probably not that
important anyway.

>>
>>> I guess the most important thing is to implement O(1) dispatch.
>>
>> Done. See attachment.

Cool.

Nitpick: By convention, if there's no transition for the current event
from the current state then the event is simply discarded. If I read
your code right, then it wouldn't compile if this is attempted. Wait, it
seems that it doesn't compile if a given state has no transition for
*any* of the events? Is that what you were talking about in one of your
previous posts with enable_if, etc.?

Regards,

Andreas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk