Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Karlitschek2012-08-15 09:22:09 +0000
committerPeter Karlitschek2012-08-15 09:22:09 +0000
commitf8dc65379deda59df3d7a8f3c4f2a0b066a83fd5 (patch)
tree94d53d7127e457dc068914a67a736bbebd07b605 /plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
parent00761f4501ce6e256c0c37a9a1c9266889e2a89a (diff)
parentcde68ba5223550c5fdd13780ef9b0649fca4ccdf (diff)
downloadorg.eclipse.etrice-f8dc65379deda59df3d7a8f3c4f2a0b066a83fd5.tar.gz
org.eclipse.etrice-f8dc65379deda59df3d7a8f3c4f2a0b066a83fd5.tar.xz
org.eclipse.etrice-f8dc65379deda59df3d7a8f3c4f2a0b066a83fd5.zip
Merge branch 'master' of http://git.eclipse.org/gitroot/etrice/org.eclipse.etrice
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend')
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend30
1 files changed, 18 insertions, 12 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
index 578a2a968..72d4de882 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
@@ -33,11 +33,12 @@ import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject extension JavaIoFileSystemAccess fileAccess
- @Inject extension JavaExtensions stdExt
- @Inject extension RoomExtensions roomExt
- @Inject extension ProcedureHelpers helpers
+ @Inject JavaIoFileSystemAccess fileAccess
+ @Inject extension JavaExtensions
+ @Inject extension RoomExtensions
+ @Inject extension ProcedureHelpers
@Inject extension TypeHelpers
+ @Inject extension DataClassGen
@Inject ILogger logger
def doGenerate(Root root) {
@@ -60,7 +61,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
import org.eclipse.etrice.runtime.java.modelbase.*;
import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
- «helpers.userCode(pc.userCode1)»
+ «pc.userCode(1)»
«var models = root.getReferencedModels(pc)»
«FOR model : models»import «model.name».*;
@@ -70,7 +71,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// message IDs
«genMessageIDs(pc)»
- «helpers.userCode(pc.userCode2)»
+ «pc.userCode(2)»
private static String messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
@@ -99,15 +100,18 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// port class
static public class «portClassName» extends PortBase {
«IF pclass!=null»
- «helpers.userCode(pclass.userCode)»
+ «pclass.userCode.userCode»
«ENDIF»
// constructors
public «portClassName»(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
- super(actor, name, localId, 0, addr, peerAddress);
+ this(actor, name, localId, 0, addr, peerAddress);
DebuggingService.getInstance().addPortInstance(this);
}
public «portClassName»(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
super(actor, name, localId, idx, addr, peerAddress);
+ «IF pclass!=null»
+ «pclass.attributes.attributeInitialization(true)»
+ «ENDIF»
DebuggingService.getInstance().addPortInstance(this);
}
@@ -147,8 +151,10 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
«IF pclass!=null»
- «helpers.attributes(pclass.attributes)»
- «helpers.operationsImplementation(pclass.operations, portClassName)»
+ «pclass.attributes.attributes»
+ // TODO JH: Avoid collision attr getters/setter <-> user operations
+ «attributeSettersGettersImplementation(pclass.attributes, null)»
+ «pclass.operations.operationsImplementation(portClassName)»
«ENDIF»
// sent messages
@@ -226,7 +232,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
def messageSignatureExplicit(Message m) {
var dc = (m.data.refType.type as DataClass)
- '''public void «m.name»(«IF dc.base!=null»«dc.base.typeName» _super, «ENDIF»«FOR a : dc.attributes SEPARATOR ", "»«a.refType.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»«ENDFOR»)'''
+ '''public void «m.name»(«dc.argList»)'''
}
def messageCall(Message m) {
@@ -254,7 +260,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
«IF m.data!=null && m.data.refType.type instanceof DataClass»
«messageSignatureExplicit(m)» {
- «m.name»(new «m.data.refType.type.name»(«IF (m.data.refType.type as DataClass).base!=null»_super, «ENDIF»«FOR a : (m.data.refType.type as DataClass).attributes SEPARATOR ", "»«a.name»«ENDFOR»));
+ «m.name»(new «m.data.refType.type.name»(«(m.data.refType.type as DataClass).paramList»));
}
«ENDIF»
'''

Back to the top