We use boost sml library to implement a state machine in our production system. There is a thread that sends various events into the state machine for processing. From another thread, I need to read the current state. I cannot get a piece of code using boost sml's is() API to compile! It gives me some weird errors:
nm_state_machine->is(ConnectExternalNode{});
error: no type named ‘type’ in ‘struct ConnectExternalNode’
return aux::get_id<state_t, typename TState::type>((states_ids_t *)0)
== aux::cget<sm_impl_t>(sub_sms_).current_state_[0];
All the boost sml examples in the official docs show states as string and events as struct. We use struct for both states and events. For example, the state for the above code is this:
struct ConnectExternalNode {};
My questions are:
- Why isn't the is() method taking a struct instance even though it is a valid type for a state?
- Is the is() method thread-safe?