summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jung2011-04-04 17:09:56 (EDT)
committer Thomas Schuetz2011-04-04 17:09:56 (EDT)
commitf429e8a681404718ecf06be741749cb79d922552 (patch)
tree8fb342ef33175bb3e94d296955792285b09cce47
parent6c9498396351f08fda26479dba36f732ff57a294 (diff)
downloadorg.eclipse.etrice-f429e8a681404718ecf06be741749cb79d922552.zip
org.eclipse.etrice-f429e8a681404718ecf06be741749cb79d922552.tar.gz
org.eclipse.etrice-f429e8a681404718ecf06be741749cb79d922552.tar.bz2
manually merged patch-rejects for patch: https://bugs.eclipse.org/bugs/show_bug.cgi?id=339803
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt11
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates/StateMachine.xpt7
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt25
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java6
4 files changed, 35 insertions, 14 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 2fa6083..ba6635a 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt
+++ b/plugins/org.eclipse.etrice.generator.java/src/templates/ActorClass.xpt
@@ -30,7 +30,9 @@ package «getPackage(ac)»;
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;
@@ -101,9 +103,6 @@ public «IF ac.abstract»abstract «ENDIF»class «ac.name» extends «IF ac.base!=null
public void start(){
startUser();
- «IF xpac.hasStateMachine()-»
- executeInitTransition();
- «ENDIF-»
}
«IF !ac.overridesStop()»
@@ -122,7 +121,13 @@ public «IF ac.abstract»abstract «ENDIF»class «ac.name» extends «IF ac.base!=null
//--------------------- no state machine
@Override
public void receiveEvent(InterfaceItemBase ifitem, int evt, Object... data) {
+ handleSystemEvent(ifitem, evt, data);
}
+
+ @Override
+ public void executeInitTransition(){
+ }
+
«ENDIF»
};
«ENDFILE»
diff --git a/plugins/org.eclipse.etrice.generator.java/src/templates/StateMachine.xpt b/plugins/org.eclipse.etrice.generator.java/src/templates/StateMachine.xpt
index 19d9aad..a67f7fe 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/templates/StateMachine.xpt
+++ b/plugins/org.eclipse.etrice.generator.java/src/templates/StateMachine.xpt
@@ -58,6 +58,8 @@ public void receiveEvent(InterfaceItemBase ifitem, int evt, Object... generic_da
int catching_state = NO_STATE;
boolean is_handler = false;
+ if (handleSystemEvent(ifitem, evt, generic_data)){}else{
+
switch (state) {
«FOREACH this.stateMachine.getLeafStateList() AS state-»
case «state.getStateId()»:
@@ -86,7 +88,7 @@ public void receiveEvent(InterfaceItemBase ifitem, int evt, Object... generic_da
«ENDIF»«ENDLET-»
break;
«ENDFOREACH-»
- }
+ }}
if (chain != NOT_CAUGHT) {
exitTo(state, catching_state, is_handler);
int next = executeTransitionChain(chain, ifitem, generic_data);
@@ -104,7 +106,8 @@ private void setState(int new_state) {
this.state = new_state;
}
-protected void executeInitTransition() {
+@Override
+public void executeInitTransition() {
«LET this.stateMachine.getInitTransition() AS initt-»
int chain = «this.getChain(initt).getChainId()»;
int next = executeTransitionChain(chain, null, null);
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 5cd65d5..0655850 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt
+++ b/plugins/org.eclipse.etrice.generator.java/src/templates/SubSystemClass.xpt
@@ -31,8 +31,10 @@ 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.messaging.RTSystemServicesProtocol.*;
import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
+import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
«LET this.getReferencedModels(cc) AS models»
«FOREACH models AS model»import «model.name».*;«ENDFOREACH»
@@ -41,31 +43,40 @@ import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
«EXPAND ProcedureHelpers::UserCode FOR cc.userCode1»
-public class «comp.name» extends SubSystemClassBase {
+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 receiveEvent(InterfaceItemBase ifitem, int evt, Object... data){
+ }
+
@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»"));
+ RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(new MessageService(this, new Address(0, «tid.counter1», 0),"MessageService_«thread.name»"));
«ENDFOREACH»
}
@Override
public void instantiateActors(){
// all addresses
+ // Addresses for the Subsystem Systemport
+ «FOREACH comp.allContainedInstances AS ai ITERATOR i»Address addr_item_SystemPort_«i.counter0»=new Address(0,0,«comp.objCounter.getAndIncrementCount()»);
+ «ENDFOREACH»
+
«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»);
+ // actor instance «ai.path» itself => Systemport Address
+ // TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
+ Address addr_item_«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»
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
index e01d979..faa9f35 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
@@ -79,6 +79,7 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
public abstract void start();
public abstract void stop();
public abstract void destroy();
+ public abstract void executeInitTransition();
// not automatically generated lifecycle functions
// are called, but with empty implementation -> can be overridden by user
@@ -100,7 +101,9 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
}
protected boolean handleSystemEvent(InterfaceItemBase ifitem, int evt, Object... generic_data){
- if (ifitem.getLocalId()!=0)return false;
+ if (ifitem.getLocalId()!=0){
+ return false;
+ }
switch (evt){
case RTSystemServicesProtocol.IN_executeInitialTransition :
@@ -111,7 +114,6 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
case RTSystemServicesProtocol.IN_stopDebugging :
break;
}
-
return true;
}
}