Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » State Machine Code generation from Transistions
State Machine Code generation from Transistions [message #1708651] Fri, 18 September 2015 12:00 Go to next message
Tobias Pr is currently offline Tobias PrFriend
Messages: 2
Registered: September 2015
Junior Member
index.php/fa/23307/0/


Hello,
my goal is I want to generate Code from a state machine - either in C++ or in Java, both would be fine.
I created a simple State machine and put a image of it in the atachment.

I tried to create opaque contraints for transitions with ocl and c++, but the transitions didnĀ“t show up in the generated code from the state-machine.

I would like to be able, to also generate transistions from the model somehow

The generated Code looks like this:
// --------------------------------------------------------
// Code generated by Papyrus C++
// --------------------------------------------------------

class Switch {
public:

	Switch() :
			State(0) {
	}

	int State;

	void Operation1();

	// opaque behavior without specification (typically from state machine)

	void
	onEntryOn();

	// opaque behavior without specification (typically from state machine)
	void
	onEntryOff();

};



// --------------------------------------------------------
// Code generated by Papyrus C++
// --------------------------------------------------------
/************************************************************
 Switch class body
 ************************************************************/
#include "TMRootElement/Switch.h"

void Switch::Operation1() {
}

// opaque behavior without specification (typically from state machine)
void Switch::onEntryOn() {
}

void Switch::onEntryOff() {
}
Re: State Machine Code generation from Transistions [message #1708659 is a reply to message #1708651] Fri, 18 September 2015 13:18 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Hi Tobias,

Have you looked at Papyrus for Real Time? It does code generation to C++ from state machines and does handle C++ opaque behaviors (both not OCL).

Check out the Project page and and let us know what you think in our Forum.


/Charles Rivet
Re: State Machine Code generation from Transistions [message #1708898 is a reply to message #1708659] Tue, 22 September 2015 10:41 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 446
Registered: July 2009
Senior Member
Hello you can also try to create your own code generator using Acceleo or Xtend.
It can be difficult to industrialize it but to prove your general idea it can be a solution




Re: State Machine Code generation from Transistions [message #1708910 is a reply to message #1708898] Tue, 22 September 2015 12:18 Go to previous messageGo to next message
Charles Rivet is currently offline Charles RivetFriend
Messages: 219
Registered: May 2014
Location: Canada
Senior Member

Good suggestion from Tristan. Papyrus-RT's state machine transformation does use Xtend, so you can have a look at the source code if you want an example.

/Charles Rivet
Re: State Machine Code generation from Transistions [message #1723119 is a reply to message #1708651] Thu, 11 February 2016 20:07 Go to previous message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 73
Registered: July 2011
Member
Hi Tobias,

although you asked this question some month ago this information may be helpful for others that search for a nice statechart editor with code generation captabilities.

You should have a look at our project YAKINDU Statechart Tools:
http://statecharts.org

It is a nice graphical editor for Harel statemachines and allows simulation as well as out of the box code generation for C, C++ and Java. It is based on Eclipse and open source!

Best,

Andreas
Previous Topic:Stereotype shapes and icons with Papyrus 0.10
Next Topic:Papyrus with epsilon
Goto Forum:
  


Current Time: Mon Jul 13 09:42:43 GMT 2020

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

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

Back to the top