开发者

How to get the current most derived state in a boost::statechart state_machine object?

开发者 https://www.devze.com 2023-04-03 12:23 出处:网络
I am using boost::state_chart library. For debug purposes, I would like to know at any given time 开发者_如何学Cthe state of my state machine.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号