Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.cpp')
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend13
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend27
2 files changed, 21 insertions, 19 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
index 45ffd82ba..0020d5d42 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
@@ -31,9 +31,9 @@ import org.eclipse.etrice.core.room.EnumLiteral
import org.eclipse.etrice.core.room.EnumerationType
import org.eclipse.etrice.core.room.ExternalType
import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.MessageData
import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.RoomClass
-import org.eclipse.etrice.core.room.VarDecl
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.RoomExtensions
@@ -202,10 +202,11 @@ class CppExtensions implements ILanguageExtension {
}
override generateArglistAndTypedData(EObject d) {
- if (d==null || !(d instanceof VarDecl))
+ // TODO 529445: d will be a RefableType, not MessageData
+ if (d===null || !(d instanceof MessageData))
return newArrayList("", "", "")
- val data = d as VarDecl
+ val data = d as MessageData
val castExpr = switch it : data.refType.type {
PrimitiveType case !Strings.isEmpty(castName): castName
@@ -227,7 +228,7 @@ class CppExtensions implements ILanguageExtension {
}
override getTargetType(EnumerationType type) {
- if (type.getPrimitiveType()!=null)
+ if (type.getPrimitiveType()!==null)
type.getPrimitiveType().getTargetName()
else
type.getName()
@@ -237,14 +238,14 @@ class CppExtensions implements ILanguageExtension {
val type = literal.eContainer() as EnumerationType
val cast = type.targetType
- if (type.primitiveType!=null)
+ if (type.primitiveType!==null)
Long.toString(literal.getLiteralValue())
else
"(("+cast+")"+Long.toString(literal.getLiteralValue())+")"
}
override getCastType(EnumerationType type) {
- if (type.getPrimitiveType()!=null)
+ if (type.getPrimitiveType()!==null)
type.getPrimitiveType().getCastName()
else
type.getName()
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
index 16f5e98f1..561a2f69d 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
@@ -32,6 +32,7 @@ import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
+import org.eclipse.etrice.generator.generic.ILanguageExtension
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
@@ -131,7 +132,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// «IF conj»conjugated «ENDIF»port class
//------------------------------------------------------------------------------------------------------------
class «portClassName» : public etRuntime::PortBase {
- «IF pclass!=null»
+ «IF pclass!==null»
«pclass.userCode.userCode»
«ENDIF»
public:
@@ -144,7 +145,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
virtual void receive(const etRuntime::Message* m);
- «IF pclass!=null»
+ «IF pclass!==null»
«pclass.attributes.attributes»
«pclass.operations.operationsDeclaration(portClassName)»
«ENDIF»
@@ -251,7 +252,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«portClassName»::«portClassName»(IInterfaceItemOwner* actor, const String& name, int localId, int idx)
«pclass.generateConstructorInitalizerList('idx')»
{
- «IF pclass != null»«initHelper.genExtraInitializers(pclass.attributes)»«ENDIF»
+ «IF pclass !== null»«initHelper.genExtraInitializers(pclass.attributes)»«ENDIF»
}
«IF Main::settings.generateMSCInstrumentation»
@@ -291,7 +292,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«ENDIF»
}
- «IF pclass!=null»
+ «IF pclass!==null»
«pclass.operations.operationsImplementation(portClassName)»
«ENDIF»
@@ -335,34 +336,34 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
val List<CharSequence> initList = newArrayList
initList += '''PortBase(actor, name, localId, «index»)'''
- if(pc != null)
+ if(pc !== null)
initList += pc.attributes.map['''«name»(«initializerListValue»)''']
initList.generateCtorInitializerList
}
def protected messageCall(Message m, boolean impl) {
- '''«m.name»«IF impl»_impl«ENDIF»(«IF m.data!=null» «m.data.name»«ENDIF»)'''
+ '''«m.name»«IF impl»_impl«ENDIF»(«IF m.data!==null» «ILanguageExtension.GENERIC_DATA_NAME»«ENDIF»)'''
}
def protected messageSignature(Message m, boolean impl) {
- '''«IF m.priv||impl»private:«ELSE»public:«ENDIF» void «m.name»«IF impl»_impl«ENDIF»(«IF m.data!=null»«m.data.refType.signatureString» «m.data.name»«ENDIF»)'''
+ '''«IF m.priv||impl»private:«ELSE»public:«ENDIF» void «m.name»«IF impl»_impl«ENDIF»(«IF m.data!==null»«m.data.refType.signatureString» «ILanguageExtension.GENERIC_DATA_NAME»«ENDIF»)'''
}
def protected messageSignatureDefinition(Message m, String classPrefix, boolean impl) {
- '''void «classPrefix»::«m.name»«IF impl»_impl«ENDIF»(«IF m.data!=null»«m.data.refType.signatureString» «m.data.name»«ENDIF»)'''
+ '''void «classPrefix»::«m.name»«IF impl»_impl«ENDIF»(«IF m.data!==null»«m.data.refType.signatureString» «ILanguageExtension.GENERIC_DATA_NAME»«ENDIF»)'''
}
def protected sendMessage(Message m, String portClassName, String classPrefix, boolean conj) {
var dir = if (conj) "IN" else "OUT"
var hdlr = m.getSendHandler(conj)
- val dataArg = if(m.data != null) ''', «m.data.name»'''
- val messageType = if(m.data != null && !m.data.refType.ref) '''DataMessage<«m.data.refType.type.typeName»>''' else '''Message'''
+ val dataArg = if(m.data !== null) ''', «ILanguageExtension.GENERIC_DATA_NAME»'''
+ val messageType = if(m.data !== null && !m.data.refType.ref) '''DataMessage<«m.data.refType.type.typeName»>''' else '''Message'''
val message = '''new (buffer) «messageType»(getPeerAddress(), «portClassName»::«dir»_«m.name»«dataArg?:''»)'''
'''
«messageSignatureDefinition(m, classPrefix, false)» {
- «IF hdlr!=null»
+ «IF hdlr!==null»
«FOR command : hdlr.detailCode.lines» «command»
«ENDFOR»
«ELSE»
@@ -389,7 +390,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
def protected generateDataDrivenHeaderFile(Root root, ProtocolClass pc) {
- val sentMsgs = pc.allIncomingMessages.filter(m|m.data!=null)
+ val sentMsgs = pc.allIncomingMessages.filter(m|m.data!==null)
'''
/**
* @author generated by eTrice
@@ -464,7 +465,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
}
def protected generateDataDrivenSourceFile(Root root, ProtocolClass pc) {
- val sentMsgs = pc.allIncomingMessages.filter(m|m.data!=null)
+ val sentMsgs = pc.allIncomingMessages.filter(m|m.data!==null)
'''
/**
* @author generated by eTrice

Back to the top