Hi Sid
I am designing an application using Boost statechart and needed some advice.
I have multiple objects of the same type/functionality, however they are not related by an inheritance heirachy. The class types have a defined initialization sequence which move from 1 state to another. A few of these state initialization steps are the same eg. Resource X should be initialized as
the second step in the sequence. But X can be initialized only once in the process.
I am looking at doing the following:
- Creating a statechart for every object, to manage its initialization.
- Each state machine will maintain the pointer of the class object it has initialized.
- A map of object Name -> State Machine will be created to ensure every object is initialized correctly.
- Represent resource X as a separate state, which after its initialization will transition to the next state.
I'm not sure I fully understand what you are trying to do, but you don't usually directly represent a resource as a state. Rather, you normally have a state that is called "InitializingX", which kicks off the initialization in its entry action and has a transition to the next state that is triggered by an event that is called say "EvXInitizationSucceeded" or some such. Please provide further details. Thanks, Andreas