
Forwarded from comp.lang.c++.moderated for being OT there.
Original thread: http://tinyurl.com/cmvud
--
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header.
"Dave"
the FAQ illustrates how to modify the existing layout of an FSM, but I doubt whether it would be possible to implement the main FSM in the main exe and then dynamically load dlls to add inner/sub-states to existing states; since the state transition/reactions have to be specified as template parameters.
Out of curiosity: Would you care to describe what kind of application you need such a library for?
This is probably off-topic for this ng but I'll provide my reasons so you can decide if they're reasonable or not.
The application I mentioned original post is a call control application, in fact several of them. (Naturally each application is maintained by a group of developers) Each of the applications has a flat Fsm with many states. My goal is to design a framework that has a main Fsm that is common to all the call control applications (with points of customization pre-defined) and then dynamically load DLLs to customize the behavior (by adding inner/sub-states) of the Fsm. The obvious advantage of doing so would be code reuse. Another reason to do so is that if a customization for a specific customer is needed (say add a few states to the fsm), only a few DLLs need to be modified/added, whereas in the existing design the main application has to be modified and recompiled. In this way the customization may be done by a developer who does not have full access to the source code/statechart, all he/she needs to know is the interface of the "point of customization".
Dynamic configurabliity aside, the application I'm working on is a call control application, so I only need one instance of the state machine, one instance of each state and use context objects to store state information for each call. When I skimmed through the statechart tutorial I see that the "Entry" and "Exit" functions are implemented using the constructor and destructor of the simple_state class, so I suppose that each state object is constructed when entered and destructed when exited. I'm not sure.. if a state is entered and exited repeatedly, say in the stopwatch example, whether the object construction/destruction incurs an unecessary cost. If I'm wrong, please correct me.
If there's a free Fsm libary (not licensed under GPL) that satisfies my requirements that would be great, but I would also consider commercial products. Yet I'm under the impression that commerial Fsm libaries usually come with graphical UML editors... right now I'm stuck with Rational Rose 98 (old version), so the new tool would have to be able to import UML diagrams drawn using Rational Rose 98. One good thing about Rational Rose is that the saved files are pretty human readable so I can just write a script to parse the state chart specifications and generate code that uses some Fsm libarary (say boost statechart). Of course another alternative would be rely on the UML editor to generate frameowrk code for me but I would still have to make some modifications to archive dynamic configurability.
thanks
Dave - I'm a novice please be nice :-)
[ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]