Hi,

I have a few questions about the statechart library.

1) I would like to pass around a representation of the current configuration of a machine, to allow inspection of local variables and active states. The easiest approach would be to just pass around a copy of the machine, but this is not possible since the state_machine class is noncopyable. An alternative could have been to pass around a constant ref/ptr to the machine, but this is also not workable because the inspection will happen in another thread, and synchronisation is not feasible.

Any suggestions?

One alternative is to create a new snapshot representation, but it will be a headache to keep in synch with the primary machine.

2) A related question is whether there is a good way to start a machine in a given configuration?

Using a sequence of events works in principle, but its a very impractical way to do so. For example if one wishes to restore a configuration from a prior session, then the client code has to log the full event history, and it may have a very hard time determining how many events need to be logged to reconstruct the given configuration. Logging and storing *all* events from the prior session will in many cases be wasteful, or even infeasible.

3) Suppose a machine makes a certain callback to client code in a set of different reactions. It would be nice if the client could inspect the currently active state, from which the given reaction is originating. However, my understanding is that the machine is unstable when processing a reaction, hence this is not possible. Is there a way around this?

Best
 Bedeho Mender