Open cppden opened 4 years ago
Do you consider it a bug?
Each event is a bit different, you have an onexit<, my_event>, the event itself and onentry, my_event>.
You can check for on_entry and on_exit by specializing your event logger to filter them out i think.
struct SmlLogger {
template <class SM, class TEvent>
void log_process_event(const TEvent&) {
// handle plain event
}
template <class SM, class _, class TEvent>
void log_process_event(const boost::sml::back::on_entry<_,TEvent>&) {
// handle on_entry
}
template <class SM, class _, class TEvent>
void log_process_event(const boost::sml::back::on_exit_,TEvent>&) {
// handle on_exit
}
// other methods
};
I didn;t test this code but it is to point out a possible solution to your problem.
the problem not in the logging per se but in the fact that all events will have on_entry/exit even if only one actually uses it. normally in C++ we get used to not pay for not needed things, right?
still when looking at the log I'd also prefer to not see 2 false prints for each event even when I didn't define on_entry/exit for them.
hope my point is clear. and more hope it is possible to fix or we're doomed? ;)
When SM has a state with on_entry and on_exit then event in other states are logged 3 times: