summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-08-01 04:57:11 (EDT)
committerHenrik Rentz-Reichert2011-08-01 04:57:11 (EDT)
commitbbcfc1bd628429e83352d72e03d076511d63c212 (patch)
treefb54d247cac6b1cd7a83fe666d684fbf831eae4d
parent26d4a7273af9523a7e170dc3ae275160cfa8186c (diff)
downloadorg.eclipse.etrice-bbcfc1bd628429e83352d72e03d076511d63c212.zip
org.eclipse.etrice-bbcfc1bd628429e83352d72e03d076511d63c212.tar.gz
org.eclipse.etrice-bbcfc1bd628429e83352d72e03d076511d63c212.tar.bz2
[generator.java] removed temporary cpp templates
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ActorClass.xpt142
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DataClass.xpt49
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DocGraphviz.xpt47
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/Main.xpt26
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProcedureHelpers.xpt55
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProtocolClass.xpt225
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/StateMachine.xpt241
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemClass.xpt101
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemRunner.xpt71
9 files changed, 0 insertions, 957 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ActorClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ActorClass.xpt
deleted file mode 100644
index f15f28d..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ActorClass.xpt
+++ /dev/null
@@ -1,142 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-
-«DEFINE actorClass FOR Root»
-
-«FOREACH this.xpActorClasses AS xpac»
-«LET xpac.actorClass AS ac»
-
-«("generating "+getPath(ac)+ac.name+".java").info()»
-
-«FILE getPath(ac)+ac.name+".java"»
-package «getPackage(ac)»;
-
-// CPP
-
-import org.eclipse.etrice.runtime.java.messaging.Address;
-import org.eclipse.etrice.runtime.java.messaging.IRTObject;
-import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
-import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
-import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
-import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
-import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
-
-«LET this.getReferencedModels(ac) AS models»
-«FOREACH models AS model»import «model.name».*;
-«ENDFOREACH»
-«ENDLET»
-
-«LET this.getReferencedProtocols(ac) AS protocols»
-«FOREACH protocols AS pc»import «getPackage(pc)».«pc.name».*;
-«ENDFOREACH»
-«ENDLET»
-
-«EXPAND ProcedureHelpers::UserCode FOR ac.userCode1»
-
-
-public «IF ac.abstract»abstract «ENDIF»class «ac.name» extends «IF ac.base!=null»«ac.base.name»«ELSE»ActorClassBase«ENDIF» {
-
- «EXPAND ProcedureHelpers::UserCode FOR ac.userCode2»
-
- //--------------------- ports
- «FOREACH ac.getEndPorts() AS ep»protected «ep.getPortClassName()» «ep.name» = null;
- «ENDFOREACH»
- //--------------------- saps
- «FOREACH ac.strSAPs AS sap»protected «sap.getPortClassName()» «sap.name» = null;
- «ENDFOREACH»
- //--------------------- services
- «FOREACH ac.serviceImplementations AS svc»protected «svc.getPortClassName()» «svc.spp.name» = null;
- «ENDFOREACH»
-
- //--------------------- interface item IDs
- «FOREACH ac.getEndPorts() AS ep»protected static final int IFITEM_«ep.name» = «xpac.getInterfaceItemLocalId(ep)+1»;
- «ENDFOREACH»
- «FOREACH ac.strSAPs AS sap»protected static final int IFITEM_«sap.name» = «xpac.getInterfaceItemLocalId(sap)+1»;
- «ENDFOREACH»
- «FOREACH ac.serviceImplementations AS svc»protected static final int IFITEM_«svc.spp.name» = «xpac.getInterfaceItemLocalId(svc.spp)+1»;
- «ENDFOREACH»
-
- «EXPAND ProcedureHelpers::Attributes FOR ac.attributes»
- «EXPAND ProcedureHelpers::Operations FOR ac.operations»
-
- //--------------------- construction
- public «ac.name»(IRTObject parent, String name, Address[][] port_addr, Address[][] peer_addr){
- «IF ac.base==null»
- super(parent, name, port_addr[0][0], peer_addr[0][0]);
- «ELSE»
- super(parent, name, port_addr, peer_addr);
- «ENDIF»
- setClassName("«ac.name»");
-
- // own ports«FOREACH ac.getEndPorts() AS ep»
- «ep.name» = new «ep.getPortClassName()»(this, "«ep.name»", IFITEM_«ep.name», «IF ep.multiplicity==1»0, «ENDIF»port_addr[IFITEM_«ep.name»]«IF ep.multiplicity==1»[0]«ENDIF», peer_addr[IFITEM_«ep.name»]«IF ep.multiplicity==1»[0]«ENDIF»);
- «ENDFOREACH»
- // own saps«FOREACH ac.strSAPs AS sap»
- «sap.name» = new «sap.getPortClassName()»(this, "«sap.name»", IFITEM_«sap.name», 0, port_addr[IFITEM_«sap.name»][0], peer_addr[IFITEM_«sap.name»][0]);
- «ENDFOREACH»
- // own service implementations«FOREACH ac.serviceImplementations AS svc»
- «svc.spp.name» = new «svc.getPortClassName()»(this, "«svc.spp.name»", IFITEM_«svc.spp.name», port_addr[IFITEM_«svc.spp.name»], peer_addr[IFITEM_«svc.spp.name»]);
- «ENDFOREACH»
- }
-
-
- //--------------------- lifecycle functions
- public void init(){
- initUser();
- }
-
- public void start(){
- startUser();
- }
-
- «IF !ac.overridesStop()»
- public void stop(){
- stopUser();
- }
- «ENDIF»
-
- public void destroy(){
- destroyUser();
- }
-
- «IF ac.stateMachine != null»
- «EXPAND StateMachine::stateMachine FOR xpac»
- «ELSEIF !xpac.hasStateMachine()»
- //--------------------- no state machine
- @Override
- public void receiveEvent(InterfaceItemBase ifitem, int evt, Object... data) {
- handleSystemEvent(ifitem, evt, data);
- }
-
- @Override
- public void executeInitTransition(){
- }
-
- «ENDIF»
-};
-«ENDFILE»
-«ENDLET»
-«ENDFOREACH»
-«ENDDEFINE»
-
-«DEFINE msgArgs FOR Message»
-«IF this.data!=null»«this.data.defaultValue()»«ENDIF»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DataClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DataClass.xpt
deleted file mode 100644
index 35b700b..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DataClass.xpt
+++ /dev/null
@@ -1,49 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-«DEFINE dataClass FOR Root»
-
-«FOREACH this.usedDataClasses AS dc»
-
-«("generating "+getPath(dc)+dc.name+".java").info()»
-
-«FILE getPath(dc)+dc.name+".java"»
-package «getPackage(dc)»;
-
-«LET this.getReferencedModels(dc) AS models»
-«FOREACH models AS model»import «model.name».*;
-«ENDFOREACH»
-«ENDLET»
-
-«IF dc.imports.size>0»
-// user imports
-«FOREACH dc.imports AS imp»import «imp.importedNamespace».*;
-«ENDFOREACH»«ENDIF»
-
-public class «dc.name»«IF dc.base!=null» extends «dc.base.name»«ENDIF» {
- «EXPAND ProcedureHelpers::Attributes FOR dc.attributes»
- «EXPAND ProcedureHelpers::AttributeSettersGetters FOR dc.attributes»
- «EXPAND ProcedureHelpers::Operations FOR dc.operations»
-};
-«ENDFILE»
-«ENDFOREACH»
-«ENDDEFINE»
-
-
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DocGraphviz.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DocGraphviz.xpt
deleted file mode 100644
index 72b8c21..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/DocGraphviz.xpt
+++ /dev/null
@@ -1,47 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz
- *
- *******************************************************************************/
-«ENDREM»
-
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-«DEFINE docGraphviz FOR Root»
-
-«FOREACH this.subSystems AS comp»
-
-«LET comp.subSystemClass AS ssc»
-
-«("generating "+getPath(ssc)+ssc.name+".dot").info()»
-«FILE getPath(ssc)+ssc.name+".dot"»
-digraph «ssc.name» {
- rankdir=LR;
- node [shape=box];
- «comp.path.getPathName()» [label="«comp.name»\n(«ssc.name»)" style=filled color=yellow];
- «EXPAND instance FOREACH comp.instances-»
-}
-«ENDFILE»
-«ENDLET»
-«ENDFOREACH»
-«ENDDEFINE»
-
-«DEFINE instance FOR ActorInstance»
- «LET (StructureInstance)this.eContainer AS parent»
- «this.path.getPathName()» [label="«this.name»\n(«this.actorClass.name»)"];
- «parent.path.getPathName()» -> «this.path.getPathName()»;
- «ENDLET»
- «EXPAND instance FOREACH this.instances-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/Main.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/Main.xpt
deleted file mode 100644
index 3a89869..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/Main.xpt
+++ /dev/null
@@ -1,26 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»
-
-«DEFINE main FOR Root-»
- «EXPAND DataClass::dataClass FOR this»
- «EXPAND ProtocolClass::protocolClass FOR this»
- «EXPAND ActorClass::actorClass FOR this»
- «EXPAND SubSystemClass::subSystemClass FOR this»
- «EXPAND SubSystemRunner::subSystemRunner FOR this»
-
- «EXPAND DocGraphviz::docGraphviz FOR this»
-
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProcedureHelpers.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProcedureHelpers.xpt
deleted file mode 100644
index 8f00e5d..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProcedureHelpers.xpt
+++ /dev/null
@@ -1,55 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-
-«EXTENSION extensions::Extensions»
-
-«DEFINE ActorClassPortIF FOR ActorClass»
- «IF this.extPorts.size > 0»implements«ENDIF»
- «FOREACH this.extPorts AS ep»public «ep.ifport.protocol.name»«IF ep.ifport.conjugated==true»Conj«ENDIF»Port «ep.ifport.name» = null;
- «ENDFOREACH»
-
-«ENDDEFINE»
-
-«DEFINE UserCode FOR DetailCode »
- «IF this!=null»
- //--------------------- begin user code
- «FOREACH this.commands AS command» «command»
- «ENDFOREACH»//--------------------- end user code
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE Attributes FOR List[Attribute] »
- //--------------------- attributes
- «FOREACH this AS attribute»protected «attribute.type.typeName()» «attribute.name»;
- «ENDFOREACH»
-«ENDDEFINE»
-
-«DEFINE AttributeSettersGetters FOR List[Attribute] »
- //--------------------- attribute setters and getters
- «FOREACH this AS attribute»public void set«attribute.name.toFirstUpper()» («attribute.type.typeName()» «attribute.name») {
- this.«attribute.name» = «attribute.name»;
- }
- public «attribute.type.typeName()» get«attribute.name.toFirstUpper()» () {
- return «attribute.name»;
- }«ENDFOREACH»
-«ENDDEFINE»
-
-«DEFINE Operations FOR List[Operation] »
- //--------------------- operations
- «FOREACH this AS operation»public «IF operation.returntype==null»void«ELSE»«operation.returntype.freeTypeName()»«ENDIF» «operation.name» («FOREACH operation.arguments AS argument SEPARATOR ", "»«argument.type.freeTypeName()» «argument.name»«ENDFOREACH»){
- «FOREACH operation.detailCode.commands AS command» «command»
- «ENDFOREACH»
- }«ENDFOREACH»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProtocolClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProtocolClass.xpt
deleted file mode 100644
index cf24ab9..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/ProtocolClass.xpt
+++ /dev/null
@@ -1,225 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-«DEFINE protocolClass FOR Root»
-
-«FOREACH this.usedProtocolClasses AS pc»
-
-«("generating "+getPath(pc)+pc.name+".java").info()»
-
-«FILE getPath(pc)+pc.name+".java"»
-package «getPackage(pc)»;
-
-import java.util.ArrayList;
-
-import org.eclipse.etrice.runtime.java.messaging.Address;
-import org.eclipse.etrice.runtime.java.messaging.Message;
-import org.eclipse.etrice.runtime.java.modelbase.*;
-import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
-
-«EXPAND ProcedureHelpers::UserCode FOR pc.userCode1»
-
-«LET this.getReferencedModels(pc) AS models»
-«FOREACH models AS model»import «model.name».*;
-«ENDFOREACH»
-«ENDLET»
-
-public class «pc.name» {
- // message IDs
- // TODO: separate class for message IDs: class MSG{public static volatile int MSG_MIN = 0; ...} -> better structure
- // error if msgID <= MSG_MIN
- public static final int MSG_MIN = 0;
- //IDs for outgoing messages
- «FOREACH pc.getAllOutgoingMessages() AS message ITERATOR iter»public static final int OUT_«message.name» = «iter.counter1»;
- «ENDFOREACH»
- //IDs for incoming messages
- «FOREACH pc.getAllIncomingMessages() AS message ITERATOR iter»public static final int IN_«message.name» = «iter.counter1+pc.getAllOutgoingMessages().size»;
- «ENDFOREACH»
- //error if msgID >= MSG_MAX
- public static final int MSG_MAX = «pc.getAllOutgoingMessages().size + pc.getAllIncomingMessages().size+1»;
-
- «EXPAND ProcedureHelpers::UserCode FOR pc.userCode2»
-
- private static String messageStrings[] = {"MIN", «FOREACH pc.getAllOutgoingMessages() AS m»"«m.name»",«ENDFOREACH» «FOREACH pc.getAllIncomingMessages() AS m»"«m.name»",«ENDFOREACH»"MAX"};
-
- public String getMessageString(int msg_id) {
- if (msg_id<0 || msg_id>MSG_MAX+1){
- // id out of range
- return "Message ID out of range";
- }
- else{
- return messageStrings[msg_id];
- }
- }
-
- «EXPAND portClass(false) FOR pc»
- «EXPAND portClass(true) FOR pc»
-}
-«ENDFILE»
-«ENDFOREACH»
-«ENDDEFINE»
-
-«DEFINE portClass(Boolean conj) FOR ProtocolClass»
-
-«LET getPortClassName(this, conj) AS name»
-«LET this.getPortClass(conj) AS pclass»
-
-// port class
-static public class «name» extends PortBase {
- «IF pclass!=null»«EXPAND ProcedureHelpers::UserCode FOR pclass.userCode-»
- «ENDIF-»
- // constructors
- public «name»(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
- DebuggingService.getInstance().addPortInstance(this);
- }
- public «name»(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
- super(actor, name, localId, idx, addr, peerAddress);
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
- System.out.println("unknown");
- else {
- if (messageStrings[msg.getEvtId()] != "timerTick"){
- // TODOTS: model switch for activation
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- }
- «IF this.handlesReceive(conj)»
- switch (msg.getEvtId()) {
- «FOREACH this.getReceiveHandlers(conj) AS hdlr»
- case «hdlr.msg.getCodeName()»:
- {
- «FOREACH hdlr.detailCode.commands AS command» «command»
- «ENDFOREACH»
- }
- break;
- «ENDFOREACH»
- default:
- «ENDIF»
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId());
- «IF this.handlesReceive(conj)»
- }«ENDIF»
- }
- }
-
- «EXPAND ProcedureHelpers::Attributes FOR pclass.attributes-»
- «EXPAND ProcedureHelpers::Operations FOR pclass.operations-»
-
- // sent messages
- «FOREACH this.getOutgoing(conj) AS m»«EXPAND sendMessage(conj) FOR m»«ENDFOREACH-»
-}
-
-// replicated port class
-static public class «name»Repl {
- private ArrayList<«name»> ports;
- private int replication;
-
- public «name»Repl(IEventReceiver actor, String name, int localId, Address[] addr,
- Address[] peerAddress) {
- replication = addr.length;
- ports = new ArrayList<«this.name».«name»>(replication);
- for (int i=0; i<replication; ++i) {
- ports.add(new «name»(
- actor, name+i, localId, i, addr[i], peerAddress[i]));
- }
- }
-
- public int getReplication() {
- return replication;
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public «name» get(int i) {
- return ports.get(i);
- }
-
- «IF conj»
- // incoming messages
- «FOREACH this.getAllIncomingMessages() AS m-»
- «EXPAND messageSignature FOR m»{
- for (int i=0; i<replication; ++i) {
- ports.get(i).«EXPAND messageCall FOR m»;
- }
- }
- «ENDFOREACH-»
- «ELSE-»
- // outgoing messages
- «FOREACH this.getAllOutgoingMessages() AS m-»
- «EXPAND messageSignature FOR m»{
- for (int i=0; i<replication; ++i) {
- ports.get(i).«EXPAND messageCall FOR m»;
- }
- }
- «ENDFOREACH-»
- «ENDIF-»
-}
-
-// interface for port class
-public interface I«name»{
- «IF conj-»
- // outgoing messages
- «FOREACH this.getAllOutgoingMessages() AS m» «EXPAND messageSignature FOR m»;
- «ENDFOREACH-»
- «ELSE-»
- // incoming messages
- «FOREACH this.getAllIncomingMessages() AS m» «EXPAND messageSignature FOR m»;
- «ENDFOREACH-»
- «ENDIF-»
-}
-
-«ENDLET»
-«ENDLET»
-«ENDDEFINE»
-
-«DEFINE messageSignature FOR Message»public void «this.name» («IF this.data!=null»«this.data.type.typeName()» «this.data.name»«ENDIF»)«ENDDEFINE»
-«DEFINE messageCall FOR Message»«this.name»(«IF this.data!=null» «this.data.name»«ENDIF»)«ENDDEFINE»
-«DEFINE sendMessage(boolean conj) FOR Message-»
-«LET conj?"IN":"OUT" AS dir-»
-«LET this.getSendHandler(conj) AS hdlr-»
- «EXPAND messageSignature FOR this»{
- «IF hdlr!=null-»
- «FOREACH hdlr.detailCode.commands AS command» «command»
- «ENDFOREACH-»
- «ELSE-»
- if (messageStrings[ «dir»_«this.name»] != "timerTick"){
- // TODOTS: model switch for activation
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«this.name»]);
- }
- if (getPeerAddress()!=null)
- «IF this.data==null»getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«this.name»));
- «ELSE» getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«this.name», «this.data.name»));
- «ENDIF-»
- «ENDIF-»
- }
-«ENDLET-»
-«ENDLET-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/StateMachine.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/StateMachine.xpt
deleted file mode 100644
index 5ff4436..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/StateMachine.xpt
+++ /dev/null
@@ -1,241 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-
-«DEFINE stateMachine FOR ExpandedActorClass»
-«LET this.actorClass AS ac»
-//******************************************
-// START of generated code for FSM
-//******************************************
-
-// State IDs for FSM
-«LET ac.getNumberOfInheritedBaseStates() AS offset»
-«FOREACH ac.stateMachine.getBaseStateList() AS state ITERATOR iter»protected static final int «state.getStateId()» = «iter.counter1+1+offset»;
-«ENDFOREACH»«ENDLET»
-protected static final String stateStrings[] = {"<no state>","<top>",«FOREACH ac.getAllBaseStates() AS state ITERATOR iter SEPARATOR ","»"«state.getStatePathName()»"
-«ENDFOREACH»};
-
-// history
-// TODOHRR: history defined in ActorClassBase, init in constructor
-// history = new int[5];
-// for (int i = 0; i < history.length; i++) {
-// history[i] = NO_STATE;
-// }
-protected int history[] = {NO_STATE,NO_STATE«FOREACH ac.getAllBaseStates() AS state»,NO_STATE«ENDFOREACH»};
-
-«LET this.getOwnTransitionChains() AS chains»
-«LET this.getTransitionChains().size-chains.size AS offset»
-// transition chains
-«FOREACH chains AS tc ITERATOR i»protected static final int «tc.getChainId()» = «i.counter1+offset»;
-«ENDFOREACH»«ENDLET»«ENDLET»
-
-«LET this.getOwnTriggers() AS triggers»
-// triggers for FSM
-«FOREACH triggers AS mif»protected static final int «this.getTriggerCodeName(mif)» = IFITEM_«mif.from.name» + EVT_SHIFT*«this.getMessageID(mif)»;
-«ENDFOREACH»«ENDLET»
-
-// receiveEvent contains the main implementation of the FSM
-@Override
-public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) {
- int trigger = ifitem.getLocalId() + EVT_SHIFT*evt;
- int chain = NOT_CAUGHT;
- int catching_state = NO_STATE;
- boolean is_handler = false;
- boolean skip_entry = false;
-
- if (!handleSystemEvent(ifitem, evt, generic_data)) {
- switch (state) {
- «FOREACH this.stateMachine.getLeafStateList() AS state-»
- case «state.getStateId()»:
- «LET this.getActiveTriggers(state) AS atlist-»
- «IF !atlist.isEmpty-»
- switch(trigger) {
- «FOREACH atlist AS at-»
- case «this.getTriggerCodeName(at.trigger)»:
- «LET this.hasGuard(at) AS needData-»
- «IF needData»{ «at.msg.getTypedDataDefinition()»«ENDIF-»
- «FOREACH at.transitions AS tt SEPARATOR " else "-»
- «LET this.getChain(tt) AS chain-»
- «EXPAND guard(at.trigger, this) FOR chain.transition-»
- {
- chain = «chain.getChainId()»;
- catching_state = «chain.getContextId()»;
- «IF chain.isHandler()»is_handler = true;«ENDIF-»
- «IF chain.skipEntry»skip_entry = true;«ENDIF-»
- }
- «ENDLET-»
- «ENDFOREACH-»
- «IF needData»}«ENDIF-»
- «ENDLET-»
- break;
- «ENDFOREACH-»
- }
- «ENDIF»«ENDLET-»
- break;
- «ENDFOREACH-»
- }
- }
- if (chain != NOT_CAUGHT) {
- exitTo(state, catching_state, is_handler);
- int next = executeTransitionChain(chain, ifitem, generic_data);
- next = enterHistory(next, is_handler, skip_entry);
- setState(next);
- }
-}
-
-private void setState(int new_state) {
- DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);
- if (stateStrings[new_state]!="Idle") {
- // TODOTS: model switch for activation
- System.out.println(getInstancePath() + " -> " + stateStrings[new_state]);
- }
- this.state = new_state;
-}
-
-@Override
-public void executeInitTransition() {
- «LET this.stateMachine.getInitTransition() AS initt-»
- int chain = «this.getChain(initt).getChainId()»;
- int next = executeTransitionChain(chain, null, null);
- next = enterHistory(next, false, false);
- setState(next);
- «ENDLET-»
-}
-
-/**
- * calls exit codes while exiting from the current state to one of its
- * parent states while remembering the history
- * @param current - the current state
- * @param to - the final parent state
- * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints)
- */
-private void exitTo(int current, int to, boolean handler) {
- while (current!=to) {
- switch (current) {
- «FOREACH this.stateMachine.getBaseStateList() AS state-»
- case «state.getStateId()»:
- «IF state.hasExitCode()»if (!handler) «state.getExitCodeOperationName()»();«ENDIF-»
- history[«state.getParentStateId()»] = «state.getStateId()»;
- current = «state.getParentStateId()»;
- break;
- «ENDFOREACH-»
- }
- }
-}
-/**
- * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data
- * matching the trigger of this chain. The ID of the final state is returned
- * @param chain - the chain ID
- * @param generic_data - the generic data pointer
- * @return the ID of the final state
- */
-private int executeTransitionChain(int chain, InterfaceItemBase ifitem, Object generic_data) {
- switch (chain) {
- «LET this.getTransitionChains() AS chains-»
- «FOREACH chains AS tc-»
- case «tc.getChainId()»:
- {
- «this.getExecuteChainCode(tc)-»
- }
- «ENDFOREACH»«ENDLET-»
- }
- return NO_STATE;
-}
-/**
- * calls entry codes while entering a state's history. The ID of the final leaf state is returned
- * @param state - the state which is entered
- * @param handler - entry code is executed if not handler
- * @return - the ID of the final leaf state
- */
-private int enterHistory(int state, boolean handler, boolean skip_entry) {
- while (true) {
- switch (state) {
- «FOREACH this.stateMachine.getBaseStateList() AS state-»
- case «state.getStateId()»:
- «IF state.hasEntryCode()»if (!(skip_entry || handler)) «state.getEntryCodeOperationName()»();«ENDIF»
- «IF state.isLeaf()-»
- // in leaf state: return state id
- return «state.getStateId()»;
- «ELSE-»
- // state has a sub graph
- «IF state.subgraph.hasInitTransition()-»
- // with init transition
- if (history[«state.getStateId()»]==NO_STATE) {
- «LET state.subgraph.getInitTransition() AS initt-»
- state = executeTransitionChain(«this.getChain(initt).getChainId()-», null, null);
- «ENDLET-»
- }
- else {
- state = history[«state.getStateId()»];
- }
- «ELSE-»
- // without init transition
- state = history[«state.getStateId()»];
- «ENDIF-»
- break;
- «ENDIF-»
- «ENDFOREACH-»
- case STATE_TOP:
- state = history[STATE_TOP];
- break;
- }
- skip_entry = false;
- }
-}
-
-//*** Entry and Exit Codes
-«FOREACH this.stateMachine.getStateList() AS state»
- «IF this.isOwnObject(state)»
- «IF state.hasEntryCode()»
- protected void «state.getEntryCodeOperationName()»() {
- «this.getEntryCode(state)»}
- «ENDIF»
- «IF state.hasExitCode()»
- protected void «state.getExitCodeOperationName()»() {
- «this.getExitCode(state)»}
- «ENDIF»
- «ENDIF»
-«ENDFOREACH»
-
-//*** Action Codes
-«FOREACH this.stateMachine.getTransitionList() AS tr»
- «IF this.isOwnObject(tr) && tr.hasActionCode()»
- protected void «tr.getActionCodeOperationName()»(«IF NonInitialTransition.isInstance(tr)»InterfaceItemBase ifitem«this.getArgumentList(tr)»«ENDIF») {
- «this.getActionCode(tr)»}
- «ENDIF»
-«ENDFOREACH»
-
-//******************************************
-// END of generated code for FSM
-//******************************************
-«ENDLET»
-«ENDDEFINE»
-
-«DEFINE guard(String trigger, ExpandedActorClass ac) FOR TriggeredTransition-»
- «LET this.triggers.selectFirst(e|ac.isMatching(e, trigger)) AS tr-»
- «IF tr.hasGuard()-»
- if («ac.getCode(tr.guard.guard)»)
- «ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE guard(String trigger, ExpandedActorClass ac) FOR Transition»
-/* error */
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemClass.xpt
deleted file mode 100644
index cbc6dda..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemClass.xpt
+++ /dev/null
@@ -1,101 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-«DEFINE subSystemClass FOR Root»
-
-«FOREACH this.subSystems AS comp»
-
-«LET comp.subSystemClass AS cc»
-
-«("generating "+getPath(cc)+cc.name+"_controller.java").info()»
-«FILE getPath(cc)+cc.name+".java"»
-package «getPackage(cc)»;
-
-import org.eclipse.etrice.runtime.java.messaging.MessageService;
-import org.eclipse.etrice.runtime.java.messaging.RTServices;
-import org.eclipse.etrice.runtime.java.messaging.Address;
-import org.eclipse.etrice.runtime.java.messaging.IRTObject;
-import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
-import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
-
-«LET this.getReferencedModels(cc) AS models»
-«FOREACH models AS model»import «model.name».*;«ENDFOREACH»
-«ENDLET»
-
-
-«EXPAND ProcedureHelpers::UserCode FOR cc.userCode1»
-
-public class «comp.name» extends SubSystemClassBase {
-
- «EXPAND ProcedureHelpers::UserCode FOR cc.userCode2»
-
- public «comp.name»(IRTObject parent, String name) {
- super(parent, name);
- }
-
- @Override
- public void instantiateMessageServices(){
-
- RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(new MessageService(this, new Address(0, 0, 0),"MessageService_Main"));
- «FOREACH comp.subSystemClass.threads AS thread ITERATOR tid»
- RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(new MessageService(this, new Address(0, «tid.counter0»+1, 0),"MessageService_«thread.name»"));
- «ENDFOREACH»
- }
-
- @Override
- public void instantiateActors(){
- // all addresses
- «FOREACH comp.allContainedInstances AS ai»
- // actor instance «ai.path» itself
- Address addr«ai.path.getPathName()»= new Address(0,«ai.threadId»,«ai.objId»);
- // interface items of «ai.path»«FOREACH ai.orderedIfItemInstances AS pi»
- «IF ServiceImplInstance.isInstance(pi) || pi.peers.size>1»«FOREACH pi.peers AS peer ITERATOR i»Address addr_item_«pi.path.getPathName()»_«i.counter0» = new Address(0,«pi.threadId»,«pi.objId»+«i.counter0»);
- «ENDFOREACH»
- «ELSE»Address addr_item_«pi.path.getPathName()» = new Address(0,«ai.threadId»,«pi.objId»);
- «ENDIF»
- «ENDFOREACH»
- «ENDFOREACH»
-
- // instantiate all actor instances
- instances = new ActorClassBase[«comp.allContainedInstances.size»];
- «FOREACH comp.allContainedInstances AS ai»instances[«comp.allContainedInstances.indexOf(ai)»] = new «ai.actorClass.name»(
- «IF SubSystemInstance.isInstance(ai.eContainer)»this«ELSE»instances[«comp.allContainedInstances.indexOf(ai.eContainer)»]«ENDIF»,
- "«ai.name»",
- addr«ai.path.getPathName()»,
- // own interface item addresses
- new Address[][] {«FOREACH ai.orderedIfItemInstances AS pi SEPARATOR ","»{«IF ServiceImplInstance.isInstance(pi) || pi.peers.size>1»«FOREACH pi.peers AS peer ITERATOR i SEPARATOR ","»addr_item_«pi.path.getPathName()»_«i.counter0»«ENDFOREACH»
- «ELSE»addr_item_«pi.path.getPathName()»
- «ENDIF»}
- «ENDFOREACH»},
- // peer interface item addresses
- new Address[][] {«FOREACH ai.orderedIfItemInstances AS pi SEPARATOR ","»{«IF !ServiceImplInstance.isInstance(pi) && pi.peers.isEmpty»null«ELSE»«FOREACH pi.peers AS pp SEPARATOR ","»«IF ServiceImplInstance.isInstance(pp) || pp.peers.size>1»addr_item_«pp.path.getPathName()»_«pp.peers.indexOf(pi)»
- «ELSE»addr_item_«pp.path.getPathName()»
- «ENDIF»
- «ENDFOREACH»«ENDIF»}
- «ENDFOREACH»}
- );
- «ENDFOREACH»
- }
-};
-«ENDFILE»
-
-«ENDLET»
-«ENDFOREACH»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemRunner.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemRunner.xpt
deleted file mode 100644
index e3dce20..0000000
--- a/plugins/org.eclipse.etrice.generator.java/src/templates_CPP/SubSystemRunner.xpt
+++ /dev/null
@@ -1,71 +0,0 @@
-«REM»
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-«ENDREM»
-«IMPORT room»;
-«IMPORT etricegen»;
-
-«EXTENSION org::eclipse::etrice::generator::extensions::Extensions»
-«EXTENSION extensions::Extensions»
-«EXTENSION org::eclipse::xtend::util::stdlib::io»
-
-«DEFINE subSystemRunner FOR Root»
-
-«FOREACH this.subSystems AS ssc»
-
-«LET ssc.subSystemClass AS cc»
-
-«("generating "+getPath(cc)+cc.name+"Runner.java").info()»
-«FILE getPath(cc)+cc.name+"Runner.java"»
-
-/**
- * @author generated by eTrice
- *
- * this class contains the main function running component «ssc.name»
- * it instantiates «ssc.name» and starts and ends the lifecycle
- */
-
-package «getPackage(cc)»;
-
-import org.eclipse.etrice.runtime.java.modelbase.SubSystemRunnerBase;
-
-class «ssc.name+"Runner"» extends SubSystemRunnerBase {
-
- static «ssc.name» main_component = new «ssc.name»(null, "«ssc.name»");
-
- /**
- * main function
- * creates component and starts and stops the lifecycle
- */
- public static void main(String[] args) {
-
- System.out.println("*** T H E B E G I N ***");
-
- main_component.init(); // lifecycle init
- main_component.start(); // lifecycle start
-
- // application runs until quit
- waitForQuit();
-
- // end the lifecycle
- main_component.stop(); // lifecycle stop
- main_component.destroy(); // lifecycle destroy
-
- System.out.println("*** T H E E N D ***");
- }
-};
-
-«ENDFILE»
-
-«ENDLET»
-«ENDFOREACH»
-«ENDDEFINE»