如何在 boost::statechart state_machine 对象中获取当前最派生的状态?

发布于 2024-12-03 16:44:20 字数 97 浏览 8 评论 0原文

我正在使用 boost::state_chart 库。 出于调试目的,我想知道在任何给定时间我的状态机的状态。 如何获取 state_machine 对象中的当前(最派生的)状态?

I am using boost::state_chart library.
For debug purposes, I would like to know at any given time the state of my state machine.
How to get the current (most derived) state in the state_machine object ?

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

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

发布评论

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

评论(1

标点 2024-12-10 16:44:20

您可以使用 state_machine::state_begin 和 state_machine::state_end 获取当前状态对象,请参阅此处的“自定义状态查询”:

http://www.boost.org/libs/statechart/doc/tutorial.html#StateQueries

这些为您提供基类指针,如果你想要获得最派生的类型,你必须雇用某种访问者。

You can get at the current state object(s) with state_machine::state_begin and state_machine::state_end, see "Custom State Queries" here:

http://www.boost.org/libs/statechart/doc/tutorial.html#StateQueries

These give you base class pointers, if you want to get at the most-derived type you'd have to employ a visitor of some sort.

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