statecharts icon indicating copy to clipboard operation
statecharts copied to clipboard

FR: Add option to generate state chart interface methods as virtual methods.

Open terfloth opened this issue 6 years ago • 1 comments


based on a customer request (2017092037000015):

Is it currently possible to modify the C++ generation so that the inner classes for the state machine interfaces defined in the generated .h file have virtual methods? If not, could this be added in a future release? This allows mocking frameworks, such as GMock, to easily mock the state machine interfaces, which in turn allows users to easily test how their code interfaces with a state machine.

terfloth avatar Sep 20 '17 06:09 terfloth

+1 for this. It would be useful in multi state machines, when mocking a sub state machine. For example, my sub state machines are setting a boolean value if a failure happens and I want to mock if it failed or not. As a workaround, I'm removing the readonly keyword and will set the error.

jfgo20 avatar Oct 28 '20 16:10 jfgo20