문제

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 ?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top