Hi,
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.
Is there a potentially better way to do this considering:
- There can be multiple objects of different class types
- New objects can be added during runtime.
Thanks,
Sid