« Return to Thread: [statechart] Substates in dll
Hi BillYes, that's possible, with one restriction: The inner initial state of each state must be in the same dll as the state itself, see below.
Is there any way to partition a state machine using boost::statechart such
that the main state machine is in one dll, and its substates (and possibly
their substates) are in separate dll's?
The cyclic dependency only exists between the state and its inner initial state. The state does not need to have any knowledge of all its other inner states.
It would seem that this would create a cyclic dependency.
It seems this should be possible. A prerequisite is that the transition from State1 to State2 must not be implemented with an ordinary sc::transition<> but with a sc::custom_reaction<>. By doing that, you are able to move the knowledge of the target state from the declaration (hpp file) to an ordinary function (which can reside in a cpp file), see for more information. Now, in order to really break the cycle, the *implementation* of State1::react should reside in State2.dll. Don't know whether that suits your needs, if not feel free to follow-up.
Suppose you have
e.g. a simple statechart called MyStatechart containing an initial state
State1 which transitions to State2 in response to some event. Is it possible
to implement MyStatechart and State1 in MyStatechart.dll, and State2 in
State2.dll?
No, IIUC. It should be enough when MyStatechart.dll and State2.dll include the same header, e.g. MyStatechart.hpp. You might want to have a look at the TuTest*.* files in the test directory. These do not implement your use case, but at least illustrate how the importing/exporting required by some platforms can be done.
Since the code for State1 will need to reference State2 (in order to
transition to it), MyStatechart.dll will have a dependency on State2.dll.
But since State2 is contained in MyStatechart, its type will have to look
something like
struct State2: sc::state<State2, MyStatechart>
{
//...
};
which means that State2.dll will have a dependency on MyStatechart.dll.
HTH,
--
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users
« Return to Thread: [statechart] Substates in dll
| Free embeddable forum powered by Nabble | Forum Help |