捕获 boost 状态图库中丢弃的事件

发布于 2024-12-18 19:24:04 字数 213 浏览 7 评论 0原文

我正在查看 Boost StateChart lib 文档,但无法找到捕获异常事件的方法。

例如,如果我处于状态 A,它只处理 EventA,并且我调用

machine.proces_event(EventB())

该事件似乎会被默默地忽略。有没有办法让我捕捉到这些,以便我可以记录状态和信息?非法行为?

谢谢。

I am looking at Boost StateChart lib documentation, and I am not able to find out a way to catch abnormal events.

For example, if I am in state A, which handles only EventA, and I call

machine.proces_event(EventB())

The event seems to get silently ignored. Is there a way for me to catch those, so I can log the state & the illegal action?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑾兮 2024-12-25 19:24:04

从那以后我找到了这个问题的答案。我们只需要在状态机中实现consumed_event函数。

void unconsumed_event( const sc::event_base & e) {} 

I have since found the answer to this. We just need to implement consumed_event function in our stateMachine.

void unconsumed_event( const sc::event_base & e) {} 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文