Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.java/src/templates')
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt12
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates/ProtocolClass.xpt16
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt19
3 files changed, 30 insertions, 17 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt
index 5a5248cc6..90860069a 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt
+++ b/plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt
@@ -76,22 +76,22 @@ public «IF ac.abstract»abstract «ENDIF»class «ac.name» extends «IF ac.base!=null
«EXPAND ProcedureHelpers::Operations FOR ac.operations»
//--------------------- construction
- public «ac.name»(IRTObject parent, String name, IMessageReceiver msgsvc, Address[][] port_addr, Address[][] peer_addr){
+ public «ac.name»(IRTObject parent, String name, Address ownAddr, Address[][] port_addr, Address[][] peer_addr){
«IF ac.base==null»
- super(parent, name, msgsvc);
+ super(parent, name, ownAddr);
«ELSE»
- super(parent, name, msgsvc, port_addr, peer_addr);
+ super(parent, name, ownAddr, 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», msgsvc);
+ «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], msgsvc);
+ «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»], msgsvc);
+ «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»
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates/ProtocolClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates/ProtocolClass.xpt
index 610573a98..e29cc3509 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/templates/ProtocolClass.xpt
+++ b/plugins/org.eclipse.etrice.generator.java/src/templates/ProtocolClass.xpt
@@ -87,12 +87,12 @@ static public class «name» extends PortBase {
«ENDIF»
// constructors
- public «name»(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress, IMessageReceiver msgService) {
- super(actor, name, localId, 0, addr, peerAddress, msgService);
+ 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, IMessageReceiver msgService) {
- super(actor, name, localId, idx, addr, peerAddress, msgService);
+ 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);
}
@@ -142,12 +142,12 @@ static public class «name»Repl {
private int replication;
public «name»Repl(IEventReceiver actor, String name, int localId, Address[] addr,
- Address[] peerAddress, IMessageReceiver msgService) {
+ 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], msgService));
+ actor, name+i, localId, i, addr[i], peerAddress[i]));
}
}
@@ -212,8 +212,8 @@ public interface I«name»{
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«this.name»]);
}
if (getPeerAddress()!=null)
- «IF this.arguments.isEmpty»getMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«this.name»));
- «ELSE» getMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«this.name», new Object[]{«FOREACH this.arguments AS a SEPARATOR ","» «a.name»«ENDFOREACH»}));
+ «IF this.arguments.isEmpty»getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«this.name»));
+ «ELSE» getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«this.name», new Object[]{«FOREACH this.arguments AS a SEPARATOR ","» «a.name»«ENDFOREACH»}));
«ENDIF»
«ENDIF»
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt
index 2e8153f32..3eb03a2e1 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt
+++ b/plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt
@@ -27,6 +27,8 @@
«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;
@@ -44,13 +46,24 @@ public class «comp.name» extends SubSystemClassBase {
}
@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«pi.path.getPathName()»_«i.counter0» = new Address(0,0,«pi.objId»+«i.counter0»);
+ «IF ServiceImplInstance.isInstance(pi) || pi.peers.size>1»«FOREACH pi.peers AS peer ITERATOR i»Address addr«pi.path.getPathName()»_«i.counter0» = new Address(0,«pi.threadId»,«pi.objId»+«i.counter0»);
«ENDFOREACH»
- «ELSE»Address addr«pi.path.getPathName()» = new Address(0,0,«pi.objId»);
+ «ELSE»Address addr«pi.path.getPathName()» = new Address(0,«ai.threadId»,«pi.objId»);
«ENDIF»
«ENDFOREACH»
«ENDFOREACH»
@@ -60,7 +73,7 @@ public class «comp.name» extends SubSystemClassBase {
«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»",
- getMsgService(),
+ 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«pi.path.getPathName()»_«i.counter0»«ENDFOREACH»
«ELSE»addr«pi.path.getPathName()»

Back to the top