Does Papyrus Designer even generate code from state machines? There used to be and maybe there still is, a project called Qompass that handled state machine code generation but I don't know what the relationship between Qompass and Designer is, if any.
I created a class and added a state chart to the class but the generated C++ code has no reference to the state machine.
I created an operation and method in the same class where I added the state machine. I want to add the method to the Entry behavior of a state in the state machine but I don't see a way to do this. The only option appears to be to create another operation.
And finally, are there any current examples of using state machines with C++ code generation?
Qompass is the old name for Papyrus Software designer.
Software has support for State-machine generation which is pretty complete, i.e. supports for instance hierarchical state machines, parallel regions & history state. The state-machine code is added by a model-to-model transformation which is part of the standard transformation chain. In order to use it, you need to pass by the code generation via a deployment plan instead of directly clicking on "generate C++ code". We are aware that this is not very intuitive for the user and plan to change it, i.e. to automatically execute transformations of the default chain, even without a deployment plan.
An example state-machine can be found via File->New->Examples in the Papyrus category, then select Papyrus designer examples based on M2M transformations.