summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Karlitschek2012-08-24 05:46:15 (EDT)
committerPeter Karlitschek2012-08-24 05:46:15 (EDT)
commit679e0c2c17c0044448910fcf16359fd9d38693da (patch)
treeea8ed1984703c4644dc486bda63c5f1096df4f2a
parent3aade696859d47a9fc454b32dd8a3a91752aa03c (diff)
downloadorg.eclipse.etrice-679e0c2c17c0044448910fcf16359fd9d38693da.zip
org.eclipse.etrice-679e0c2c17c0044448910fcf16359fd9d38693da.tar.gz
org.eclipse.etrice-679e0c2c17c0044448910fcf16359fd9d38693da.tar.bz2
cpp runtime continuedrefs/changes/27/8127/1
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/.cproject25
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp48
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h25
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp35
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h19
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp10
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h23
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp14
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h49
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h3
13 files changed, 183 insertions, 77 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.cproject b/runtime/org.eclipse.etrice.runtime.cpp/.cproject
index 125c50d..36d6f4e 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.cpp/.cproject
@@ -9,7 +9,7 @@
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/Debug"/>
- <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
<extensions>
@@ -31,7 +31,7 @@
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1516705340" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug">
<option id="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level.143629884" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1636571561" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
- <option id="gnu.cpp.compiler.option.include.paths.371088988" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <option id="gnu.cpp.compiler.option.include.paths.371088988" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.834970834" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -59,7 +59,7 @@
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/Release"/>
- <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
</externalSettings>
<extensions>
@@ -81,7 +81,7 @@
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.567360588" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release">
<option id="gnu.cpp.compiler.mingw.lib.release.option.optimization.level.584961348" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.lib.release.option.debugging.level.1368123052" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
- <option id="gnu.cpp.compiler.option.include.paths.763277987" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <option id="gnu.cpp.compiler.option.include.paths.763277987" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1712453980" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -107,6 +107,14 @@
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="org.eclipse.etrice.runtime.cpp.cdt.managedbuild.target.gnu.mingw.lib.335663705" name="Static Library" projectType="cdt.managedbuild.target.gnu.mingw.lib"/>
</storageModule>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Release">
+ <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp"/>
+ </configuration>
+ <configuration configurationName="Debug">
+ <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp"/>
+ </configuration>
+ </storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1516705340;cdt.managedbuild.tool.gnu.cpp.compiler.input.834970834">
@@ -115,12 +123,13 @@
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536;cdt.managedbuild.config.gnu.mingw.lib.release.1265017536.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.2143016498;cdt.managedbuild.tool.gnu.c.compiler.input.1857566126">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536;cdt.managedbuild.config.gnu.mingw.lib.release.1265017536.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.567360588;cdt.managedbuild.tool.gnu.cpp.compiler.input.1712453980">
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
- </scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.787652226;cdt.managedbuild.tool.gnu.c.compiler.input.1322245631">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536;cdt.managedbuild.config.gnu.mingw.lib.release.1265017536.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.567360588;cdt.managedbuild.tool.gnu.cpp.compiler.input.1712453980">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+ </scannerConfigBuildInfo>
</storageModule>
- <storageModule moduleId="refreshScope"/>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp
index 09869d3..52ab745 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp
@@ -11,13 +11,53 @@ namespace etRuntime {
DebuggingService* DebuggingService::s_instance = 0;
-DebuggingService::DebuggingService() {
- // TODO Auto-generated constructor stub
-
+DebuggingService::DebuggingService()
+: asyncLogger() ,
+ syncLogger(),
+ portInstances()
+{
}
DebuggingService::~DebuggingService() {
- // TODO Auto-generated destructor stub
}
+
+void DebuggingService::addMessageAsyncOut(Address source, Address target,
+ std::string msg) {
+ asyncLogger.addMessageAsyncOut(portInstances[source].getActor().getInstancePath(), portInstances[target].getActor().getInstancePath(), msg);
+}
+
+void DebuggingService::addMessageAsyncIn(Address source, Address target,
+ std::string msg) {
+ asyncLogger.addMessageAsyncIn(portInstances[source].getActor().getInstancePath(), portInstances[target].getActor().getInstancePath(), msg);
+}
+
+void DebuggingService::addMessageSyncCall(Address source, Address target,
+ std::string msg) {
+ asyncLogger.addMessageSyncCall(portInstances[source].getActor().getInstancePath(), portInstances[target].getActor().getInstancePath(), msg);
+}
+
+void DebuggingService::addMessageSyncReturn(Address source, Address target,
+ std::string msg) {
+ asyncLogger.addMessageSyncReturn(portInstances[source].getActor().getInstancePath(), portInstances[target].getActor().getInstancePath(), msg);
+}
+
+void DebuggingService::addActorState(const ActorClassBase& actor,
+ std::string state) {
+ asyncLogger.addActorState(actor.getInstancePath(), state);
+}
+
+void DebuggingService::addPortInstance(const PortBase& port) {
+ portInstances[port.getAddress()] = port;
+}
+
+const MSCLogger& DebuggingService::getSyncLogger() {
+ return syncLogger;
+}
+
+const MSCLogger& DebuggingService::getAsyncLogger() {
+ return asyncLogger;
+}
+
+
} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h
index 59931d1..6a1cfb9 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h
@@ -9,12 +9,14 @@
#define DEBUGGINGSERVICE_H_
#include "common/messaging/Address.h"
+#include "common/debugging/MSCLogger.h"
+#include "common/modelbase/PortBase.h"
+#include <string>
+#include <map>
namespace etRuntime {
-class MSCLogger;
class ActorClassBase;
-class PortBase;
class DebuggingService {
private:
@@ -30,16 +32,21 @@ public:
return *s_instance;
}
- void addMessageAsyncOut(Address source, Address target, const char * msg);
- void addMessageAsyncIn(Address source, Address target, const char * msg);
- void addMessageSyncCall(Address source, Address target, const char * msg);
- void addMessageSyncReturn(Address source, Address target, const char * msg);
- void addActorState(const ActorClassBase& actor, const char * state);
+ void addMessageAsyncOut(Address source, Address target, std::string msg);
+ void addMessageAsyncIn(Address source, Address target, std::string msg);
+ void addMessageSyncCall(Address source, Address target, std::string msg);
+ void addMessageSyncReturn(Address source, Address target, std::string msg);
+ void addActorState(const ActorClassBase& actor, std::string state);
void addPortInstance(const PortBase& port);
- MSCLogger getSyncLogger();
- MSCLogger getAsyncLogger();
+ const MSCLogger& getSyncLogger();
+ const MSCLogger& getAsyncLogger();
private:
+
+ MSCLogger asyncLogger;
+ MSCLogger syncLogger;
+ std::map<Address, PortBase> portInstances;
+
DebuggingService();
DebuggingService(const DebuggingService& right);
DebuggingService& operator=(const DebuggingService& right);
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp
index 860643b..ae22624 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp
@@ -6,16 +6,45 @@
*/
#include "Address.h"
+#include <sstream>
namespace etRuntime {
-Address::Address() {
- // TODO Auto-generated constructor stub
+Address::Address(int nodeID, int threadID, int objectID) :
+ m_nodeID(nodeID),
+ m_threadID(threadID),
+ m_objectID(objectID) {
+};
+Address::Address(const Address & right) :
+ m_nodeID(right.m_nodeID),
+ m_threadID(right.m_threadID),
+ m_objectID(right.m_objectID) {
+};
+
+Address & Address::operator = (Address s) {
+ std::swap(s, *this);
+ return *this;
}
Address::~Address() {
- // TODO Auto-generated destructor stub
}
+std::string Address::toString(){
+ std::stringstream strm;
+ strm << "Address(nodeID=" << m_nodeID
+ << ",threadID=" << m_threadID << ",objectID=" << m_objectID+")";
+ return strm.str();
+}
+std::string Address::toID(){
+ std::stringstream strm;
+ strm << m_nodeID << "_" << m_threadID << "_" << m_objectID;
+ return strm.str();
+}
+
+Address Address::createInc(int i) {
+ return Address(m_nodeID, m_threadID, m_objectID+i);
+}
+
+
} /* namespace etRuntime */
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 1a9702c..66aa9e7 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
@@ -8,17 +8,25 @@
#ifndef ADDRESS_H_
#define ADDRESS_H_
+#include <string>
+
namespace etRuntime {
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(int nodeID, int threadID, int objectID);
+ Address(const Address & right);
+ Address & operator = (Address s);
~Address();
- bool isValid() const { return (m_nodeID != 0) && (m_threadID != 0) && (m_objectID != 0);};
+ std::string toString();
+ std::string toID();
+
+ Address createInc(int i);
+ bool isValid() const {
+ return (m_nodeID != 0) && (m_threadID != 0) && (m_objectID != 0);
+ };
+
int m_nodeID;
int m_threadID;
int m_objectID;
@@ -30,3 +38,4 @@ private:
} /* namespace etRuntime */
#endif /* ADDRESS_H_ */
+
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
index e3784c6..10b3e12 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp
@@ -10,12 +10,9 @@
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
index b03a908..dd4447e 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h
@@ -10,10 +10,11 @@
#include "common/messaging/Address.h"
#include "common/messaging/Message.h"
+#include "common/messaging/IRTObject.h"
namespace etRuntime {
-class IMessageReceiver {
+class IMessageReceiver : public IRTObject{
public:
IMessageReceiver();
virtual ~IMessageReceiver();
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 bec6d77..708de7f 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
@@ -7,11 +7,19 @@
#include "Message.h"
+#include <sstream>
+
namespace etRuntime {
Message::~Message() {
- // TODO Auto-generated destructor stub
+ m_next = 0;
+}
+
+std::string Message::toString(){
+ std::stringstream strm;
+ strm << "Message(" << m_address.toString() << ")";
+ return strm.str();
}
} /* namespace etRuntime */
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 f5e2daa..4cb814c 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
@@ -10,18 +10,31 @@
#include "common/messaging/Address.h"
#include "platforms/generic/etDatatypes.h"
+#include <string>
namespace etRuntime {
class Message {
public:
// 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(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
+ etInt16 getEvtId() const {return m_evtID; };
+ void* getData() const { return 0; }
+ ; //TODO handling of events with data
+
+ void setNext(Message* msg){m_next = msg;}
+ Message* getNext() const {return m_next;}
+
+ void setAddress(Address address){m_address = address; }
+ Address getAddress() const { return m_address; };
+
+ std::string toString();
private:
Address m_address;
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
index 4672d26..177716f 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h
@@ -9,11 +9,12 @@
#define IEVENTRECEIVER_H_
#include "platforms/generic/etDatatypes.h"
+#include "common/messaging/IRTObject.h"
namespace etRuntime {
class InterfaceItemBase;
-class IEventReceiver {
+class IEventReceiver : public IRTObject{
public:
IEventReceiver();
virtual ~IEventReceiver();
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 f2321d8..1cc2af0 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,6 +9,20 @@
namespace etRuntime {
+InterfaceItemBase::InterfaceItemBase (const IEventReceiver& actor, std::string name, int localId, int idx, Address ownAddress, Address peerAddress)
+: AbstractMessageReceiver(actor, ownAddress, name),
+ m_idx(idx),
+ m_localId(localId),
+ m_peerAddress(peerAddress),
+ m_ownMsgReceiver(RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(ownAddress.m_threadID)),
+ m_peerMsgReceiver(peerAddress.isValid()? RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(peerAddress.m_threadID): 0)
+{
+ if (getAddress()!=null && this.ownMsgReceiver instanceof MessageService) {
+ MessageService ms = (MessageService) this.ownMsgReceiver;
+ // register at the own dispatcher to receive messages
+ ms.getMessageDispatcher().addMessageReceiver(this);
+}
+
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 941784f..620a53d 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
@@ -11,48 +11,28 @@
#include "common/messaging/Address.h"
#include "common/messaging/IMessageReceiver.h"
#include "common/modelbase/IEventReceiver.h"
+#include "common/messaging/AbstractMessageReceiver.h"
+#include <string>
namespace etRuntime {
class IEventReceiver;
-class InterfaceItemBase {
+class InterfaceItemBase : public AbstractMessageReceiver{
public:
- 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 (const IEventReceiver& actor, std::string name, int localId, int idx, Address ownAddress, Address peerAddress);
virtual ~InterfaceItemBase();
- int getIdx() const { return m_idx; } ;
- void setMsgReceiver(IMessageReceiver msgReceiver) {
- m_ownMsgReceiver = msgReceiver;
- };
- IEventReceiver getActor() {
- return m_parent;
- };
+ int getIdx() const { return m_idx; } ;
+ IEventReceiver* getActor() { return static_cast<IEventReceiver*>(getParent()); };
int getLocalId() {return m_localId; };
-protected:
- IMessageReceiver getMsgReceiver() const{
- return m_ownMsgReceiver;
- };
+ void setMsgReceiver(IMessageReceiver& msgReceiver) { m_ownMsgReceiver = &msgReceiver; };
- IMessageReceiver getPeerMsgReceiver() const {
- return m_peerMsgReceiver;
- };
- Address getPeerAddress() const {
- return m_peerAddress;
- };
- Address getAddress() const {
- return m_ownAddress;
- };
+protected:
+ IMessageReceiver* getMsgReceiver() const{ return m_ownMsgReceiver; };
+ IMessageReceiver* getPeerMsgReceiver() const { return m_peerMsgReceiver; };
+ Address getPeerAddress() const { return m_peerAddress; };
private:
InterfaceItemBase();
@@ -61,11 +41,8 @@ private:
int m_localId;
Address m_peerAddress;
- Address m_ownAddress;
- IMessageReceiver m_ownMsgReceiver;
- IMessageReceiver m_peerMsgReceiver;
-
- IEventReceiver m_parent; //TODO: move to superclass
+ IMessageReceiver* m_ownMsgReceiver;
+ IMessageReceiver* m_peerMsgReceiver;
};
} /* namespace etRuntime */
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 20c2a81..b472820 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
@@ -10,13 +10,14 @@
#include "common/modelbase/InterfaceItemBase.h"
#include "common/messaging/Address.h"
+#include <string>
namespace etRuntime {
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, std::string name, int localId, int idx, Address address, Address peerAddress)
: InterfaceItemBase(actor, name, localId, idx, address, peerAddress){};
virtual ~PortBase();