summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Karlitschek2012-09-07 09:27:53 (EDT)
committerPeter Karlitschek2012-09-07 09:27:53 (EDT)
commitc3970f7fd7050edd898992a4c2ee11714f14cb65 (patch)
tree9d9f5a0ded7c7337181504ff5c5261e442078b1d
parent584c547ca50bed54d0d5a1e23175d4d41e9e8be6 (diff)
downloadorg.eclipse.etrice-c3970f7fd7050edd898992a4c2ee11714f14cb65.zip
org.eclipse.etrice-c3970f7fd7050edd898992a4c2ee11714f14cb65.tar.gz
org.eclipse.etrice-c3970f7fd7050edd898992a4c2ee11714f14cb65.tar.bz2
c++ runtime: tuning the port classesrefs/changes/31/8131/1
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp5
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h21
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp145
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h211
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp6
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.cpp23
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.h37
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.cpp31
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.h40
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp12
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h3
14 files changed, 188 insertions, 353 deletions
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 708de7f..aebf4d1 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
@@ -18,7 +18,10 @@ Message::~Message() {
std::string Message::toString(){
std::stringstream strm;
- strm << "Message(" << m_address.toString() << ")";
+ strm << "EventMessage(" << m_address.toString() << ", evt=" << m_evtId << ")";
+ if (m_data) {
+ strm << std::showbase << std::hex << m_data;
+ }
return strm.str();
}
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 0b26887..581542b 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
@@ -16,9 +16,13 @@ namespace etRuntime {
class Message {
public:
- // Message(Address addr) : m_address(addr), m_evtID(0), m_next(0) {};
- Message(Address addr) :
- m_address(addr), m_next(0)
+ Message(Address addr, int evtId, void* data, size_t dataSize) :
+ m_address(addr), m_evtId(evtId), m_next(0),
+ m_dataSize(dataSize), m_data(data), m_logFlag(true)
+ {}
+ Message(Address addr, int evtId) :
+ m_address(addr), m_evtId(evtId), m_next(0),
+ m_dataSize(0), m_data(0), m_logFlag(true)
{}
virtual ~Message();
@@ -28,13 +32,20 @@ public:
void setAddress(Address address){m_address = address; }
Address getAddress() const { return m_address; };
- virtual bool isEvtMessage() {return false;};
- virtual bool isEvtMessageWithData() {return false;};
+ int getEvtId() const { return m_evtId; }
+ void* getData() const { return m_data; }
+ bool hasDebugFlagSet() const { return m_logFlag; };
+
std::string toString();
private:
Address m_address;
+ int m_evtId;
+
Message* m_next;
+ size_t m_dataSize;
+ void* m_data;
+ bool m_logFlag;
Message();
};
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h
index d99acda..d7c5351 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h
@@ -25,7 +25,7 @@ public:
long getSize() const {return m_size; }
Message* getFirst() const {return m_first; }
Message* getLast() const { return m_last; }
- boolean isNotEmpty() const { return m_last != 0; }
+ bool isNotEmpty() const { return m_last != 0; }
long getHightWaterMark() const { return m_highWaterMark; }
private:
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp
index fcaf8cc..1205c2a 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp
@@ -6,12 +6,10 @@
*/
#include "RTSystemServicesProtocol.h"
-#include "common/modelbase/EventMessage.h"
-#include "common/modelbase/EventWithDataMessage.h"
namespace etRuntime {
-std::string RTSystemServicesProtocol::s_messageStrings[] =
+std::string RTSystemServicesProtocol::Events::s_messageStrings[] =
{ "MIN",
"dummy",
"executeInitialTransition",
@@ -19,20 +17,26 @@ std::string RTSystemServicesProtocol::s_messageStrings[] =
"stopDebugging",
"MAX"};
+std::string RTSystemServicesProtocol::Events::getMessageString(int msg_id) {
+ if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) {
+ return s_messageStrings[msg_id];
+ } else {
+ // id out of range
+ return "Message ID out of range";
+ }
+}
+
+//------------------------------------------------------------------
+// RTSystemServicesProtocol: surrounding class
+//------------------------------------------------------------------
+
+
RTSystemServicesProtocol::RTSystemServicesProtocol() {
}
RTSystemServicesProtocol::~RTSystemServicesProtocol() {
}
-std::string RTSystemServicesProtocol::getMessageString(int msg_id) {
- if (msg_id < MSG_MIN || msg_id > MSG_MAX + 1) {
- // id out of range
- return "Message ID out of range";
- } else {
- return s_messageStrings[msg_id];
- }
-}
//------------------------------------------------------------------
// RTSystemServicesProtocolPort
@@ -52,42 +56,24 @@ RTSystemServicesProtocol::RTSystemServicesProtocolPort::RTSystemServicesProtocol
DebuggingService::getInstance().addPortInstance(*this);
};
-void RTSystemServicesProtocol::RTSystemServicesProtocolPort::receive(Message m) {
- if (!(m.isEvtMessage()))
- return;
- EventMessage& msg(static_cast<EventMessage&>(m));
- if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
+void RTSystemServicesProtocol::RTSystemServicesProtocolPort::receive(Message msg) {
+ if (! Events::isValidIncomingEvtID(msg.getEvtId())) {
std::cout << "unknown" << std::endl;
+ }
else {
- if (s_messageStrings[msg.getEvtId()] != "timerTick") {
- // TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncIn(
- getPeerAddress(), getAddress(),
- s_messageStrings[msg.getEvtId()]);
+ if (msg.hasDebugFlagSet()) { // TODO: model switch for activation of this flag
+ DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), Events::getMessageString(msg.getEvtId()));
}
-
- if (msg.isEvtMessageWithData())
- getActor().receiveEvent(*this, msg.getEvtId(),
- (static_cast<EventWithDataMessage&>(msg)).getData());
- else
- getActor().receiveEvent(*this, msg.getEvtId(), 0);
-
+ getActor().receiveEvent(*this, msg.getEvtId(), msg.getData());
}
};
// sent messages
void RTSystemServicesProtocol::RTSystemServicesProtocolPort::dummy() {
-
- if (s_messageStrings[OUT_dummy] != "timerTick") {
- // TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(),
- getPeerAddress(), s_messageStrings[OUT_dummy]);
- }
- if (getPeerAddress().isValid())
- getPeerMsgReceiver()->receive(
- new EventMessage(getPeerAddress(), OUT_dummy));
-
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ Events::getMessageString(Events::OUT_dummy));
+ PortBase::send(Events::OUT_dummy);
};
//------------------------------------------------------------------
@@ -109,14 +95,6 @@ RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::
}
};
-int RTSystemServicesProtocol::RTSystemServicesProtocolPortRepl::getReplication() {
- return m_replication;
-};
-
-RTSystemServicesProtocol::RTSystemServicesProtocolPort& RTSystemServicesProtocol::RTSystemServicesProtocolPortRepl::get(int i) {
- return m_ports.at(i);
-};
-
// outgoing messages
void RTSystemServicesProtocol::RTSystemServicesProtocolPortRepl::dummy() {
@@ -143,71 +121,36 @@ RTSystemServicesProtocol::RTSystemServicesProtocolConjPort::RTSystemServicesProt
DebuggingService::getInstance().addPortInstance(*this);
}
-void RTSystemServicesProtocol::RTSystemServicesProtocolConjPort::receive(Message m) {
- if (!(m.isEvtMessage()))
- return;
- EventMessage& msg(static_cast<EventMessage&>(m));
- if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
+void RTSystemServicesProtocol::RTSystemServicesProtocolConjPort::receive(Message msg) {
+ if (! Events::isValidOutgoingEvtID(msg.getEvtId())) { //conjugated port receives out-messages
std::cout << "unknown" << std::endl;
+ }
else {
- if (s_messageStrings[msg.getEvtId()] != "timerTick") {
- // TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncIn(
- getPeerAddress(), getAddress(),
- s_messageStrings[msg.getEvtId()]);
+ if (msg.hasDebugFlagSet()) { // TODO: model switch for activation of this flag
+ DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), Events::getMessageString(msg.getEvtId()));
}
-
- if (msg.isEvtMessageWithData())
- getActor().receiveEvent(*this, msg.getEvtId(),
- (static_cast<EventWithDataMessage&>(msg)).getData());
- else
- getActor().receiveEvent(*this, msg.getEvtId(), 0);
-
-
+ getActor().receiveEvent(*this, msg.getEvtId(), msg.getData());
}
}
// sent messages
void RTSystemServicesProtocol::RTSystemServicesProtocolConjPort::executeInitialTransition() {
-
- if (s_messageStrings[IN_executeInitialTransition] != "timerTick") {
- // TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(),
- getPeerAddress(),
- s_messageStrings[IN_executeInitialTransition]);
- }
- if (getPeerAddress().isValid())
- getPeerMsgReceiver()->receive(
- new EventMessage(getPeerAddress(),
- IN_executeInitialTransition));
-
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ Events::getMessageString(Events::IN_executeInitialTransition));
+ PortBase::send(Events::IN_executeInitialTransition);
}
void RTSystemServicesProtocol::RTSystemServicesProtocolConjPort::startDebugging() {
-
- if (s_messageStrings[IN_startDebugging] != "timerTick") {
- // TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(),
- getPeerAddress(), s_messageStrings[IN_startDebugging]);
- }
- if (getPeerAddress().isValid())
- getPeerMsgReceiver()->receive(
- new EventMessage(getPeerAddress(), IN_startDebugging));
-
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ Events::getMessageString(Events::IN_startDebugging));
+ PortBase::send(Events::IN_startDebugging);
}
void RTSystemServicesProtocol::RTSystemServicesProtocolConjPort::stopDebugging() {
-
- if (s_messageStrings[IN_stopDebugging] != "timerTick") {
- // TODOTS: model switch for activation
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(),
- getPeerAddress(), s_messageStrings[IN_stopDebugging]);
- }
- if (getPeerAddress().isValid())
- getPeerMsgReceiver()->receive(
- new EventMessage(getPeerAddress(), IN_stopDebugging));
-
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ Events::getMessageString(Events::IN_stopDebugging));
+ PortBase::send(Events::IN_stopDebugging);
}
//------------------------------------------------------------------
@@ -229,15 +172,7 @@ RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent, s
}
};
-int RTSystemServicesProtocol::RTSystemServicesProtocolConjPortRepl::getReplication() {
- return m_replication;
-}
-
-RTSystemServicesProtocol::RTSystemServicesProtocolConjPort& RTSystemServicesProtocol::RTSystemServicesProtocolConjPortRepl::get(int i) {
- return m_ports.at(i);
-}
-
-// incoming messages
+// sent messages
void RTSystemServicesProtocol::RTSystemServicesProtocolConjPortRepl::executeInitialTransition() {
for (int i = 0; i < m_replication; ++i) {
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h
index dcf5fe4..334eb94 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h
@@ -17,122 +17,129 @@ namespace etRuntime {
class RTSystemServicesProtocol {
public:
- RTSystemServicesProtocol();
- virtual ~RTSystemServicesProtocol();
-
- // message IDs
- // TODO: separate class for message IDs: class MSG{public static volatile int MSG_MIN = 0; ...} -> better structure
- // error if msgID <= MSG_MIN
- static const int MSG_MIN = 0;
- //IDs for outgoing messages
- static const int OUT_dummy = 1;
-
- //IDs for incoming messages
- static const int IN_executeInitialTransition = 2;
- static const int IN_startDebugging = 3;
- static const int IN_stopDebugging = 4;
-
- //error if msgID >= MSG_MAX
- static const int MSG_MAX = 5;
-
-private:
- static std::string s_messageStrings[];
-
-public:
- static std::string getMessageString(int msg_id);
-
- //---------------------------------------------------
- // port class
- //---------------------------------------------------
- class RTSystemServicesProtocolPort : public PortBase {
- public:
- RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
- int localId, Address addr, Address peerAddress);
-
- RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
- int localId, int idx, Address addr, Address peerAddress);
-
- void receive(Message m); // sent messages
- void dummy();
+ class Events {
+ public:
+ enum eventIDs {
+ MSG_MIN = 0,
+ OUT_dummy = 1,
+ MSG_SEP = 2,
+ IN_executeInitialTransition = 2,
+ IN_startDebugging = 3,
+ IN_stopDebugging = 4,
+ MSG_MAX = 5
};
-
- //---------------------------------------------------
- // replicated port class
- //---------------------------------------------------
- class RTSystemServicesProtocolPortRepl {
- private:
- int m_replication;
- std::vector<RTSystemServicesProtocolPort> m_ports;
-
- public:
- //TODO: data type of addr and peerAddress?
- RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address> peerAddress);
-
- int getReplication();
- RTSystemServicesProtocolPort& get(int i); // outgoing messages
- void dummy();
+ static bool isValidEvtID(int evtId) {
+ return ((MSG_MIN < evtId) && (evtId < MSG_MAX));
+ };
+ static bool isValidOutgoingEvtID(int evtId) {
+ return ((Events::MSG_MIN < evtId) && (evtId < Events::MSG_SEP));
+ };
+ static bool isValidIncomingEvtID(int evtId) {
+ return ((Events::MSG_SEP <= evtId) && (evtId < Events::MSG_MAX));
};
+ static std::string getMessageString(int msg_id);
- //---------------------------------------------------
- // interface for port class
- //---------------------------------------------------
- class IRTSystemServicesProtocolPort {
- public:
- virtual void executeInitialTransition() = 0;
- virtual void startDebugging() = 0;
- virtual void stopDebugging() = 0;
+ private:
+ static std::string s_messageStrings[];
+ };
- };
+ //---------------------------------------------------
+ // interface for port class
+ //---------------------------------------------------
+ class IRTSystemServicesProtocolPort {
+ public:
+ virtual void dummy() = 0;
+ };
- //---------------------------------------------------
- // port class
- //---------------------------------------------------
- class RTSystemServicesProtocolConjPort : public PortBase {
- public:
- RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
- std::string name, int localId, Address addr, Address peerAddress);
- RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
- std::string name, int localId, int idx, Address addr,
- Address peerAddress);
-
- void receive(Message m);
- void executeInitialTransition();
- void startDebugging();
- void stopDebugging();
- };
+ //---------------------------------------------------
+ // interface for conjugated port class
+ //---------------------------------------------------
+ class IRTSystemServicesProtocolConjPort {
+ public:
+ virtual void executeInitialTransition() = 0;
+ virtual void startDebugging() = 0;
+ virtual void stopDebugging() = 0;
+ };
- //---------------------------------------------------
- // replicated port class
- //---------------------------------------------------
- class RTSystemServicesProtocolConjPortRepl {
- private:
- int m_replication;
- std::vector<RTSystemServicesProtocolConjPort> m_ports;
+public:
- public:
- //TODO: data type of addr and peerAddress
- RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent,
- std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address> peerAddress);
+ RTSystemServicesProtocol();
+ virtual ~RTSystemServicesProtocol();
- int getReplication();
- RTSystemServicesProtocolConjPort& get(int i);
+ //---------------------------------------------------
+ // port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolPort : public PortBase , public IRTSystemServicesProtocolPort {
+ public:
+ RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
+ int localId, Address addr, Address peerAddress);
- void executeInitialTransition();
- void startDebugging();
- void stopDebugging();
+ RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
+ int localId, int idx, Address addr, Address peerAddress);
- };
+ void receive(Message m);
+ // sent messages
+ void dummy();
+ };
- //---------------------------------------------------
- // interface for conjugated port class
- //---------------------------------------------------
- class IRTSystemServicesProtocolConjPort {
- public:
- virtual void dummy() = 0;
+ //---------------------------------------------------
+ // replicated port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolPortRepl: public IRTSystemServicesProtocolPort {
+ private:
+ int m_replication;
+ std::vector<RTSystemServicesProtocolPort> m_ports;
+
+ public:
+ //TODO: data type of addr and peerAddress?
+ RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId,
+ const std::vector<Address>& addr, const std::vector<Address> peerAddress);
+
+ int getReplication() const { return m_replication; } ;
+ RTSystemServicesProtocolPort& get(int i) { return m_ports.at(i); };
+ // outgoing messages
+ void dummy();
+ };
- };
+ //---------------------------------------------------
+ // conjugated port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolConjPort : public PortBase, public IRTSystemServicesProtocolConjPort{
+ public:
+ RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
+ std::string name, int localId, Address addr, Address peerAddress);
+ RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
+ std::string name, int localId, int idx, Address addr,
+ Address peerAddress);
+
+ void receive(Message m);
+ void executeInitialTransition();
+ void startDebugging();
+ void stopDebugging();
+ };
+
+ //---------------------------------------------------
+ // replicated conjugated port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolConjPortRepl : public IRTSystemServicesProtocolConjPort{
+ private:
+ int m_replication;
+ std::vector<RTSystemServicesProtocolConjPort> m_ports;
+
+ public:
+ //TODO: data type of addr and peerAddress
+ RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId,
+ const std::vector<Address>& addr, const std::vector<Address> peerAddress);
+
+ int getReplication() const { return m_replication; } ;
+ RTSystemServicesProtocolConjPort& get(int i) { return m_ports.at(i); };
+
+ void executeInitialTransition();
+ void startDebugging();
+ void stopDebugging();
};
+};
} /* namespace etRuntime */
#endif /* RTSYSTEMSERVICESPROTOCOL_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp
index 771c8b3..a19b46d 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp
@@ -34,12 +34,12 @@ bool ActorClassBase::handleSystemEvent(InterfaceItemBase ifitem, int evt, void*
}
switch (evt) {
- case RTSystemServicesProtocol::IN_executeInitialTransition:
+ case RTSystemServicesProtocol::Events::IN_executeInitialTransition:
executeInitTransition();
break;
- case RTSystemServicesProtocol::IN_startDebugging:
+ case RTSystemServicesProtocol::Events::IN_startDebugging:
break;
- case RTSystemServicesProtocol::IN_stopDebugging:
+ case RTSystemServicesProtocol::Events::IN_stopDebugging:
break;
}
return true;
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.cpp
deleted file mode 100644
index 02300b8..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * EventMessage.cpp
- *
- * Created on: 29.08.2012
- * Author: karlitsc
- */
-
-#include "EventMessage.h"
-#include <sstream>
-
-namespace etRuntime {
-
-std::string EventMessage::toString() {
- std::stringstream strm;
- strm << "EventMessage(" << getAddress().toString() << ", evt=" << m_evtId << ")";
- return strm.str();
-
-}
-
-EventMessage::~EventMessage() {
-}
-
-} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.h
deleted file mode 100644
index 5fa7b85..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventMessage.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * EventMessage.h
- *
- * A message carrying an event id.
- *
- * Created on: 29.08.2012
- * Author: karlitsc
- */
-
-#ifndef EVENTMESSAGE_H_
-#define EVENTMESSAGE_H_
-
-#include "common/messaging/Message.h"
-#include <string>
-
-namespace etRuntime {
-
-class EventMessage: public Message {
-public:
- EventMessage(Address address, int evtId)
- : Message(address),
- m_evtId(evtId) {
- }
- virtual ~EventMessage();
- int getEvtId() { return m_evtId; }
- virtual bool isEvtMessage() {return true;};
-
- std::string toString();
-
-private:
- int m_evtId;
-
- EventMessage();
-};
-
-} /* namespace etRuntime */
-#endif /* EVENTMESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.cpp
deleted file mode 100644
index e2f90fb..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * EventWithDataMessage.cpp
- *
- * Created on: 29.08.2012
- * Author: karlitsc
- */
-
-#include "EventWithDataMessage.h"
-#include <sstream>
-
-namespace etRuntime {
-
-EventWithDataMessage::~EventWithDataMessage() {
-}
-
-std::string EventWithDataMessage::toString() {
- std::stringstream strm;
- strm << "EventWithDataMessage(" << getAddress().toString() << ", evt=" << getEvtId() + ", m_data=" << dataToString() << ")";
- return strm.str();
-}
-
-std::string EventWithDataMessage::dataToString() {
- if (m_data == 0) {
- return "()";
- }
- //TODO: how to do this with all kinds of data??
- //return "(" + m_data + ")";
- return "()";
-}
-
-} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.h
deleted file mode 100644
index 01ed3fd..0000000
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventWithDataMessage.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * EventWithDataMessage.h
- *
- * An event message carrying an arbitrary number of objects.
- *
- * Created on: 29.08.2012
- * Author: karlitsc
- */
-
-#ifndef EVENTWITHDATAMESSAGE_H_
-#define EVENTWITHDATAMESSAGE_H_
-#include "common/modelbase/EventMessage.h"
-#include <string>
-
-namespace etRuntime {
-
-class EventWithDataMessage: public EventMessage {
-public:
- virtual ~EventWithDataMessage();
-
- EventWithDataMessage(Address address, int evtId, void* data)
- : EventMessage(address, evtId),
- m_data(data) {
- }
- virtual bool isEvtMessageWithData() {return true;};
-
- void* getData() { return m_data; }
-
- std::string toString();
- std::string dataToString();
-
-private:
- void* m_data;
-
- EventWithDataMessage();
-
-};
-
-} /* namespace etRuntime */
-#endif /* EVENTWITHDATAMESSAGE_H_ */
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
index 245cf66..976cda3 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp
@@ -10,12 +10,9 @@
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
index 6e2863a..a06aaee 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
@@ -19,7 +19,7 @@ public:
IEventReceiver();
virtual ~IEventReceiver();
- virtual void receiveEvent(const InterfaceItemBase& ifitem, etInt16 evt, void* data); //TODO: void* or object??
+ virtual void receiveEvent(const InterfaceItemBase& ifitem, etInt16 evt, void* data) = 0;
};
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 1967415..8e5170e 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
@@ -11,7 +11,17 @@ namespace etRuntime {
PortBase::~PortBase() {
- // TODO Auto-generated destructor stub
}
+void PortBase::send(int evtID) {
+
+ //TODO: how to avoid logging timerTicks
+ //if (s_messageStrings[IRTSystemServicesProtocolPort::OUT_dummy] != "timerTick") {
+ // TODOTS: model switch for activation
+ if (getPeerAddress().isValid())
+ getPeerMsgReceiver()->receive(
+ new Message(getPeerAddress(), evtID)); //TODO: placement new mit message pool verwenden
+
+};
+
} /* 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 96b510c..f7ffb66 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
@@ -21,6 +21,9 @@ public:
: InterfaceItemBase(actor, parent, name, localId, idx, address, peerAddress){};
virtual ~PortBase();
+ virtual void send(int evtID);
+
+
private:
PortBase();