summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Karlitschek2012-08-15 02:07:45 (EDT)
committerPeter Karlitschek2012-08-15 02:07:45 (EDT)
commita9c2535fa41c97a9a03cffe8ce9b53683c7bbfb4 (patch)
tree9733b97941a97780432064d69036d7f2e47571d8
parente3a69e2a78c486faf4d637722a8316aae7117112 (diff)
downloadorg.eclipse.etrice-a9c2535fa41c97a9a03cffe8ce9b53683c7bbfb4.zip
org.eclipse.etrice-a9c2535fa41c97a9a03cffe8ce9b53683c7bbfb4.tar.gz
org.eclipse.etrice-a9c2535fa41c97a9a03cffe8ce9b53683c7bbfb4.tar.bz2
cpp runtime initialrefs/changes/22/8122/1
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/.gitignore1
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/Main.classbin5142 -> 4923 bytes
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend30
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend16
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend81
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend30
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend16
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend81
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java154
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/Activator.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/Activator.java2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/Debug/.gitignore4
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/.gitignore1
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/Debug/liborg.eclipse.etrice.runtime.cpp.abin55354 -> 0 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/debugging/DebuggingService.obin12007 -> 0 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Address.obin8880 -> 0 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Message.obin10402 -> 0 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/InterfaceItemBase.obin10858 -> 0 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/PortBase.obin11320 -> 0 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp21
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h27
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp4
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h14
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp21
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h26
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp5
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h31
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp4
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h2
39 files changed, 351 insertions, 260 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/.gitignore b/plugins/org.eclipse.etrice.generator.cpp/.gitignore
new file mode 100644
index 0000000..092357e
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/.gitignore
@@ -0,0 +1 @@
+bin
diff --git a/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF
index 5d8d9d2..1a4ab17 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.1.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.xtext.xtend2.lib;bundle-version="2.1.1",
org.eclipse.etrice.generator.doc;bundle-version="0.1.0",
- org.eclipse.xtext;bundle-version="2.1.1"
+ org.eclipse.xtext;bundle-version="2.1.1",
+ org.eclipse.etrice.core.genmodel
Bundle-Version: 0.2.0.qualifier
Bundle-Vendor: eTrice (Incubation)
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/Main.class b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/Main.class
index c16afb9..380777c 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/Main.class
+++ b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/Main.class
Binary files differ
diff --git a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
index d88c900..9fafaeb 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
@@ -10,24 +10,24 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.cpp.gen
+package org.eclipse.etrice.generator.cpp.gen
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import java.util.List
+import org.eclipse.etrice.core.room.Attribute
+import org.eclipse.etrice.core.room.ComplexType
+import org.eclipse.etrice.core.room.DataClass
+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 com.google.inject.Inject
-import com.google.inject.Singleton
-import java.util.List
-import org.eclipse.etrice.core.room.Attribute
-import org.eclipse.etrice.core.room.DataClass
-import org.eclipse.etrice.core.room.ComplexType
+import org.eclipse.etrice.core.genmodel.base.ILogger
+import org.eclipse.etrice.core.genmodel.etricegen.Root
+
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.generator.base.ILogger
-import org.eclipse.etrice.generator.etricegen.Root
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess
-import org.eclipse.etrice.generator.generic.RoomExtensions
-import org.eclipse.etrice.generator.generic.ProcedureHelpers
-import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.core.room.RoomModel
-
@Singleton
class DataClassGen {
diff --git a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
index 71bb376..61ed44a 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
@@ -10,15 +10,15 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.cpp.gen
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.emf.ecore.resource.Resource
-import org.eclipse.etrice.generator.etricegen.Root
-import org.eclipse.xtext.generator.IFileSystemAccess
+package org.eclipse.etrice.generator.cpp.gen
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.etrice.generator.generic.PrepareFileSystem
+import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
-import org.eclipse.etrice.generator.generic.PrepareFileSystem
+import org.eclipse.etrice.core.genmodel.etricegen.Root
@Singleton
class MainGen implements IGenerator {
diff --git a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
index 7de4158..240526f 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/bin/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
@@ -11,23 +11,25 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.cpp.gen
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.etrice.core.room.Message
+package org.eclipse.etrice.generator.cpp.gen
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.etrice.core.room.CommunicationType
+import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.ProtocolClass
-import org.eclipse.etrice.core.room.CommunicationType
-import org.eclipse.etrice.core.room.PrimitiveType
-import org.eclipse.etrice.generator.base.ILogger
-import org.eclipse.etrice.generator.etricegen.Root
+
+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.generator.generic.RoomExtensions
-import org.eclipse.etrice.generator.generic.ProcedureHelpers
-import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
-import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.genmodel.base.ILogger
+import org.eclipse.etrice.core.genmodel.etricegen.Root
@Singleton
@@ -40,7 +42,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
@Inject extension TypeHelpers
@Inject ILogger logger
- def doGenerate(Root root) {
+ def doGenerate(Root root) {
for (pc: root.usedProtocolClasses) {
var path = pc.generationTargetPath+pc.getPath
@@ -70,7 +72,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
#include "common/modelbase/InterfaceItemBase.h"
#include "common/messaging/Address.h"
#include "common/messaging/Message.h"
- #include <list>
+ #include <vector>
namespace etRuntime {
class IEventReceiver;
@@ -93,7 +95,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«helpers.userCode(pc.userCode2)»
private:
- static char messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
+ static char* messageStrings[];
public:
char* getMessageString(int msg_id);
@@ -139,12 +141,12 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
//------------------------------------------------------------------------------------------------------------
class «replPortClassName» {
private:
- std::list<«portClassName»> ports;
+ std::vector<«portClassName»> ports;
int replication;
public:
// constructor
- «replPortClassName»(etRuntime::IEventReceiver actor, char* name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress);
+ «replPortClassName»(etRuntime::IEventReceiver actor, char* name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress);
int getReplication() { return replication; }
int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx(); }
@@ -189,11 +191,11 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
DebuggingService::getInstance().addPortInstance(*this);
}
- void «pc.name»::«portClassName»::receive(Message m) {
- if (!(m instanceof EventMessage)) return;
- EventMessage msg = (EventMessage) m;
+ void «pc.name»::«portClassName»::receive(Message msg) {
+ //if (!(m instanceof EventMessage)) return;
+ //EventMessage msg = (EventMessage) m;
if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
- System.out.println("unknown");
+ printf("unknown");
else {
if (messageStrings[msg.getEvtId()] != "timerTick"){
««« TODOTS: model switch for activation
@@ -212,11 +214,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
break;
«ENDFOR»
default:
- «ENDIF»
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
+ «ENDIF» getActor().receiveEvent(*this, msg.getEvtId(), msg.getData());
«IF pc.handlesReceive(conj)»
}
«ENDIF»
@@ -233,12 +231,11 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
//-------------------------------------------------------------------------------
// replicated port class
//-------------------------------------------------------------------------------
- «pc.name»::«replPortClassName»::«replPortClassName»(IEventReceiver actor, char* name, int localId, Address addr, Address peerAddress) {
- replication = addr==null? 0:addr.length;
- ports = new ArrayList<«pc.name».«portClassName»>(replication);
+ «pc.name»::«replPortClassName»::«replPortClassName»(IEventReceiver actor, char* name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) {
+ int replication = addr.size();
+ ports = new std::vector<«pc.name»::«portClassName»>(replication);
for (int i=0; i<replication; ++i) {
- ports.add(new «portClassName»(
- actor, name+i, localId, i, addr[i], peerAddress[i]));
+ ports[i] = new «pc.name»::«portClassName»(actor, name+i, localId, i, addr[i], peerAddress[i]);
}
}
@@ -274,6 +271,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
#include "«pc.getCppHeaderFileName»"
#include "common/debugging/DebuggingService.h"
+ #include <stdio.h>
using namespace etRuntime;
@@ -287,7 +285,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«helpers.userCode(pc.userCode2)»
- //private static char* messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
+ char* «pc.name»::messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
char* «pc.name»::getMessageString(int msg_id) {
if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
@@ -411,7 +409,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
«ENDFOR»
'''
- }
+ }
def private portClassSource(ProtocolClass pc, Boolean conj){
var portClassName = pc.getPortClassName(conj)
@@ -514,7 +512,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
// «var dir = if (conj) "IN" else "OUT"»
// «var hdlr = m.getSendHandler(conj)»
// «messageSignature(m)»{
-// if (getPeerAddress()!=null)
+// if (getPeerAddress()!= 0)
// «IF m.data==null»getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«m.name»));
// «ELSE»getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«m.name», «m.data.name»«IF (!m.data.ref)».deepCopy()«ENDIF»));
// «ENDIF»
@@ -546,7 +544,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
static const char* «pc.name»_messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR»«FOR m : pc.getAllIncomingMessages()»"«m.name»", «ENDFOR»"MAX"};
const char* «pc.name»_getMessageString(int msg_id) {
- if (msg_id<«pc.name»_MSG_MIN || msg_id>«pc.name»_MSG_MAX+1){
+ if (msg_id < «pc.name»::MSG_MIN || msg_id > «pc.name»::MSG_MAX+1){
/* id out of range */
return "Message ID out of range";
}
@@ -601,12 +599,13 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
«ELSE»
if (messageStrings[ «dir»_«m.name»] != "timerTick"){
««« TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«m.name»]);
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«m.name»]);
}
- if (getPeerAddress()!=null)
- «IF m.data==null»getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«m.name»));
- «ELSE»getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«m.name», «m.data.name»«IF (!m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))».deepCopy()«ENDIF»));
+ if (getPeerAddress().isValid()){
+ «IF m.data==null»getPeerMsgReceiver().receive(new Message(getPeerAddress(), «dir»_«m.name»));
+ «ELSE»getPeerMsgReceiver().receive(new Message(getPeerAddress(), «dir»_«m.name», reinterpret_cast<void*>(«IF (m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))»&«ENDIF»«m.data.name»)));
«ENDIF»
+ }
«ENDIF»
}
«IF m.data!=null && m.data.refType.type instanceof DataClass»
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java
index 2b03f7a..b541d5b 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java
@@ -17,9 +17,9 @@ import java.util.List;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.etricegen.Root;
import org.eclipse.etrice.generator.cpp.setup.GeneratorModule;
import org.eclipse.xtext.generator.IGenerator;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
import com.google.inject.Inject;
@@ -50,8 +50,8 @@ public class Main extends AbstractGenerator {
@Inject
private IGenerator mainGenerator;
- @Inject
- protected org.eclipse.etrice.generator.doc.gen.MainGen mainDocGenerator;
+// @Inject
+// protected org.eclipse.etrice.generator.doc.gen.MainGen mainDocGenerator;
public int runGenerator(String[] args) {
if (args.length == 0) {
@@ -107,7 +107,7 @@ public class Main extends AbstractGenerator {
mainGenerator.doGenerate(genModel.eResource(), fileAccess);
if (genInstDiag) {
- mainDocGenerator.doGenerate(genModel);
+ // mainDocGenerator.doGenerate(genModel);
}
logger.logInfo("-- finished code generation");
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java
index dbd98bd..9767452 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java
@@ -14,12 +14,12 @@ package org.eclipse.etrice.generator.cpp.gen;
import java.util.ArrayList;
+import org.eclipse.etrice.core.genmodel.base.ILogger;
import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.DetailCode;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.generator.base.DefaultTranslationProvider;
-import org.eclipse.etrice.generator.base.ILogger;
import com.google.inject.Inject;
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 d88c900..9fafaeb 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
@@ -10,24 +10,24 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.cpp.gen
+package org.eclipse.etrice.generator.cpp.gen
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import java.util.List
+import org.eclipse.etrice.core.room.Attribute
+import org.eclipse.etrice.core.room.ComplexType
+import org.eclipse.etrice.core.room.DataClass
+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 com.google.inject.Inject
-import com.google.inject.Singleton
-import java.util.List
-import org.eclipse.etrice.core.room.Attribute
-import org.eclipse.etrice.core.room.DataClass
-import org.eclipse.etrice.core.room.ComplexType
+import org.eclipse.etrice.core.genmodel.base.ILogger
+import org.eclipse.etrice.core.genmodel.etricegen.Root
+
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.generator.base.ILogger
-import org.eclipse.etrice.generator.etricegen.Root
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess
-import org.eclipse.etrice.generator.generic.RoomExtensions
-import org.eclipse.etrice.generator.generic.ProcedureHelpers
-import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.core.room.RoomModel
-
@Singleton
class DataClassGen {
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
index 71bb376..61ed44a 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend
@@ -10,15 +10,15 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.cpp.gen
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.emf.ecore.resource.Resource
-import org.eclipse.etrice.generator.etricegen.Root
-import org.eclipse.xtext.generator.IFileSystemAccess
+package org.eclipse.etrice.generator.cpp.gen
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.etrice.generator.generic.PrepareFileSystem
+import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
-import org.eclipse.etrice.generator.generic.PrepareFileSystem
+import org.eclipse.etrice.core.genmodel.etricegen.Root
@Singleton
class MainGen implements IGenerator {
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 7de4158..240526f 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
@@ -11,23 +11,25 @@
*
*******************************************************************************/
-package org.eclipse.etrice.generator.cpp.gen
-
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import org.eclipse.etrice.core.room.Message
+package org.eclipse.etrice.generator.cpp.gen
+
+import com.google.inject.Inject
+import com.google.inject.Singleton
+import org.eclipse.etrice.core.room.CommunicationType
+import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.ProtocolClass
-import org.eclipse.etrice.core.room.CommunicationType
-import org.eclipse.etrice.core.room.PrimitiveType
-import org.eclipse.etrice.generator.base.ILogger
-import org.eclipse.etrice.generator.etricegen.Root
+
+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.generator.generic.RoomExtensions
-import org.eclipse.etrice.generator.generic.ProcedureHelpers
-import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
-import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.genmodel.base.ILogger
+import org.eclipse.etrice.core.genmodel.etricegen.Root
@Singleton
@@ -40,7 +42,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
@Inject extension TypeHelpers
@Inject ILogger logger
- def doGenerate(Root root) {
+ def doGenerate(Root root) {
for (pc: root.usedProtocolClasses) {
var path = pc.generationTargetPath+pc.getPath
@@ -70,7 +72,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
#include "common/modelbase/InterfaceItemBase.h"
#include "common/messaging/Address.h"
#include "common/messaging/Message.h"
- #include <list>
+ #include <vector>
namespace etRuntime {
class IEventReceiver;
@@ -93,7 +95,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«helpers.userCode(pc.userCode2)»
private:
- static char messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
+ static char* messageStrings[];
public:
char* getMessageString(int msg_id);
@@ -139,12 +141,12 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
//------------------------------------------------------------------------------------------------------------
class «replPortClassName» {
private:
- std::list<«portClassName»> ports;
+ std::vector<«portClassName»> ports;
int replication;
public:
// constructor
- «replPortClassName»(etRuntime::IEventReceiver actor, char* name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress);
+ «replPortClassName»(etRuntime::IEventReceiver actor, char* name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress);
int getReplication() { return replication; }
int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx(); }
@@ -189,11 +191,11 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
DebuggingService::getInstance().addPortInstance(*this);
}
- void «pc.name»::«portClassName»::receive(Message m) {
- if (!(m instanceof EventMessage)) return;
- EventMessage msg = (EventMessage) m;
+ void «pc.name»::«portClassName»::receive(Message msg) {
+ //if (!(m instanceof EventMessage)) return;
+ //EventMessage msg = (EventMessage) m;
if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
- System.out.println("unknown");
+ printf("unknown");
else {
if (messageStrings[msg.getEvtId()] != "timerTick"){
««« TODOTS: model switch for activation
@@ -212,11 +214,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
break;
«ENDFOR»
default:
- «ENDIF»
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
+ «ENDIF» getActor().receiveEvent(*this, msg.getEvtId(), msg.getData());
«IF pc.handlesReceive(conj)»
}
«ENDIF»
@@ -233,12 +231,11 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
//-------------------------------------------------------------------------------
// replicated port class
//-------------------------------------------------------------------------------
- «pc.name»::«replPortClassName»::«replPortClassName»(IEventReceiver actor, char* name, int localId, Address addr, Address peerAddress) {
- replication = addr==null? 0:addr.length;
- ports = new ArrayList<«pc.name».«portClassName»>(replication);
+ «pc.name»::«replPortClassName»::«replPortClassName»(IEventReceiver actor, char* name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) {
+ int replication = addr.size();
+ ports = new std::vector<«pc.name»::«portClassName»>(replication);
for (int i=0; i<replication; ++i) {
- ports.add(new «portClassName»(
- actor, name+i, localId, i, addr[i], peerAddress[i]));
+ ports[i] = new «pc.name»::«portClassName»(actor, name+i, localId, i, addr[i], peerAddress[i]);
}
}
@@ -274,6 +271,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
#include "«pc.getCppHeaderFileName»"
#include "common/debugging/DebuggingService.h"
+ #include <stdio.h>
using namespace etRuntime;
@@ -287,7 +285,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«helpers.userCode(pc.userCode2)»
- //private static char* messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
+ char* «pc.name»::messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
char* «pc.name»::getMessageString(int msg_id) {
if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
@@ -411,7 +409,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
«ENDFOR»
'''
- }
+ }
def private portClassSource(ProtocolClass pc, Boolean conj){
var portClassName = pc.getPortClassName(conj)
@@ -514,7 +512,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
// «var dir = if (conj) "IN" else "OUT"»
// «var hdlr = m.getSendHandler(conj)»
// «messageSignature(m)»{
-// if (getPeerAddress()!=null)
+// if (getPeerAddress()!= 0)
// «IF m.data==null»getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«m.name»));
// «ELSE»getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«m.name», «m.data.name»«IF (!m.data.ref)».deepCopy()«ENDIF»));
// «ENDIF»
@@ -546,7 +544,7 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
static const char* «pc.name»_messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR»«FOR m : pc.getAllIncomingMessages()»"«m.name»", «ENDFOR»"MAX"};
const char* «pc.name»_getMessageString(int msg_id) {
- if (msg_id<«pc.name»_MSG_MIN || msg_id>«pc.name»_MSG_MAX+1){
+ if (msg_id < «pc.name»::MSG_MIN || msg_id > «pc.name»::MSG_MAX+1){
/* id out of range */
return "Message ID out of range";
}
@@ -601,12 +599,13 @@ void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const et
«ELSE»
if (messageStrings[ «dir»_«m.name»] != "timerTick"){
««« TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«m.name»]);
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[«dir»_«m.name»]);
}
- if (getPeerAddress()!=null)
- «IF m.data==null»getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), «dir»_«m.name»));
- «ELSE»getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), «dir»_«m.name», «m.data.name»«IF (!m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))».deepCopy()«ENDIF»));
+ if (getPeerAddress().isValid()){
+ «IF m.data==null»getPeerMsgReceiver().receive(new Message(getPeerAddress(), «dir»_«m.name»));
+ «ELSE»getPeerMsgReceiver().receive(new Message(getPeerAddress(), «dir»_«m.name», reinterpret_cast<void*>(«IF (m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))»&«ENDIF»«m.data.name»)));
«ENDIF»
+ }
«ENDIF»
}
«IF m.data!=null && m.data.refType.type instanceof DataClass»
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java
index 011fc41..2cf5769 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java
@@ -16,15 +16,13 @@ import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.GeneratorBaseModule;
import org.eclipse.etrice.generator.base.ITranslationProvider;
import org.eclipse.etrice.generator.cpp.Main;
+import org.eclipse.etrice.generator.cpp.gen.CppExtensions;
import org.eclipse.etrice.generator.cpp.gen.CppLanguageGenerator;
import org.eclipse.etrice.generator.cpp.gen.CppTranslationProvider;
import org.eclipse.etrice.generator.cpp.gen.MainGen;
-import org.eclipse.xtext.generator.IGenerator;
-import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.etrice.generator.generic.AbstractTransitionChainGenerator;
-import org.eclipse.etrice.generator.cpp.gen.CppExtensions;
-
-
+import org.eclipse.etrice.generator.generic.ILanguageExtension;
+import org.eclipse.xtext.generator.IGenerator;
import com.google.inject.Binder;
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 38f806f..967c1fc 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
@@ -5,6 +5,8 @@ import com.google.inject.Singleton;
import java.util.HashSet;
import java.util.List;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.etrice.core.genmodel.base.ILogger;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.ComplexType;
import org.eclipse.etrice.core.room.DataClass;
@@ -14,9 +16,7 @@ import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.generator.base.ILogger;
import org.eclipse.etrice.generator.cpp.gen.CppExtensions;
-import org.eclipse.etrice.generator.etricegen.Root;
import org.eclipse.etrice.generator.generic.ProcedureHelpers;
import org.eclipse.etrice.generator.generic.RoomExtensions;
import org.eclipse.etrice.generator.generic.TypeHelpers;
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java
index 81f63c9..177f6e7 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java
@@ -5,9 +5,9 @@ import com.google.inject.Singleton;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.cpp.gen.DataClassGen;
import org.eclipse.etrice.generator.cpp.gen.ProtocolClassGen;
-import org.eclipse.etrice.generator.etricegen.Root;
import org.eclipse.etrice.generator.generic.PrepareFileSystem;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
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 c72971d..efb4764 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
@@ -5,6 +5,8 @@ import com.google.inject.Singleton;
import java.util.HashSet;
import java.util.List;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.etrice.core.genmodel.base.ILogger;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.CommunicationType;
import org.eclipse.etrice.core.room.DataClass;
@@ -18,9 +20,7 @@ import org.eclipse.etrice.core.room.PrimitiveType;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.VarDecl;
-import org.eclipse.etrice.generator.base.ILogger;
import org.eclipse.etrice.generator.cpp.gen.CppExtensions;
-import org.eclipse.etrice.generator.etricegen.Root;
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator;
import org.eclipse.etrice.generator.generic.ProcedureHelpers;
import org.eclipse.etrice.generator.generic.RoomExtensions;
@@ -124,7 +124,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("#include \"common/messaging/Message.h\"");
_builder.newLine();
- _builder.append("#include <list>");
+ _builder.append("#include <vector>");
_builder.newLine();
_builder.newLine();
_builder.append("namespace etRuntime {");
@@ -193,28 +193,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("private:");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("static char messageStrings[] = {\"MIN\", ");
- {
- List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
- for(final Message m : _allOutgoingMessages) {
- _builder.append("\"");
- String _name_4 = m.getName();
- _builder.append(_name_4, " ");
- _builder.append("\",");
- }
- }
- _builder.append(" ");
- {
- List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
- for(final Message m_1 : _allIncomingMessages) {
- _builder.append("\"");
- String _name_5 = m_1.getName();
- _builder.append(_name_5, " ");
- _builder.append("\",");
- }
- }
- _builder.append("\"MAX\"};");
- _builder.newLineIfNotEmpty();
+ _builder.append("static char* messageStrings[];");
+ _builder.newLine();
_builder.newLine();
_builder.append(" ");
_builder.append("public:");
@@ -234,8 +214,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLineIfNotEmpty();
_builder.append("};");
_builder.newLine();
- String _name_6 = pc.getName();
- StringConcatenation _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_6);
+ String _name_4 = pc.getName();
+ StringConcatenation _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_4);
_builder.append(_generateIncludeGuardEnd, "");
_builder.newLineIfNotEmpty();
return _builder;
@@ -347,7 +327,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("private:");
_builder.newLine();
_builder.append("\t ");
- _builder.append("std::list<");
+ _builder.append("std::vector<");
_builder.append(portClassName, " ");
_builder.append("> ports;");
_builder.newLineIfNotEmpty();
@@ -363,7 +343,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("\t");
_builder.append(replPortClassName, " ");
- _builder.append("(etRuntime::IEventReceiver actor, char* name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress);");
+ _builder.append("(etRuntime::IEventReceiver actor, char* name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
@@ -499,19 +479,19 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(_name_2, "");
_builder.append("::");
_builder.append(portClassName, "");
- _builder.append("::receive(Message m) {");
+ _builder.append("::receive(Message msg) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("if (!(m instanceof EventMessage)) return;");
+ _builder.append("//if (!(m instanceof EventMessage)) return;");
_builder.newLine();
_builder.append("\t");
- _builder.append("EventMessage msg = (EventMessage) m;");
+ _builder.append("//EventMessage msg = (EventMessage) m;");
_builder.newLine();
_builder.append("\t");
_builder.append("if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("System.out.println(\"unknown\");");
+ _builder.append("printf(\"unknown\");");
_builder.newLine();
_builder.append("\t");
_builder.append("else {");
@@ -574,20 +554,11 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
_builder.append("default:");
_builder.newLine();
+ _builder.append("\t");
}
}
- _builder.append("\t\t");
- _builder.append("if (msg instanceof EventWithDataMessage)");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());");
- _builder.newLine();
- _builder.append("\t\t");
- _builder.append("else");
- _builder.newLine();
- _builder.append("\t\t\t");
- _builder.append("getActor().receiveEvent(this, msg.getEvtId(), null);");
- _builder.newLine();
+ _builder.append("\tgetActor().receiveEvent(*this, msg.getEvtId(), msg.getData());");
+ _builder.newLineIfNotEmpty();
{
boolean _handlesReceive_1 = this.roomExt.handlesReceive(pc, conj);
if (_handlesReceive_1) {
@@ -636,16 +607,16 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(replPortClassName, "");
_builder.append("::");
_builder.append(replPortClassName, "");
- _builder.append("(IEventReceiver actor, char* name, int localId, Address addr, Address peerAddress) {");
+ _builder.append("(IEventReceiver actor, char* name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("replication = addr==null? 0:addr.length;");
+ _builder.append("int replication = addr.size();");
_builder.newLine();
_builder.append("\t");
- _builder.append("ports = new ArrayList<");
+ _builder.append("ports = new std::vector<");
String _name_5 = pc.getName();
_builder.append(_name_5, " ");
- _builder.append(".");
+ _builder.append("::");
_builder.append(portClassName, " ");
_builder.append(">(replication);");
_builder.newLineIfNotEmpty();
@@ -653,13 +624,13 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("for (int i=0; i<replication; ++i) {");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("ports.add(new ");
+ _builder.append("ports[i] = new ");
+ String _name_6 = pc.getName();
+ _builder.append(_name_6, " ");
+ _builder.append("::");
_builder.append(portClassName, " ");
- _builder.append("(");
+ _builder.append("(actor, name+i, localId, i, addr[i], peerAddress[i]);");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t\t\t");
- _builder.append("actor, name+i, localId, i, addr[i], peerAddress[i]));");
- _builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
@@ -674,8 +645,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
{
List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
for(final Message m_1 : _allIncomingMessages) {
- String _name_6 = pc.getName();
- String _operator_plus_2 = StringExtensions.operator_plus(_name_6, "::");
+ String _name_7 = pc.getName();
+ String _operator_plus_2 = StringExtensions.operator_plus(_name_7, "::");
String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, replPortClassName);
StringConcatenation _messageSignatureDefinition = this.messageSignatureDefinition(m_1, _operator_plus_3);
_builder.append(_messageSignatureDefinition, "");
@@ -703,8 +674,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
{
List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
for(final Message m_2 : _allOutgoingMessages) {
- String _name_7 = pc.getName();
- String _operator_plus_4 = StringExtensions.operator_plus(_name_7, "::");
+ String _name_8 = pc.getName();
+ String _operator_plus_4 = StringExtensions.operator_plus(_name_8, "::");
String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, replPortClassName);
StringConcatenation _messageSignatureDefinition_1 = this.messageSignatureDefinition(m_2, _operator_plus_5);
_builder.append(_messageSignatureDefinition_1, "");
@@ -765,6 +736,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
_builder.append("#include \"common/debugging/DebuggingService.h\"");
_builder.newLine();
+ _builder.append("\t");
+ _builder.append("#include <stdio.h>");
+ _builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("using namespace etRuntime;");
@@ -802,13 +776,16 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
- _builder.append("//private static char* messageStrings[] = {\"MIN\", ");
+ _builder.append("char* ");
+ String _name_1 = pc.getName();
+ _builder.append(_name_1, " ");
+ _builder.append("::messageStrings[] = {\"MIN\", ");
{
List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
for(final Message m : _allOutgoingMessages) {
_builder.append("\"");
- String _name_1 = m.getName();
- _builder.append(_name_1, " ");
+ String _name_2 = m.getName();
+ _builder.append(_name_2, " ");
_builder.append("\",");
}
}
@@ -817,8 +794,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
for(final Message m_1 : _allIncomingMessages) {
_builder.append("\"");
- String _name_2 = m_1.getName();
- _builder.append(_name_2, " ");
+ String _name_3 = m_1.getName();
+ _builder.append(_name_3, " ");
_builder.append("\",");
}
}
@@ -827,8 +804,8 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("\t");
_builder.append("char* ");
- String _name_3 = pc.getName();
- _builder.append(_name_3, " ");
+ String _name_4 = pc.getName();
+ _builder.append(_name_4, " ");
_builder.append("::getMessageString(int msg_id) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
@@ -1826,13 +1803,13 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("_getMessageString(int msg_id) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("if (msg_id<");
+ _builder.append("if (msg_id < ");
String _name_4 = pc.getName();
_builder.append(_name_4, " ");
- _builder.append("_MSG_MIN || msg_id>");
+ _builder.append("::MSG_MIN || msg_id > ");
String _name_5 = pc.getName();
_builder.append(_name_5, " ");
- _builder.append("_MSG_MAX+1){");
+ _builder.append("::MSG_MAX+1){");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("/* id out of range */");
@@ -2096,18 +2073,19 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("] != \"timerTick\"){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
+ _builder.append("\t");
_builder.append("DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[");
- _builder.append(dir, " ");
+ _builder.append(dir, " ");
_builder.append("_");
String _name_1 = m.getName();
- _builder.append(_name_1, " ");
+ _builder.append(_name_1, " ");
_builder.append("]);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
- _builder.append("if (getPeerAddress()!=null)");
+ _builder.append("if (getPeerAddress().isValid()){");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
@@ -2115,7 +2093,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
VarDecl _data = m.getData();
boolean _operator_equals = ObjectExtensions.operator_equals(_data, null);
if (_operator_equals) {
- _builder.append("getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), ");
+ _builder.append("getPeerMsgReceiver().receive(new Message(getPeerAddress(), ");
_builder.append(dir, " ");
_builder.append("_");
String _name_2 = m.getName();
@@ -2125,38 +2103,40 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
_builder.append("\t");
} else {
- _builder.append("getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), ");
+ _builder.append("getPeerMsgReceiver().receive(new Message(getPeerAddress(), ");
_builder.append(dir, " ");
_builder.append("_");
String _name_3 = m.getName();
_builder.append(_name_3, " ");
- _builder.append(", ");
- VarDecl _data_1 = m.getData();
- String _name_4 = _data_1.getName();
- _builder.append(_name_4, " ");
+ _builder.append(", reinterpret_cast<void*>(");
{
boolean _operator_and = false;
- VarDecl _data_2 = m.getData();
- RefableType _refType = _data_2.getRefType();
+ VarDecl _data_1 = m.getData();
+ RefableType _refType = _data_1.getRefType();
boolean _isRef = _refType.isRef();
- boolean _operator_not = BooleanExtensions.operator_not(_isRef);
- if (!_operator_not) {
+ if (!_isRef) {
_operator_and = false;
} else {
- VarDecl _data_3 = m.getData();
- RefableType _refType_1 = _data_3.getRefType();
+ VarDecl _data_2 = m.getData();
+ RefableType _refType_1 = _data_2.getRefType();
DataType _type = _refType_1.getType();
- boolean _operator_not_1 = BooleanExtensions.operator_not((_type instanceof PrimitiveType));
- _operator_and = BooleanExtensions.operator_and(_operator_not, _operator_not_1);
+ boolean _operator_not = BooleanExtensions.operator_not((_type instanceof PrimitiveType));
+ _operator_and = BooleanExtensions.operator_and(_isRef, _operator_not);
}
if (_operator_and) {
- _builder.append(".deepCopy()");
+ _builder.append("&");
}
}
- _builder.append("));");
+ VarDecl _data_3 = m.getData();
+ String _name_4 = _data_3.getName();
+ _builder.append(_name_4, " ");
+ _builder.append(")));");
_builder.newLineIfNotEmpty();
}
}
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
}
}
_builder.append("}");
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 c333188..578a2a9 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
@@ -18,8 +18,10 @@ import org.eclipse.etrice.core.room.Message
import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.DataClass
+
import org.eclipse.etrice.core.genmodel.base.ILogger
import org.eclipse.etrice.core.genmodel.etricegen.Root
+
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import org.eclipse.etrice.generator.generic.RoomExtensions
diff --git a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/Activator.java b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/Activator.java
index 1f897b7..abd7e0b 100644
--- a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/Activator.java
+++ b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/Activator.java
@@ -9,7 +9,7 @@ import org.osgi.framework.BundleContext;
public class Activator extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.etrice.generator.launch.java"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.eclipse.etrice.generator.launch.c"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
index 4dc43df..bcc8253 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="0.1.0",
org.eclipse.debug.ui,
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
- org.eclipse.core.variables;bundle-version="3.2.500"
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.eclipse.etrice.core.genmodel;bundle-version="0.2.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.jdt.launching,
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/Activator.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/Activator.java
index 00142a2..54a7a8b 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/Activator.java
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/Activator.java
@@ -9,7 +9,7 @@ import org.osgi.framework.BundleContext;
public class Activator extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.etrice.generator.launch.java"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.eclipse.etrice.generator.launch.cpp"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
diff --git a/runtime/org.eclipse.etrice.runtime.c/Debug/.gitignore b/runtime/org.eclipse.etrice.runtime.c/Debug/.gitignore
deleted file mode 100644
index 357780e..0000000
--- a/runtime/org.eclipse.etrice.runtime.c/Debug/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*
-!.gitignore
-
-
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.gitignore b/runtime/org.eclipse.etrice.runtime.cpp/.gitignore
new file mode 100644
index 0000000..f63ef27
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/.gitignore
@@ -0,0 +1 @@
+Debug
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Debug/liborg.eclipse.etrice.runtime.cpp.a b/runtime/org.eclipse.etrice.runtime.cpp/Debug/liborg.eclipse.etrice.runtime.cpp.a
deleted file mode 100644
index b06fbff..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/Debug/liborg.eclipse.etrice.runtime.cpp.a
+++ /dev/null
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/debugging/DebuggingService.o b/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/debugging/DebuggingService.o
deleted file mode 100644
index 76b93d6..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/debugging/DebuggingService.o
+++ /dev/null
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Address.o b/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Address.o
deleted file mode 100644
index 81d2d84..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Address.o
+++ /dev/null
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Message.o b/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Message.o
deleted file mode 100644
index e3fdf65..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/messaging/Message.o
+++ /dev/null
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/InterfaceItemBase.o b/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/InterfaceItemBase.o
deleted file mode 100644
index 40683d4..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/InterfaceItemBase.o
+++ /dev/null
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/PortBase.o b/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/PortBase.o
deleted file mode 100644
index c1f4766..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/Debug/src/common/modelbase/PortBase.o
+++ /dev/null
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h
index 792ad6d..1a9702c 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h
@@ -14,8 +14,11 @@ class Address {
public:
Address(int nodeID,int threadID, int objectID)
: m_nodeID(nodeID), m_threadID(threadID), m_objectID(objectID) {};
+ Address(const Address & right)
+ : m_nodeID(right.m_nodeID), m_threadID(right.m_threadID), m_objectID(right.m_objectID){};
~Address();
+ bool isValid() const { return (m_nodeID != 0) && (m_threadID != 0) && (m_objectID != 0);};
int m_nodeID;
int m_threadID;
int m_objectID;
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp
new file mode 100644
index 0000000..e3784c6
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp
@@ -0,0 +1,21 @@
+/*
+ * IMessageReceiver.cpp
+ *
+ * Created on: 08.06.2012
+ * Author: karlitsc
+ */
+
+#include "IMessageReceiver.h"
+
+namespace etRuntime {
+
+IMessageReceiver::IMessageReceiver() {
+ // TODO Auto-generated constructor stub
+
+}
+
+IMessageReceiver::~IMessageReceiver() {
+ // TODO Auto-generated destructor stub
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h
new file mode 100644
index 0000000..b03a908
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h
@@ -0,0 +1,27 @@
+/*
+ * IMessageReceiver.h
+ *
+ * Created on: 08.06.2012
+ * Author: karlitsc
+ */
+
+#ifndef IMESSAGERECEIVER_H_
+#define IMESSAGERECEIVER_H_
+
+#include "common/messaging/Address.h"
+#include "common/messaging/Message.h"
+
+namespace etRuntime {
+
+class IMessageReceiver {
+public:
+ IMessageReceiver();
+ virtual ~IMessageReceiver();
+
+ virtual void receive(Message* msg);
+ virtual Address getAddress();
+
+};
+
+} /* namespace etRuntime */
+#endif /* IMESSAGERECEIVER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp
index 9adf08b..bec6d77 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp
@@ -9,10 +9,6 @@
namespace etRuntime {
-Message::Message() {
- // TODO Auto-generated constructor stub
-
-}
Message::~Message() {
// TODO Auto-generated destructor stub
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h
index 07c8dfb..f5e2daa 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h
@@ -9,15 +9,25 @@
#define MESSAGE_H_
#include "common/messaging/Address.h"
+#include "platforms/generic/etDatatypes.h"
namespace etRuntime {
class Message {
public:
- Message(Address addr) {};
- virtual ~Message();
+ // Message(Address addr) : m_address(addr), m_evtID(0), m_next(0) {};
+ Message(Address addr, etInt16 evtID) : m_address(addr), m_evtID(evtID), m_next(0) {};
+ Message(Address addr, etInt16 evtID, void* data) : m_address(addr), m_evtID(evtID), m_next(0) {};
+ ~Message();
+ etInt16 getEvtId() const {return m_evtID;};
+ Address getAddress() const {return m_address;};
+ void* getData() const {return 0;}; //TODO handling of events with data
private:
+ Address m_address;
+ etInt16 m_evtID;
+ Message* m_next;
+
Message();
};
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp
new file mode 100644
index 0000000..245cf66
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp
@@ -0,0 +1,21 @@
+/*
+ * IEventReceiver.cpp
+ *
+ * Created on: 08.06.2012
+ * Author: karlitsc
+ */
+
+#include "IEventReceiver.h"
+
+namespace etRuntime {
+
+IEventReceiver::IEventReceiver() {
+ // TODO Auto-generated constructor stub
+
+}
+
+IEventReceiver::~IEventReceiver() {
+ // TODO Auto-generated destructor stub
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h
new file mode 100644
index 0000000..4672d26
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h
@@ -0,0 +1,26 @@
+/*
+ * IEventReceiver.h
+ *
+ * Created on: 08.06.2012
+ * Author: karlitsc
+ */
+
+#ifndef IEVENTRECEIVER_H_
+#define IEVENTRECEIVER_H_
+
+#include "platforms/generic/etDatatypes.h"
+
+namespace etRuntime {
+class InterfaceItemBase;
+
+class IEventReceiver {
+public:
+ IEventReceiver();
+ virtual ~IEventReceiver();
+
+ virtual void receiveEvent(const InterfaceItemBase& ifitem, etInt16 evt, void* data); //TODO: void* or object??
+
+};
+
+} /* namespace etRuntime */
+#endif /* IEVENTRECEIVER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp
index 9eeb9bd..f2321d8 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp
@@ -9,11 +9,6 @@
namespace etRuntime {
-InterfaceItemBase::InterfaceItemBase() {
- // TODO Auto-generated constructor stub
-
-}
-
InterfaceItemBase::~InterfaceItemBase() {
// TODO Auto-generated destructor stub
}
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h
index 5a6f2ef..941784f 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h
@@ -9,6 +9,8 @@
#define INTERFACEITEMBASE_H_
#include "common/messaging/Address.h"
+#include "common/messaging/IMessageReceiver.h"
+#include "common/modelbase/IEventReceiver.h"
namespace etRuntime {
class IEventReceiver;
@@ -16,39 +18,54 @@ class IEventReceiver;
class InterfaceItemBase {
public:
- InterfaceItemBase (const IEventReceiver& actor, char* name, int localId, int idx, Address ownAddress, Address peerAddress){};
+ InterfaceItemBase (const IEventReceiver& actor, const char* name, int localId, int idx, Address ownAddress, Address peerAddress)
+ : m_idx(idx),
+ m_localId(localId),
+ m_peerAddress(peerAddress),
+ m_ownAddress(ownAddress),
+ m_ownMsgReceiver(),
+ m_peerMsgReceiver(),
+ m_parent(actor)
+ {};
- InterfaceItemBase();
virtual ~InterfaceItemBase();
- int getIdx() { return m_idx; } ;
+ int getIdx() const { return m_idx; } ;
void setMsgReceiver(IMessageReceiver msgReceiver) {
m_ownMsgReceiver = msgReceiver;
};
IEventReceiver getActor() {
- return (IEventReceiver) getParent();
+ return m_parent;
};
int getLocalId() {return m_localId; };
protected:
- IMessageReceiver getMsgReceiver() {
+ IMessageReceiver getMsgReceiver() const{
return m_ownMsgReceiver;
};
- IMessageReceiver getPeerMsgReceiver() {
+ IMessageReceiver getPeerMsgReceiver() const {
return m_peerMsgReceiver;
};
- Address getPeerAddress() {
+ Address getPeerAddress() const {
return m_peerAddress;
};
+ Address getAddress() const {
+ return m_ownAddress;
+ };
private:
+ InterfaceItemBase();
+
int m_idx;
int m_localId;
Address m_peerAddress;
+ Address m_ownAddress;
IMessageReceiver m_ownMsgReceiver;
IMessageReceiver m_peerMsgReceiver;
+
+ IEventReceiver m_parent; //TODO: move to superclass
};
} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp
index 77ceeaa..1967415 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp
@@ -9,10 +9,6 @@
namespace etRuntime {
-PortBase::PortBase() {
- // TODO Auto-generated constructor stub
-
-}
PortBase::~PortBase() {
// TODO Auto-generated destructor stub
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h
index c161272..20c2a81 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h
@@ -16,7 +16,8 @@ class IEventReceiver;
class PortBase : public InterfaceItemBase{
public:
- PortBase (const IEventReceiver& actor, const char * name, int localId, int idx, Address address, Address peerAddress);
+ PortBase (const IEventReceiver& actor, const char * name, int localId, int idx, Address address, Address peerAddress)
+ : InterfaceItemBase(actor, name, localId, idx, address, peerAddress){};
virtual ~PortBase();
private:
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h
index aac2ec3..481139d 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h
@@ -39,7 +39,7 @@ typedef float float32;
typedef double float64;
/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+//typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
typedef bool boolean;
#ifndef TRUE
#define TRUE 1