Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Karlitschek2012-12-05 08:49:33 +0000
committerPeter Karlitschek2012-12-05 09:11:06 +0000
commit71f2c21f0b278fa2bdc39ce9ac5669c39a8e9200 (patch)
tree928368d8344a147a730950a38ee187162720178b /plugins/org.eclipse.etrice.generator.cpp
parent4b5b1174b469eca6bcaf8bd04b3256fa4cfeb0ea (diff)
downloadorg.eclipse.etrice-71f2c21f0b278fa2bdc39ce9ac5669c39a8e9200.tar.gz
org.eclipse.etrice-71f2c21f0b278fa2bdc39ce9ac5669c39a8e9200.tar.xz
org.eclipse.etrice-71f2c21f0b278fa2bdc39ce9ac5669c39a8e9200.zip
timing service for cpp generator
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/ActorClassGen.xtend21
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend50
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend17
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend46
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend64
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.smap94
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java47
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java126
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.smap22
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java126
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.smap47
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.smap167
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.smap31
14 files changed, 721 insertions, 141 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
index f24cc83b3..d87388e0a 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
@@ -13,11 +13,10 @@ import org.eclipse.etrice.generator.base.AbstractGenerator
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
-import org.eclipse.etrice.generator.cpp.gen.Initialization
-import org.eclipse.etrice.generator.cpp.gen.StateMachineGen
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.room.ActorCommunicationType
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
@@ -133,7 +132,7 @@ class ActorClassGen extends GenericActorClassGenerator {
«ELSEIF !xpac.hasStateMachine()»
public:
//--------------------- no state machine
- virtual void receiveEvent(const etRuntime::InterfaceItemBase& ifitem, int evt, void* data);
+ virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);
virtual void executeInitTransition();
«ENDIF»
@@ -165,6 +164,9 @@ class ActorClassGen extends GenericActorClassGenerator {
for (svc : ac.serviceImplementations) {
initializerList.add('''«svc.spp.name»(*this, this, "«svc.spp.name»", IFITEM_«svc.spp.name», port_addr[IFITEM_«svc.spp.name»], peer_addr[IFITEM_«svc.spp.name»])''');
}
+ for (attrib: ac.attributes) {
+ initializerList.add(attrib.attributeInitialization(false))
+ }
return
'''
«initializerList.join(',\n')»
@@ -175,6 +177,7 @@ class ActorClassGen extends GenericActorClassGenerator {
def generateSourceFile(Root root, ExpandedActorClass xpac, ActorClass ac) {
val ctor = ac.operations.filter(op|op.constructor).head
val dtor = ac.operations.filter(op|op.destructor).head
+ val async = xpac.actorClass.commType==ActorCommunicationType::ASYNCHRONOUS
'''
/**
@@ -196,14 +199,14 @@ class ActorClassGen extends GenericActorClassGenerator {
: «ac.generateConstructorInitalizerList»
{
setClassName("«ac.name»");
- ««« TODO change to constructor initializer list
«ac.attributes.attributeInitialization(false)»
+ «IF async»
+ getMsgsvc()->addAsyncActor(*this);
+ «ENDIF»
«IF ctor!=null»
- {
- // user defined constructor body
- «AbstractGenerator::getInstance().getTranslatedCode(ctor.detailCode)»
- }
+ // user defined constructor body
+ «AbstractGenerator::getInstance().getTranslatedCode(ctor.detailCode)»
«ENDIF»
}
@@ -233,7 +236,7 @@ class ActorClassGen extends GenericActorClassGenerator {
«xpac.genStateMachine(false)»
«ELSEIF !xpac.hasStateMachine()»
//--------------------- no state machine
- void «ac.name»::receiveEvent(const etRuntime::InterfaceItemBase& ifitem, int evt, void* data) {
+ void «ac.name»::receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data) {
handleSystemEvent(ifitem, evt, data);
}
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 0da6b4bb0..69ff87af4 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
@@ -75,6 +75,10 @@ class CppExtensions implements ILanguageExtension {
return true
}
+ override boolean usesPointers() {
+ return true
+ }
+
override String genEnumeration(String name, List<Pair<String, String>> entries) {
'''
typedef enum {
@@ -93,7 +97,7 @@ class CppExtensions implements ILanguageExtension {
override String voidPointer() { "void*" }
override String arrayDeclaration(String type, int size, String name, boolean isRef) {
- type+" "+name+"[]";
+ type+" "+name+"["+size+"]";
}
override String constructorName(String cls) {
@@ -135,41 +139,6 @@ class CppExtensions implements ILanguageExtension {
}
-// def attributeConstructorInitList(List<Attribute> attribs, boolean useClassDefaultsOnly) {
-// '''
-// // initialize attributes
-// «FOR a : attribs»
-// «var value = a.initValue»
-// «IF value!=null»
-// «IF !a.isArray»
-// «a.name» ( «value» ),
-// «ELSE»
-// «a.name» ( {
-// «FOR i : 0 .. a.size»
-// value,
-// «ENDFOR»
-// } )
-// «ENDIF»
-// «ELSEIF a.refType.type instanceof ComplexType || a.size>1 || !useClassDefaultsOnly»
-// «IF a.size==0»
-// «IF a.refType.isRef»
-// «a.name» ( «languageExt.nullPointer()» ),
-// «ELSE»
-// «a.name» ( «a.refType.type.defaultValue» ),
-// «ENDIF»
-// «ELSE»
-// «a.name» ( new «a.refType.type.typeName»[«a.size»] ),
-// «IF !useClassDefaultsOnly»
-// for (int i=0;i<«a.size»;i++){
-// «a.name»[i] = «IF a.refType.isRef»«languageExt.nullPointer()»«ELSE»«a.refType.type.defaultValue»«ENDIF»;
-// }
-// «ENDIF»
-// «ENDIF»
-// «ENDIF»
-// «ENDFOR»
-// '''
-// }
-
override String toValueLiteral(PrimitiveType type, String value){
throw new UnsupportedOperationException("TODO Config for Cpp");
}
@@ -213,6 +182,7 @@ class CppExtensions implements ILanguageExtension {
}
override generateArglistAndTypedData(VarDecl data) {
+ var deref = "*"
if (data==null)
return newArrayList("", "", "")
@@ -236,12 +206,16 @@ class CppExtensions implements ILanguageExtension {
typeName = typeName+"*"
castTypeName = castTypeName+"*"
}
- if (!(data.getRefType().getType() instanceof PrimitiveType)) {
+ else if (!(data.getRefType().getType() instanceof PrimitiveType)) {
typeName = typeName+"*"
castTypeName = castTypeName+"*"
}
+ else {
+ castTypeName = typeName
+ deref = ""
+ }
- val typedData = typeName+" "+data.getName() + " = *(("+castTypeName+") generic_data);\n"
+ val typedData = typeName+" "+data.getName() + " = " + deref + "(("+castTypeName+") generic_data);\n"
val dataArg = ", "+data.getName()
val typedArgList = ", "+typeName+" "+data.getName()
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
index d94ef0cbe..df44859bd 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
@@ -91,6 +91,11 @@ class DataClassGen {
// constructor using fields
«dc.name»(«dc.argList»);
+ «IF dc.base!=null»
+ // constructor using base class constructor
+ «dc.name»(«dc.base.name» _super, «dc.attributes.argListConstructor.toString»);
+ «ENDIF»
+
};
«generateIncludeGuardEnd(dc.name)»
@@ -155,6 +160,18 @@ class DataClassGen {
{
}
+ «IF dc.base!=null»
+ // constructor using base class constructor
+ «dc.name»::«dc.name»(«dc.base.name» _super, «dc.attributes.argListConstructor.toString»)
+ :
+ «dc.base.name»(_super),
+ «FOR a : dc.attributes SEPARATOR ","»
+ «a.name»(«a.name»_)
+ «ENDFOR»
+ {
+ }
+ «ENDIF»
+
// assignment operator
«dc.name»& «dc.name»::operator=(const «dc.name»& rhs)
{
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend
index 4e0be556d..a684bead5 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend
@@ -24,24 +24,16 @@ class Initialization {
«var value = a.initValueLiteral»
«IF value!=null»
«IF a.size == 0 || aType.characterType»
- «a.name» = «value»;
«ELSEIF value.startsWith("{")»
- «a.name» = new «aType.typeName»[] «value»;
+ «initializeArrayWithValues(a.name, value.replace("{", "").replace("}", "").split(","))»
«ELSE»
- «a.name» = new «aType.typeName»[«a.size»];
for (int i=0;i<«a.size»;i++){
«a.name»[i] = «value»;
}
«ENDIF»
«ELSEIF aType instanceof ComplexType || a.size>1 || !useClassDefaultsOnly»
«IF a.size==0»
- «IF a.refType.isRef»
- «a.name» = «languageExt.nullPointer()»;
- «ELSE»
- «a.name» = «languageExt.defaultValue(aType)»;
- «ENDIF»
«ELSE»
- «a.name» = new «aType.typeName»[«a.size»];
«IF !useClassDefaultsOnly»
for (int i=0;i<«a.size»;i++){
«a.name»[i] = «IF a.refType.isRef»«languageExt.nullPointer()»«ELSE»«languageExt.defaultValue(aType)»«ENDIF»;
@@ -52,4 +44,40 @@ class Initialization {
«ENDFOR»
'''
}
+
+ def initializeArrayWithValues(String varName, String[] values) {
+ '''
+ «values.map(v | varName + "[" + values.indexOf(v) + "] = " + v + ";" ).join("\r\n")»
+ '''
+ }
+
+ def attributeInitialization(Attribute a, boolean useClassDefaultsOnly) {
+ var aType = a.refType.type
+ var value = a.initValueLiteral
+ if (value != null) {
+ if (a.size == 0 || aType.characterType) {
+ if (a.refType.isRef)
+ '''«a.name»(new «aType.name»(«value»))'''
+ else
+ '''«a.name»(«value»)'''
+ }
+ else if (value.startsWith("{")) {
+ '''«a.name»()'''
+ }
+ else {
+ '''«a.name»()'''
+ }
+ }
+ else if (aType instanceof ComplexType || a.size>1 || !useClassDefaultsOnly) {
+ if (a.size==0) {
+ if (a.refType.isRef)
+ '''«a.name»(«languageExt.nullPointer()»)'''
+ else
+ '''«a.name»(«languageExt.defaultValue(aType)»)'''
+ }
+ else
+ '''«a.name»()'''
+ }
+ }
+
} \ No newline at end of file
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 afe525b28..38601e088 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
@@ -4,23 +4,24 @@ package org.eclipse.etrice.generator.cpp.gen
import com.google.inject.Inject
import com.google.inject.Singleton
+import java.util.ArrayList
import org.eclipse.etrice.core.genmodel.base.ILogger
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.InterfaceItem
import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.Port
import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.ProtocolClass
+import org.eclipse.etrice.core.room.SAPRef
+import org.eclipse.etrice.core.room.SPPRef
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.xtext.generator.JavaIoFileSystemAccess
-import org.eclipse.etrice.core.room.InterfaceItem
-import org.eclipse.etrice.core.room.Port
-import org.eclipse.etrice.core.room.SAPRef
-import org.eclipse.etrice.core.room.SPPRef
-
+import org.eclipse.etrice.core.room.PortClass
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
@@ -30,6 +31,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
@Inject extension RoomExtensions roomExt
@Inject extension ProcedureHelpers helpers
@Inject extension TypeHelpers
+ @Inject extension Initialization
@Inject ILogger logger
def doGenerate(Root root) {
@@ -118,8 +120,8 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«ENDIF»
public:
// constructors
- «portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress);
- «portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress);
+ «portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true);
+ «portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true);
virtual void receive(etRuntime::Message* m);
«IF pclass!=null»
@@ -139,7 +141,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
class «replPortClassName» {
private:
int m_replication;
- std::vector<«portClassName»> m_ports;
+ «portClassName»* m_ports; //dynamic array used instead of vector to avoid copy construction
public:
«replPortClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress);
@@ -147,7 +149,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
int getReplication() { return m_replication; }
int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx(); }
- «portClassName» get(int i) {return m_ports.at(i);}
+ «portClassName» get(int i) {return m_ports[i];}
«IF pc.commType==CommunicationType::EVENT_DRIVEN»
// outgoing messages
@@ -200,20 +202,26 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// «IF conj»conjugated «ENDIF»port class
//------------------------------------------------------------------------------------------------------------
- «portClassName»::«portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress)
- : PortBase(actor, parent, name, localId, 0, addr, peerAddress)
+ «portClassName»::«portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress, bool doRegistration)
+ : «pclass.generateConstructorInitalizerList("0")»
{
- DebuggingService::getInstance().addPortInstance(*this);
+ «IF pclass!=null»«pclass.attributes.attributeInitialization(false)»«ENDIF»
+ if (doRegistration) {
+ DebuggingService::getInstance().addPortInstance(*this);
+ }
}
- «portClassName»::«portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress)
- : PortBase(actor, parent, name, localId, idx, addr, peerAddress)
+ «portClassName»::«portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress, bool doRegistration)
+ : «pclass.generateConstructorInitalizerList("idx")»
{
- DebuggingService::getInstance().addPortInstance(*this);
+ «IF pclass!=null»«pclass.attributes.attributeInitialization(false)»«ENDIF»
+ if (doRegistration) {
+ DebuggingService::getInstance().addPortInstance(*this);
+ }
}
void «portClassName»::receive(Message* msg) {
- if (! «pc.name»::isValidIncomingEvtID(msg->getEvtId())) {
+ if (! «pc.name»::«IF conj»isValidOutgoingEvtID«ELSE»isValidIncomingEvtID«ENDIF»(msg->getEvtId())) {
std::cout << "unknown" << std::endl;
}
else {
@@ -234,7 +242,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«ENDFOR»
default:
«ENDIF»
- getActor().receiveEvent(*this, msg->getEvtId(), msg->getData());
+ getActor().receiveEvent(this, msg->getEvtId(), msg->getData());
«IF pc.handlesReceive(conj)»
break;
}
@@ -260,10 +268,11 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
{
char numstr[10]; // enough to hold all numbers up to 32-bits
- m_ports.reserve(m_replication);
+ m_ports = reinterpret_cast<«portClassName»*> (new char[sizeof(«portClassName») * addr.size()]);
for (int i = 0; i < m_replication; ++i) {
snprintf(numstr, sizeof(numstr), "%d", i);
- m_ports.push_back(«portClassName»(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]));
+ //placement new to avoid copy construction, therefore no vector is used
+ new (&m_ports[i]) «portClassName»(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);
}
};
@@ -272,13 +281,26 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«FOR m : pc.getOutgoing(conj)»
«messageSignatureDefinition(m, replPortClassName)»{
for (int i=0; i<m_replication; ++i) {
- m_ports.at(i).«messageCall(m)»;
+ m_ports[i].«messageCall(m)»;
}
}
«ENDFOR»
'''
}
+ def generateConstructorInitalizerList(PortClass pc, String index) {
+ var initializerList = new ArrayList<CharSequence>();
+ initializerList.add('''PortBase(actor, parent, name, localId, «index», addr, peerAddress)''')
+ if (pc != null) {
+ for (attrib: pc.attributes) {
+ initializerList.add(attrib.attributeInitialization(false))
+ }
+ }
+ return
+ '''
+ «initializerList.join(',\n')»
+ '''
+ }
@@ -361,7 +383,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
if (getPeerAddress().isValid()){
«IF m.data==null»getPeerMsgReceiver()->receive(new Message(getPeerAddress(), «portClassName»::«dir»_«m.name»));
«ELSE»getPeerMsgReceiver()->receive(new Message(getPeerAddress(),«portClassName»::«dir»_«m.name»,
- reinterpret_cast<void*>(«IF (m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))»&«ENDIF»«m.data.name»),
+ reinterpret_cast<void*>(«IF (!m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))»&«ENDIF»«m.data.name»),
sizeof(«m.data.refType.type.typeName»)));
«ENDIF»
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend
index 86a9328ea..eedcc9104 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend
@@ -96,7 +96,7 @@ class SubSystemClassGen {
{
}
- virtual void receiveEvent(const etRuntime::InterfaceItemBase& ifitem, int evt, void* data);
+ virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);
virtual void instantiateMessageServices();
virtual void instantiateActors();
@@ -127,7 +127,7 @@ class SubSystemClassGen {
using namespace etRuntime;
- void «comp.name»::receiveEvent(const InterfaceItemBase& ifitem, int evt, void* data){
+ void «comp.name»::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data){
}
void «comp.name»::instantiateMessageServices(){
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.smap b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.smap
new file mode 100644
index 000000000..704f2d2f9
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.smap
@@ -0,0 +1,94 @@
+SMAP
+ConfigGenAddon.java
+Xtend
+*S Xtend
+*F
++ 0 ConfigGenAddon.xtend
+src/org/eclipse/etrice/generator/cpp/gen/ConfigGenAddon.xtend
+*L
+34:42,2
+35:44
+36:45,2
+37:47,3
+34:50
+38:51,2
+39:53,3
+34:56
+40:57,2
+34:59
+41:60,10
+42:70,10
+34:80
+43:81,5
+44:86,12
+34:98
+45:99,3
+47:102,12
+48:114,6
+49:120,11
+34:131,5
+53:136,2
+54:138,9
+34:147,6
+61:156,2
+62:158,3
+63:161,4
+61:165
+63:166,4
+61:170,2
+63:172,8
+64:180,6
+65:186,9
+67:195,6
+68:201,10
+71:211,8
+61:219
+71:220,4
+61:224,2
+71:226,7
+72:233,6
+73:239,12
+75:251,6
+76:257,13
+79:270,7
+80:277,6
+61:283,3
+83:286,3
+84:289,8
+61:297
+84:298,4
+61:302,2
+84:304,7
+85:311,10
+86:321,9
+61:330,3
+91:336,2
+92:338,17
+91:355,2
+94:357,5
+91:362,2
+96:364,2
+91:366
+98:367
+99:368,5
+91:373
+100:374,4
+101:378,13
+91:391,3
+103:394,4
+104:398,13
+91:411,4
+93:415
+91:416,2
+111:421,3
+112:424,3
+113:427
+112:428,2
+114:430,3
+115:433
+114:434,2
+116:436,3
+117:439
+116:440,2
+119:442
+*E
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java
index bdc47ebac..8d6ba7423 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java
@@ -112,6 +112,10 @@ public class CppExtensions implements ILanguageExtension {
return true;
}
+ public boolean usesPointers() {
+ return true;
+ }
+
public String genEnumeration(final String name, final List<Pair<String,String>> entries) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("typedef enum {");
@@ -154,8 +158,10 @@ public class CppExtensions implements ILanguageExtension {
public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) {
String _plus = (type + " ");
String _plus_1 = (_plus + name);
- String _plus_2 = (_plus_1 + "[]");
- return _plus_2;
+ String _plus_2 = (_plus_1 + "[");
+ String _plus_3 = (_plus_2 + Integer.valueOf(size));
+ String _plus_4 = (_plus_3 + "]");
+ return _plus_4;
}
public String constructorName(final String cls) {
@@ -319,6 +325,7 @@ public class CppExtensions implements ILanguageExtension {
}
public String[] generateArglistAndTypedData(final VarDecl data) {
+ String deref = "*";
boolean _equals = Objects.equal(data, null);
if (_equals) {
return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class));
@@ -378,28 +385,34 @@ public class CppExtensions implements ILanguageExtension {
typeName = _plus_1;
String _plus_2 = (castTypeName + "*");
castTypeName = _plus_2;
- }
- RefableType _refType_5 = data.getRefType();
- DataType _type_4 = _refType_5.getType();
- boolean _not = (!(_type_4 instanceof PrimitiveType));
- if (_not) {
- String _plus_3 = (typeName + "*");
- typeName = _plus_3;
- String _plus_4 = (castTypeName + "*");
- castTypeName = _plus_4;
+ } else {
+ RefableType _refType_5 = data.getRefType();
+ DataType _type_4 = _refType_5.getType();
+ boolean _not = (!(_type_4 instanceof PrimitiveType));
+ if (_not) {
+ String _plus_3 = (typeName + "*");
+ typeName = _plus_3;
+ String _plus_4 = (castTypeName + "*");
+ castTypeName = _plus_4;
+ } else {
+ castTypeName = typeName;
+ deref = "";
+ }
}
String _plus_5 = (typeName + " ");
String _name_1 = data.getName();
String _plus_6 = (_plus_5 + _name_1);
- String _plus_7 = (_plus_6 + " = *((");
- String _plus_8 = (_plus_7 + castTypeName);
- final String typedData = (_plus_8 + ") generic_data);\n");
+ String _plus_7 = (_plus_6 + " = ");
+ String _plus_8 = (_plus_7 + deref);
+ String _plus_9 = (_plus_8 + "((");
+ String _plus_10 = (_plus_9 + castTypeName);
+ final String typedData = (_plus_10 + ") generic_data);\n");
String _name_2 = data.getName();
final String dataArg = (", " + _name_2);
- String _plus_9 = (", " + typeName);
- String _plus_10 = (_plus_9 + " ");
+ String _plus_11 = (", " + typeName);
+ String _plus_12 = (_plus_11 + " ");
String _name_3 = data.getName();
- final String typedArgList = (_plus_10 + _name_3);
+ final String typedArgList = (_plus_12 + _name_3);
return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList(dataArg, typedData, typedArgList), String.class));
}
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java
index 2450aa048..6010749c6 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java
@@ -252,11 +252,36 @@ public class DataClassGen {
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
+ {
+ DataClass _base_5 = dc.getBase();
+ boolean _notEquals_2 = (!Objects.equal(_base_5, null));
+ if (_notEquals_2) {
+ _builder.append("\t");
+ _builder.append("// constructor using base class constructor");
+ _builder.newLine();
+ _builder.append("\t");
+ String _name_14 = dc.getName();
+ _builder.append(_name_14, " ");
+ _builder.append("(");
+ DataClass _base_6 = dc.getBase();
+ String _name_15 = _base_6.getName();
+ _builder.append(_name_15, " ");
+ _builder.append(" _super, ");
+ EList<Attribute> _attributes_3 = dc.getAttributes();
+ CharSequence _argListConstructor = this.argListConstructor(_attributes_3);
+ String _string = _argListConstructor.toString();
+ _builder.append(_string, " ");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("\t");
+ _builder.newLine();
_builder.append("};");
_builder.newLine();
_builder.newLine();
- String _name_14 = dc.getName();
- CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_14);
+ String _name_16 = dc.getName();
+ CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_16);
_builder.append(_generateIncludeGuardEnd, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
@@ -480,16 +505,73 @@ public class DataClassGen {
_builder.append("}");
_builder.newLine();
_builder.newLine();
+ {
+ DataClass _base_7 = dc.getBase();
+ boolean _notEquals_4 = (!Objects.equal(_base_7, null));
+ if (_notEquals_4) {
+ _builder.append("// constructor using base class constructor");
+ _builder.newLine();
+ String _name_15 = dc.getName();
+ _builder.append(_name_15, "");
+ _builder.append("::");
+ String _name_16 = dc.getName();
+ _builder.append(_name_16, "");
+ _builder.append("(");
+ DataClass _base_8 = dc.getBase();
+ String _name_17 = _base_8.getName();
+ _builder.append(_name_17, "");
+ _builder.append(" _super, ");
+ EList<Attribute> _attributes_3 = dc.getAttributes();
+ CharSequence _argListConstructor = this.argListConstructor(_attributes_3);
+ String _string = _argListConstructor.toString();
+ _builder.append(_string, "");
+ _builder.append(")");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append(":");
+ _builder.newLine();
+ _builder.append("\t");
+ DataClass _base_9 = dc.getBase();
+ String _name_18 = _base_9.getName();
+ _builder.append(_name_18, " ");
+ _builder.append("(_super),");
+ _builder.newLineIfNotEmpty();
+ {
+ EList<Attribute> _attributes_4 = dc.getAttributes();
+ boolean _hasElements_2 = false;
+ for(final Attribute a_2 : _attributes_4) {
+ if (!_hasElements_2) {
+ _hasElements_2 = true;
+ } else {
+ _builder.appendImmediate(",", " ");
+ }
+ _builder.append("\t");
+ String _name_19 = a_2.getName();
+ _builder.append(_name_19, " ");
+ _builder.append("(");
+ String _name_20 = a_2.getName();
+ _builder.append(_name_20, " ");
+ _builder.append("_)");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("{");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ }
+ }
+ _builder.newLine();
_builder.append("// assignment operator");
_builder.newLine();
- String _name_15 = dc.getName();
- _builder.append(_name_15, "");
+ String _name_21 = dc.getName();
+ _builder.append(_name_21, "");
_builder.append("& ");
- String _name_16 = dc.getName();
- _builder.append(_name_16, "");
+ String _name_22 = dc.getName();
+ _builder.append(_name_22, "");
_builder.append("::operator=(const ");
- String _name_17 = dc.getName();
- _builder.append(_name_17, "");
+ String _name_23 = dc.getName();
+ _builder.append(_name_23, "");
_builder.append("& rhs)");
_builder.newLineIfNotEmpty();
_builder.append("{\t\t");
@@ -498,26 +580,26 @@ public class DataClassGen {
_builder.append("if (this == &rhs) { return *this; };");
_builder.newLine();
{
- DataClass _base_7 = dc.getBase();
- boolean _notEquals_4 = (!Objects.equal(_base_7, null));
- if (_notEquals_4) {
+ DataClass _base_10 = dc.getBase();
+ boolean _notEquals_5 = (!Objects.equal(_base_10, null));
+ if (_notEquals_5) {
_builder.append("\t");
- DataClass _base_8 = dc.getBase();
- String _name_18 = _base_8.getName();
- _builder.append(_name_18, " ");
+ DataClass _base_11 = dc.getBase();
+ String _name_24 = _base_11.getName();
+ _builder.append(_name_24, " ");
_builder.append("::operator=(rhs);");
_builder.newLineIfNotEmpty();
}
}
{
- EList<Attribute> _attributes_3 = dc.getAttributes();
- for(final Attribute a_2 : _attributes_3) {
+ EList<Attribute> _attributes_5 = dc.getAttributes();
+ for(final Attribute a_3 : _attributes_5) {
_builder.append("\t");
- String _name_19 = a_2.getName();
- _builder.append(_name_19, " ");
+ String _name_25 = a_3.getName();
+ _builder.append(_name_25, " ");
_builder.append("= rhs.");
- String _name_20 = a_2.getName();
- _builder.append(_name_20, " ");
+ String _name_26 = a_3.getName();
+ _builder.append(_name_26, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
}
@@ -529,8 +611,8 @@ public class DataClassGen {
_builder.newLine();
_builder.newLine();
EList<StandardOperation> _operations_2 = dc.getOperations();
- String _name_21 = dc.getName();
- CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations_2, _name_21);
+ String _name_27 = dc.getName();
+ CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations_2, _name_27);
_builder.append(_operationsImplementation, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.smap b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.smap
new file mode 100644
index 000000000..8c098acdf
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.smap
@@ -0,0 +1,22 @@
+SMAP
+MainGen.java
+Xtend
+*S Xtend
+*F
++ 0 MainGen.xtend
+src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
+*L
+34:40
+35:41,2
+36:43
+37:44
+36:45
+35:46
+43:50
+44:51
+45:52
+46:53
+48:54,3
+49:57
+48:58
+*E
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
index 0cd388367..06c8a4345 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
@@ -3,6 +3,7 @@ package org.eclipse.etrice.generator.cpp.gen;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import com.google.inject.Singleton;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.eclipse.emf.common.util.EList;
@@ -27,12 +28,14 @@ import org.eclipse.etrice.core.room.SAPRef;
import org.eclipse.etrice.core.room.SPPRef;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.generator.cpp.gen.CppExtensions;
+import org.eclipse.etrice.generator.cpp.gen.Initialization;
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.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
@Singleton
@SuppressWarnings("all")
@@ -53,6 +56,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
private TypeHelpers _typeHelpers;
@Inject
+ private Initialization _initialization;
+
+ @Inject
private ILogger logger;
public void doGenerate(final Root root) {
@@ -309,11 +315,11 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("\t ");
_builder.append(portClassName, " ");
- _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress); ");
+ _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); ");
_builder.newLineIfNotEmpty();
_builder.append("\t ");
_builder.append(portClassName, " ");
- _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress);");
+ _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true);");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t ");
@@ -374,9 +380,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("int m_replication;");
_builder.newLine();
_builder.append("\t ");
- _builder.append("std::vector<");
_builder.append(portClassName, " ");
- _builder.append("> m_ports;");
+ _builder.append("* m_ports; //dynamic array used instead of vector to avoid copy construction");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
@@ -401,7 +406,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("\t\t");
_builder.append(portClassName, " ");
- _builder.append(" get(int i) {return m_ports.at(i);}");
+ _builder.append(" get(int i) {return m_ports[i];}");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.newLine();
@@ -540,32 +545,68 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(portClassName, "");
_builder.append("::");
_builder.append(portClassName, "");
- _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress)");
+ _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress, bool doRegistration)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append(": PortBase(actor, parent, name, localId, 0, addr, peerAddress)");
- _builder.newLine();
+ _builder.append(": ");
+ CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(pclass, "0");
+ _builder.append(_generateConstructorInitalizerList, " ");
+ _builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
+ {
+ boolean _notEquals = (!Objects.equal(pclass, null));
+ if (_notEquals) {
+ EList<Attribute> _attributes = pclass.getAttributes();
+ CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes, false);
+ _builder.append(_attributeInitialization, " ");
+ }
+ }
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("if (doRegistration) {");
+ _builder.newLine();
+ _builder.append("\t\t");
_builder.append("DebuggingService::getInstance().addPortInstance(*this);");
_builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append(portClassName, "");
_builder.append("::");
_builder.append(portClassName, "");
- _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress)");
+ _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress, bool doRegistration)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append(": PortBase(actor, parent, name, localId, idx, addr, peerAddress)");
- _builder.newLine();
+ _builder.append(": ");
+ CharSequence _generateConstructorInitalizerList_1 = this.generateConstructorInitalizerList(pclass, "idx");
+ _builder.append(_generateConstructorInitalizerList_1, " ");
+ _builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
+ {
+ boolean _notEquals_1 = (!Objects.equal(pclass, null));
+ if (_notEquals_1) {
+ EList<Attribute> _attributes_1 = pclass.getAttributes();
+ CharSequence _attributeInitialization_1 = this._initialization.attributeInitialization(_attributes_1, false);
+ _builder.append(_attributeInitialization_1, " ");
+ }
+ }
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("if (doRegistration) {");
+ _builder.newLine();
+ _builder.append("\t\t");
_builder.append("DebuggingService::getInstance().addPortInstance(*this);");
_builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("\t");
@@ -578,7 +619,15 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("if (! ");
String _name = pc.getName();
_builder.append(_name, " ");
- _builder.append("::isValidIncomingEvtID(msg->getEvtId())) {");
+ _builder.append("::");
+ {
+ if ((conj).booleanValue()) {
+ _builder.append("isValidOutgoingEvtID");
+ } else {
+ _builder.append("isValidIncomingEvtID");
+ }
+ }
+ _builder.append("(msg->getEvtId())) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("std::cout << \"unknown\" << std::endl;");
@@ -658,7 +707,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
}
}
_builder.append("\t\t\t\t");
- _builder.append("getActor().receiveEvent(*this, msg->getEvtId(),\tmsg->getData());");
+ _builder.append("getActor().receiveEvent(this, msg->getEvtId(),\tmsg->getData());");
_builder.newLine();
{
boolean _handlesReceive_1 = this.roomExt.handlesReceive(pc, (conj).booleanValue());
@@ -679,8 +728,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.newLine();
{
- boolean _notEquals = (!Objects.equal(pclass, null));
- if (_notEquals) {
+ boolean _notEquals_2 = (!Objects.equal(pclass, null));
+ if (_notEquals_2) {
EList<PortOperation> _operations = pclass.getOperations();
CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations, portClassName);
_builder.append(_operationsImplementation, "");
@@ -732,8 +781,12 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.newLine();
_builder.append("\t");
- _builder.append("m_ports.reserve(m_replication);");
- _builder.newLine();
+ _builder.append("m_ports = reinterpret_cast<");
+ _builder.append(portClassName, " ");
+ _builder.append("*> (new char[sizeof(");
+ _builder.append(portClassName, " ");
+ _builder.append(") * addr.size()]);");
+ _builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("for (int i = 0; i < m_replication; ++i) {");
_builder.newLine();
@@ -741,9 +794,12 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("snprintf(numstr, sizeof(numstr), \"%d\", i);");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("m_ports.push_back(");
+ _builder.append("//placement new to avoid copy construction, therefore no vector is used");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("new (&m_ports[i]) ");
_builder.append(portClassName, " ");
- _builder.append("(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]));");
+ _builder.append("(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
@@ -766,7 +822,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("for (int i=0; i<m_replication; ++i) {");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("m_ports.at(i).");
+ _builder.append("m_ports[i].");
CharSequence _messageCall = this.messageCall(m_1);
_builder.append(_messageCall, " ");
_builder.append(";");
@@ -783,6 +839,29 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
return _xblockexpression;
}
+ public CharSequence generateConstructorInitalizerList(final PortClass pc, final String index) {
+ ArrayList<CharSequence> _arrayList = new ArrayList<CharSequence>();
+ ArrayList<CharSequence> initializerList = _arrayList;
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("PortBase(actor, parent, name, localId, ");
+ _builder.append(index, "");
+ _builder.append(", addr, peerAddress)");
+ initializerList.add(_builder);
+ boolean _notEquals = (!Objects.equal(pc, null));
+ if (_notEquals) {
+ EList<Attribute> _attributes = pc.getAttributes();
+ for (final Attribute attrib : _attributes) {
+ CharSequence _attributeInitialization = this._initialization.attributeInitialization(attrib, false);
+ initializerList.add(_attributeInitialization);
+ }
+ }
+ StringConcatenation _builder_1 = new StringConcatenation();
+ String _join = IterableExtensions.join(initializerList, ",\n");
+ _builder_1.append(_join, "");
+ _builder_1.newLineIfNotEmpty();
+ return _builder_1;
+ }
+
private CharSequence messageCall(final Message m) {
StringConcatenation _builder = new StringConcatenation();
String _name = m.getName();
@@ -1150,14 +1229,15 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
VarDecl _data_1 = m.getData();
RefableType _refType = _data_1.getRefType();
boolean _isRef = _refType.isRef();
- if (!_isRef) {
+ boolean _not = (!_isRef);
+ if (!_not) {
_and = false;
} else {
VarDecl _data_2 = m.getData();
RefableType _refType_1 = _data_2.getRefType();
DataType _type = _refType_1.getType();
- boolean _not = (!(_type instanceof PrimitiveType));
- _and = (_isRef && _not);
+ boolean _not_1 = (!(_type instanceof PrimitiveType));
+ _and = (_not && _not_1);
}
if (_and) {
_builder.append("&");
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.smap b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.smap
new file mode 100644
index 000000000..e0fd14248
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.smap
@@ -0,0 +1,47 @@
+SMAP
+StateMachineGen.java
+Xtend
+*S Xtend
+*F
++ 0 StateMachineGen.xtend
+src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
+*L
+30:30,2
+31:32
+30:33
+32:34,16
+30:50,2
+47:55,2
+48:57
+47:58
+49:59
+50:60,3
+47:63
+50:64,3
+47:67,3
+50:70
+47:71
+50:72,5
+47:77,2
+51:79,6
+59:85,21
+49:106
+47:107,2
+70:112,3
+71:115
+70:116,2
+71:118
+70:119,3
+73:122,2
+74:124,2
+75:126
+76:127,9
+75:136
+79:137
+83:141,2
+87:146
+91:150
+95:154
+99:158,2
+103:163
+*E
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.smap b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.smap
new file mode 100644
index 000000000..c1c4867e8
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.smap
@@ -0,0 +1,167 @@
+SMAP
+SubSystemClassGen.java
+Xtend
+*S Xtend
+*F
++ 0 SubSystemClassGen.xtend
+src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend
+*L
+35:58,3
+36:61,5
+37:66,2
+38:68,5
+39:73
+40:74,3
+42:77,3
+43:80,5
+44:85
+45:86,3
+35:89,2
+59:94,14
+64:108,11
+68:119,40
+59:159
+82:160,2
+59:162,2
+84:164,5
+87:169,7
+89:176,7
+91:183,9
+94:192,38
+107:230,4
+59:234
+111:238,14
+116:252,12
+120:264,10
+111:274
+123:275,4
+124:279,8
+111:287,2
+125:289,12
+130:301,11
+133:312,9
+111:321
+136:322,4
+137:326,12
+111:338,2
+138:340,16
+144:356,10
+111:366
+147:367,6
+148:373,9
+111:382,2
+149:384,2
+111:386
+151:387,4
+152:391,9
+154:400,13
+155:413,3
+111:416
+156:417,2
+111:419
+157:420,2
+111:422
+158:423,3
+159:426,5
+160:431,14
+111:445,3
+162:448,2
+163:450,11
+111:461,6
+166:467,6
+169:473,5
+111:478
+170:479,7
+172:486,7
+174:493,4
+175:497,7
+177:504,9
+111:513
+178:514,6
+111:520
+180:521,3
+181:524,6
+111:530,2
+182:532,3
+183:535,6
+184:541,6
+185:547,7
+111:554,2
+187:556,4
+111:560
+190:561,2
+111:563
+191:564,15
+193:579,14
+194:593,6
+111:599
+195:600,3
+196:603,12
+111:615,2
+197:617,2
+111:619,4
+200:623,13
+206:636,5
+111:641
+207:642,4
+208:646,9
+111:655,2
+209:657,2
+210:659,5
+111:664
+211:665,4
+212:669,9
+111:678,2
+213:680,27
+111:707
+227:711,2
+228:713,6
+230:719,4
+231:723,9
+233:732,7
+227:739
+234:740,2
+227:742
+235:743,2
+227:745
+236:746,4
+237:750,7
+227:757
+238:758
+239:759,11
+227:770
+240:771,2
+241:773,19
+227:792,5
+244:797
+245:798,7
+246:805,11
+227:816,2
+248:818,11
+227:829,3
+253:835,2
+254:837,6
+256:843,4
+257:847,9
+259:856,7
+253:863
+260:864,2
+253:866
+261:867,10
+253:877,2
+263:879,4
+264:883,7
+253:890
+265:891
+266:892,11
+253:903
+267:904,2
+253:906
+268:907,2
+269:909,19
+253:928
+271:929,15
+253:944,6
+275:950,10
+253:960,5
+*E
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.smap b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.smap
new file mode 100644
index 000000000..e73e35954
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.smap
@@ -0,0 +1,31 @@
+SMAP
+SubSystemRunnerGen.java
+Xtend
+*S Xtend
+*F
++ 0 SubSystemRunnerGen.xtend
+src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend
+*L
+20:27,3
+21:30,6
+22:36,5
+24:41,6
+25:47,5
+20:52,2
+29:57,11
+33:68,5
+34:73,8
+37:81,10
+41:91,27
+51:118,5
+29:123
+55:127,11
+59:138,5
+60:143,10
+64:153,5
+65:158,24
+76:182,15
+81:197,6
+82:203,56
+55:259
+*E

Back to the top