Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-05-07 11:21:34 +0000
committerJuergen Haug2015-05-07 11:21:34 +0000
commitccba971b5844820b1152b87b8b817723afa4ca6f (patch)
tree89cc6b502a1897ea870024b5b34a24284ae13a58 /plugins/org.eclipse.etrice.generator.c/src/org
parentad17f996677b822effed3a5f00c8045e8ac6c12e (diff)
downloadorg.eclipse.etrice-ccba971b5844820b1152b87b8b817723afa4ca6f.tar.gz
org.eclipse.etrice-ccba971b5844820b1152b87b8b817723afa4ca6f.tar.xz
org.eclipse.etrice-ccba971b5844820b1152b87b8b817723afa4ca6f.zip
Revert "[generator.c] Bug 439014 add port and message label to data-driven events in MSC Change-Id: I2461a0c6432b797f9f3066bad7150dff39d72ac5"
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c/src/org')
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend78
1 files changed, 45 insertions, 33 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
index a3fde7720..4cb4b94c7 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
@@ -230,7 +230,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«ENDFOR»
«IF (pc.getPortClass(conj) != null)»
- «pc.getAllOperations(!conj).operationsDeclaration(portClassName)»
+ «pc.getPortClass(conj).operations.operationsDeclaration(portClassName)»
«ENDIF»
«IF pc.handlesReceive(conj)»
@@ -302,38 +302,50 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
'''
}
- def private genDataDrivenPortSources(ProtocolClass pc){
+ def private genDataDrivenPortSources(ProtocolClass pc) {
var messages = pc.allIncomingMessages.filter(m|m.data!=null)
- messages.map[message |
- var type = message.data.refType.type
- var refp = if (!(type.enumerationOrPrimitive)) "*" else ""
- // log message name and data in MSC, if feasible
- var messageLog = switch type {
- //case type.isEnumeration: '''«type.name»_getLiteralName(data)'''
- case type.isBoolean: '''data?"«message.name»(true)":"«message.name»(false)"'''
- default : '''"«message.name»"'''
- }
- '''
- «messageSetterSignature(pc.getPortClassName(true), message.name, ', '+type.name+refp+' data')» {
- «IF Main::settings.generateMSCInstrumentation»
- #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
- {
- const char** peerName;
- for (peerName=self->peerNames; *peerName!=NULL; ++peerName) {
- ET_MSC_LOGGER_ASYNC_OUT(self->instName, «messageLog», *peerName)
- ET_MSC_LOGGER_ASYNC_IN(self->instName, «messageLog», *peerName)
- }
- }
- #endif
- «ENDIF»
- self->«message.name» = «refp»data;
- }
-
- «messageGetterSignature(pc.getPortClassName(false), message.name, type.name)» {
- return self->peer->«message.name»;
- }
- '''
- ].join
+ val enumMsgs = messages.filter(m|m.data.refType.type.isEnumeration)
+ val boolMsgs = messages.filter(m|m.data.refType.type.isBoolean)
+ val usesMSC = Main::settings.generateMSCInstrumentation && !(enumMsgs.empty && boolMsgs.empty)
+ /*
+ * MSC code is generated for all enumerations and all booleans of the messages of this protocol
+ */
+ '''
+ «FOR message : messages»
+ «var typeName =message.data.refType.type.typeName»
+ «var refp = if (!(message.data.refType.type.enumerationOrPrimitive)) "*" else ""»
+ «var data = ", "+typeName+refp+" data"»
+ «messageSetterSignature(pc.getPortClassName(true), message.name, data)» {
+ «IF usesMSC && enumMsgs.exists(m|m==message)»
+ #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
+ {
+ const char** peerName;
+ for (peerName=self->peerNames; *peerName!=NULL; ++peerName) {
+ ET_MSC_LOGGER_ASYNC_OUT(self->instName, «message.data.refType.type.name»_getLiteralName(data), *peerName)
+ ET_MSC_LOGGER_ASYNC_IN(self->instName, «message.data.refType.type.name»_getLiteralName(data), *peerName)
+ }
+ }
+ #endif
+ «ENDIF»
+ «IF usesMSC && boolMsgs.exists(m|m==message)»
+ #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
+ {
+ const char** peerName;
+ for (peerName=self->peerNames; *peerName!=NULL; ++peerName) {
+ ET_MSC_LOGGER_ASYNC_OUT(self->instName, data?"true":"false", *peerName)
+ ET_MSC_LOGGER_ASYNC_IN(self->instName, data?"true":"false", *peerName)
+ }
+ }
+ #endif
+ «ENDIF»
+ self->«message.name» = «refp»data;
+ }
+ «messageGetterSignature(pc.getPortClassName(false), message.name, typeName)» {
+ return self->peer->«message.name»;
+ }
+
+ «ENDFOR»
+ '''
}
def private portClassSource(ProtocolClass pc, Boolean conj) {
@@ -406,7 +418,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
/* begin «portClassName» specific */
«pclass.userCode.userCode»
- «pc.getAllOperations(!conj).operationsImplementation(portClassName)»
+ «pc.getPortClass(conj).operations.operationsImplementation(portClassName)»
/* end «portClassName» specific */
«ENDIF»

Back to the top