Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » State chart code generation walkthrough
State chart code generation walkthrough [message #1785983] Mon, 23 April 2018 19:37 Go to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 138
Registered: March 2014
Senior Member
Some time ago I created a step by step guide to creating a "Hello World" program in C++.

Does anyone know If there is something similar for creating code from a state machine?
I see that there is an example project called SimpleSM but I need more to understand what it is doing.

Thanks,
Steve
Re: State chart code generation walkthrough [message #1785989 is a reply to message #1785983] Mon, 23 April 2018 21:42 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Hi Stephen,

Unfortunately I do not know of a "getting started" on that topic. Also, UML State machines can become rather complex (and tend to require a significant amount of knowledge.

Although not "pure" UML, the Papyrus for Real Time product does have a code generator for the UML-RT language (a superset of a subset of UML). This may not be exactly what you need, but it would probably provide some good information about how this was done int that context. You can look at its Transformation Architecture Detailed Description for some idea of what we did in that context.

Another potential open source project that is based on Eclipse and that may provide some insight could be Bridgepoint project on GitHub. I do believe they can generate code from state machine.

If you do create a UML-based state machine code generator on top of base Papyrus, I would invite you to consider placing it under open source.

Good luck!




/Charles Rivet
Re: State chart code generation walkthrough [message #1786306 is a reply to message #1785989] Mon, 30 April 2018 13:50 Go to previous messageGo to next message
Stephen Blackwell is currently offline Stephen BlackwellFriend
Messages: 138
Registered: March 2014
Senior Member
Charles,

I don't think that state machines themselves are particularly complicated. Automatically generating code from them is another matter, particularly when you get into parallel and sub-state charts.
About a year ago it was announced that there was a Rhapsody to Papyrus import project that would be released "in a couple of days". That, and the fact that there was an example transformation program included in Papyrus gave me hope that we would have C++ code generated from state machine.
That all seems t have gone away.

Steve
Re: State chart code generation walkthrough [message #1786309 is a reply to message #1786306] Mon, 30 April 2018 14:54 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Indeed state machines are not particularly complicated, but the event sources often are. A bespoke event dispatcher can be very efficient. A generic wrap-all-events-up-in-some-polymorphic-capability can be dreadful. For non-trivial state machines the size of the transition table can be unpleasant, but is often very amenable to compression. Once again bespoke approaches can be good, generic approaches horrible. IMHO it is the comparative ease and efficiency of a bespoke implementation compared to the size speed and complexity of a generic solution that explains why we are not all using a standard solution. Note that not even Java has a standard State machine class. In constrast LALR tooling such as lex/yacc have a very disciplined event source allowing their very effective auto-tooling for thousand state state machines.

Regards

Ed Willink
Previous Topic:How to Symbolically execute state machine in Eclipse Papyrus and Moka extension?
Next Topic:Moka and SysML
Goto Forum:
  


Current Time: Thu Apr 25 15:28:01 GMT 2024

Powered by FUDForum. Page generated in 0.03035 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top