Boost logo

Boost Users :

From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2008-04-07 06:26:18


Andre Massing <massing <at> gmx.de> writes:

> > Sorry, I misread your original post. Indeed, the FAQ item does not apply to
> > your problem. I can't think of any good way how you could declare
> > transition actions non-public.
> > I'm wondering why you'd want to do so? If you have applied the pattern
> > described in the FAQ item, FSM clients will never see any of the state
> > classes with the public transition actions, right?
>
> Hmm, sorry, but this point is still not clear to me. Using this pattern, what
> keeps the client from directly using a public transit function in the fsm?

The fact that transition actions are members of simple_state<> subclasses. If
you apply the pattern outlined in the FAQ item, none of these classes are
visible to FSM clients. Looking at

<http://www.boost.org/doc/libs/1_35_0/libs/statechart/doc/faq.html#HideInnerWork
ings>

you see that a client including StopWatch.hpp has *no* *clue* of the existence
Running and Stopped classes. The client does know about the existence of the
Active class but since it is only forward-declared, he does not have access to
its member functions. Now, if you add a transition action for say the transition
from Running to Stopped, you'd add a member function to the Active class in
StopWatch.cpp, right?

Regards,

-- 
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