Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.cpp/src/common')
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp152
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h134
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp96
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h96
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp208
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h136
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h96
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp174
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h102
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp46
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h68
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp40
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h70
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp66
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h124
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp156
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h96
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp128
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h98
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp314
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h166
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp238
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h140
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp146
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h98
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp88
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h104
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp438
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h296
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp124
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h156
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp42
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h76
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp46
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h62
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp120
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h124
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp64
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h86
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp318
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h146
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp246
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h92
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp76
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h90
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h92
46 files changed, 3037 insertions, 3037 deletions
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 a2e2abc97..ed8c11e57 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
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-
-#include "DebuggingService.h"
-#include "common/modelbase/ActorClassBase.h"
-#include <iostream>
-
-namespace etRuntime {
-
-DebuggingService* DebuggingService::s_instance = 0;
-
-DebuggingService::DebuggingService()
-: asyncLogger() ,
- syncLogger(),
- portInstances()
-{
-}
-
-DebuggingService::~DebuggingService() {
-}
-
-
-void DebuggingService::addMessageAsyncOut(Address source, Address target,
- const std::string& msg) {
- asyncLogger.addMessageAsyncOut(portInstances.at(source)->getActorPath(),
- portInstances.at(target)->getActorPath(), msg);
-}
-
-void DebuggingService::addMessageAsyncIn(Address source, Address target,
- const std::string& msg) {
- asyncLogger.addMessageAsyncIn(portInstances.at(source)->getActorPath(),
- portInstances.at(target)->getActorPath(), msg);
-}
-
-void DebuggingService::addMessageSyncCall(Address source, Address target,
- const std::string& msg) {
- asyncLogger.addMessageSyncCall(portInstances.at(source)->getActorPath(),
- portInstances.at(target)->getActorPath(), msg);
-}
-
-void DebuggingService::addMessageSyncReturn(Address source, Address target,
- const std::string& msg) {
- asyncLogger.addMessageSyncReturn(portInstances.at(source)->getActorPath(),
- portInstances.at(target)->getActorPath(), msg);
-}
-
-void DebuggingService::addActorState(const ActorClassBase& actor,
- const std::string& state) {
- asyncLogger.addActorState(actor.getInstancePath(), state);
-}
-
-void DebuggingService::addPortInstance(PortBase& port) {
- portInstances[port.getAddress()] = &port;
- std::cout << "adding " << port.getAddress().toID() << " " << &port << " " << port.getParent()->getInstancePathName()<< std::endl;
-}
-
-MSCLogger& DebuggingService::getSyncLogger() {
- return syncLogger;
-}
-
-MSCLogger& DebuggingService::getAsyncLogger() {
- return asyncLogger;
-}
-
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+
+#include "DebuggingService.h"
+#include "common/modelbase/ActorClassBase.h"
+#include <iostream>
+
+namespace etRuntime {
+
+DebuggingService* DebuggingService::s_instance = 0;
+
+DebuggingService::DebuggingService()
+: asyncLogger() ,
+ syncLogger(),
+ portInstances()
+{
+}
+
+DebuggingService::~DebuggingService() {
+}
+
+
+void DebuggingService::addMessageAsyncOut(Address source, Address target,
+ const std::string& msg) {
+ asyncLogger.addMessageAsyncOut(portInstances.at(source)->getActorPath(),
+ portInstances.at(target)->getActorPath(), msg);
+}
+
+void DebuggingService::addMessageAsyncIn(Address source, Address target,
+ const std::string& msg) {
+ asyncLogger.addMessageAsyncIn(portInstances.at(source)->getActorPath(),
+ portInstances.at(target)->getActorPath(), msg);
+}
+
+void DebuggingService::addMessageSyncCall(Address source, Address target,
+ const std::string& msg) {
+ asyncLogger.addMessageSyncCall(portInstances.at(source)->getActorPath(),
+ portInstances.at(target)->getActorPath(), msg);
+}
+
+void DebuggingService::addMessageSyncReturn(Address source, Address target,
+ const std::string& msg) {
+ asyncLogger.addMessageSyncReturn(portInstances.at(source)->getActorPath(),
+ portInstances.at(target)->getActorPath(), msg);
+}
+
+void DebuggingService::addActorState(const ActorClassBase& actor,
+ const std::string& state) {
+ asyncLogger.addActorState(actor.getInstancePath(), state);
+}
+
+void DebuggingService::addPortInstance(PortBase& port) {
+ portInstances[port.getAddress()] = &port;
+ std::cout << "adding " << port.getAddress().toID() << " " << &port << " " << port.getParent()->getInstancePathName()<< std::endl;
+}
+
+MSCLogger& DebuggingService::getSyncLogger() {
+ return syncLogger;
+}
+
+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 1768584b2..872eabf6c 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
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef DEBUGGINGSERVICE_H_
-#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 ActorClassBase;
-
-
-class DebuggingService {
-private:
- static DebuggingService* s_instance;
-
-public:
- virtual ~DebuggingService();
-
- static DebuggingService& getInstance() {
- if (s_instance == 0) {
- s_instance = new DebuggingService();
- }
- return *s_instance;
- }
-
- void addMessageAsyncOut(Address source, Address target, const std::string& msg);
- void addMessageAsyncIn(Address source, Address target, const std::string& msg);
- void addMessageSyncCall(Address source, Address target, const std::string& msg);
- void addMessageSyncReturn(Address source, Address target, const std::string& msg);
- void addActorState(const ActorClassBase& actor, const std::string& state);
- void addPortInstance(PortBase& port);
- MSCLogger& getSyncLogger();
- MSCLogger& getAsyncLogger();
-
-private:
-
- MSCLogger asyncLogger;
- MSCLogger syncLogger;
- std::map<Address, PortBase*> portInstances;
-
- DebuggingService();
- DebuggingService(const DebuggingService& right);
- DebuggingService& operator=(const DebuggingService& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* DEBUGGINGSERVICE_H_ */
-
-
-
-
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef DEBUGGINGSERVICE_H_
+#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 ActorClassBase;
+
+
+class DebuggingService {
+private:
+ static DebuggingService* s_instance;
+
+public:
+ virtual ~DebuggingService();
+
+ static DebuggingService& getInstance() {
+ if (s_instance == 0) {
+ s_instance = new DebuggingService();
+ }
+ return *s_instance;
+ }
+
+ void addMessageAsyncOut(Address source, Address target, const std::string& msg);
+ void addMessageAsyncIn(Address source, Address target, const std::string& msg);
+ void addMessageSyncCall(Address source, Address target, const std::string& msg);
+ void addMessageSyncReturn(Address source, Address target, const std::string& msg);
+ void addActorState(const ActorClassBase& actor, const std::string& state);
+ void addPortInstance(PortBase& port);
+ MSCLogger& getSyncLogger();
+ MSCLogger& getAsyncLogger();
+
+private:
+
+ MSCLogger asyncLogger;
+ MSCLogger syncLogger;
+ std::map<Address, PortBase*> portInstances;
+
+ DebuggingService();
+ DebuggingService(const DebuggingService& right);
+ DebuggingService& operator=(const DebuggingService& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* DEBUGGINGSERVICE_H_ */
+
+
+
+
+
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp
index c0d0ada18..d720bbe5e 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "MSCFilter.h"
-
-namespace etRuntime {
-
-MSCFilter::MSCFilter() :
- filterList() {
-}
-MSCFilter::~MSCFilter() {
-}
-
-void MSCFilter::addFilter(FilterItem filter) {
- filterList.push_back(filter);
-}
-
-bool MSCFilter::applyTo(const std::string& text) {
- if (filterList.empty())
- return true; // no filters -> all messages will be logged
- std::list<FilterItem>::iterator it = filterList.begin();
- for ( ; it != filterList.end(); ++it) {
- if (text.compare((*it).filter) == 0)
- return !(*it).exclude;
- }
- return false;
-}
-
-std::string MSCFilter::reduceString(const std::string& string) {
- if (filterList.size() == 1)
- //TODO: filtering with regular expression
- // return string.replaceFirst(filterList.front().filter, "");
- return string;
- else
- return string;
-}
-
-} /* namespace etRuntime */
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "MSCFilter.h"
+
+namespace etRuntime {
+
+MSCFilter::MSCFilter() :
+ filterList() {
+}
+MSCFilter::~MSCFilter() {
+}
+
+void MSCFilter::addFilter(FilterItem filter) {
+ filterList.push_back(filter);
+}
+
+bool MSCFilter::applyTo(const std::string& text) {
+ if (filterList.empty())
+ return true; // no filters -> all messages will be logged
+ std::list<FilterItem>::iterator it = filterList.begin();
+ for ( ; it != filterList.end(); ++it) {
+ if (text.compare((*it).filter) == 0)
+ return !(*it).exclude;
+ }
+ return false;
+}
+
+std::string MSCFilter::reduceString(const std::string& string) {
+ if (filterList.size() == 1)
+ //TODO: filtering with regular expression
+ // return string.replaceFirst(filterList.front().filter, "");
+ return string;
+ else
+ return string;
+}
+
+} /* namespace etRuntime */
+
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h
index d3bbd8c7b..917feb460 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MSCFILTER_H_
-#define MSCFILTER_H_
-
-#include <list>
-#include <string>
-
-namespace etRuntime {
-
-class MSCFilter {
-public:
- class FilterItem{
- public:
- FilterItem(const std::string& filter_, bool exclude_)
- : exclude(exclude_),
- filter(filter_)
- {};
- bool exclude;
- std::string filter;
- private:
- FilterItem();
- };
-
- MSCFilter();
- virtual ~MSCFilter();
-
- void addFilter(FilterItem filter);
- bool applyTo(const std::string& text);
- std::string reduceString(const std::string& string);
-
-private:
- std::list<FilterItem> filterList;
-
-};
-
-} /* namespace etRuntime */
-#endif /* MSCFILTER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MSCFILTER_H_
+#define MSCFILTER_H_
+
+#include <list>
+#include <string>
+
+namespace etRuntime {
+
+class MSCFilter {
+public:
+ class FilterItem{
+ public:
+ FilterItem(const std::string& filter_, bool exclude_)
+ : exclude(exclude_),
+ filter(filter_)
+ {};
+ bool exclude;
+ std::string filter;
+ private:
+ FilterItem();
+ };
+
+ MSCFilter();
+ virtual ~MSCFilter();
+
+ void addFilter(FilterItem filter);
+ bool applyTo(const std::string& text);
+ std::string reduceString(const std::string& string);
+
+private:
+ std::list<FilterItem> filterList;
+
+};
+
+} /* namespace etRuntime */
+#endif /* MSCFILTER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp
index d36b4c87c..5ecb0354d 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "MSCLogger.h"
-
-namespace etRuntime {
-
-MSCLogger::MSCLogger()
-: commandList(),
- filter(0),
- path(),
- msc_name(),
-is_open(false)
-{
-}
-
-MSCLogger::~MSCLogger() {
- delete filter;
- filter = 0;
-}
-
-void MSCLogger::setMSC(const std::string& msc_name_, const std::string& path_) {
- msc_name = msc_name_;
- path = path_;
- delete filter;
- filter = new MSCFilter();
-}
-
-void MSCLogger::addMessageAsyncOut(const std::string& source, const std::string& target,
- const std::string& message) {
- createLine(source, " >-- ", target, message);
-}
-
-void MSCLogger::addMessageAsyncIn(const std::string& source, const std::string& target,
- const std::string& message) {
- createLine(source, " --> ", target, message);
-}
-
-void MSCLogger::addMessageSyncCall(const std::string& source, const std::string& target,
- const std::string& message) {
- createLine(source, " ==> ", target, message);
-}
-
-void MSCLogger::addMessageSyncReturn(const std::string& source, const std::string& target,
- const std::string& message) {
- createLine(source, " <== ", target, message);
-}
-
-void MSCLogger::addActorState(const std::string& actor, const std::string& state) {
- if (filter->applyTo(actor))
- commandList.push_back("\t" + filter->reduceString(actor) + " >>> " + state);
-}
-
-void MSCLogger::createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message) {
- if (filter->applyTo(source) && filter->applyTo(target)) {
- commandList.push_back( "\t"+filter->reduceString(source)+mid+filter->reduceString(target)+ " " + message);
- }
-}
-
-void MSCLogger::close() {
- if (is_open) {
-// try {
- //TODO: error handling
- // Create file
- std::ofstream myfile;
- //TODO: where to create the file
- // std::string dir = "tmp/log"; doesn't work on windows
- std::string dir = "";
- myfile.open (std::string(dir + path + msc_name + ".seq").c_str(), std::ios::out);
- if (myfile.is_open()) { /* ok, proceed with output */
- saveMSCforTrace2UML(myfile);
- myfile.close();
- }
-// };
- }
- is_open = false;
-}
-
-void MSCLogger::saveMSCforTrace2UML(std::ofstream& out) {
- //try {
- //TODO: errorhandling
- out << "#generated MSC for Trace2UML";
- out << std::endl ;
- std::list<std::string>::iterator it = commandList.begin();
- for ( ; it != commandList.end(); ++it) {
- out << (*it) << std::endl;
- }
-// } catch (IOException e) {
-// System.err.println("Error: " + e.getMessage());
-// }
-
-}
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "MSCLogger.h"
+
+namespace etRuntime {
+
+MSCLogger::MSCLogger()
+: commandList(),
+ filter(0),
+ path(),
+ msc_name(),
+is_open(false)
+{
+}
+
+MSCLogger::~MSCLogger() {
+ delete filter;
+ filter = 0;
+}
+
+void MSCLogger::setMSC(const std::string& msc_name_, const std::string& path_) {
+ msc_name = msc_name_;
+ path = path_;
+ delete filter;
+ filter = new MSCFilter();
+}
+
+void MSCLogger::addMessageAsyncOut(const std::string& source, const std::string& target,
+ const std::string& message) {
+ createLine(source, " >-- ", target, message);
+}
+
+void MSCLogger::addMessageAsyncIn(const std::string& source, const std::string& target,
+ const std::string& message) {
+ createLine(source, " --> ", target, message);
+}
+
+void MSCLogger::addMessageSyncCall(const std::string& source, const std::string& target,
+ const std::string& message) {
+ createLine(source, " ==> ", target, message);
+}
+
+void MSCLogger::addMessageSyncReturn(const std::string& source, const std::string& target,
+ const std::string& message) {
+ createLine(source, " <== ", target, message);
+}
+
+void MSCLogger::addActorState(const std::string& actor, const std::string& state) {
+ if (filter->applyTo(actor))
+ commandList.push_back("\t" + filter->reduceString(actor) + " >>> " + state);
+}
+
+void MSCLogger::createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message) {
+ if (filter->applyTo(source) && filter->applyTo(target)) {
+ commandList.push_back( "\t"+filter->reduceString(source)+mid+filter->reduceString(target)+ " " + message);
+ }
+}
+
+void MSCLogger::close() {
+ if (is_open) {
+// try {
+ //TODO: error handling
+ // Create file
+ std::ofstream myfile;
+ //TODO: where to create the file
+ // std::string dir = "tmp/log"; doesn't work on windows
+ std::string dir = "";
+ myfile.open (std::string(dir + path + msc_name + ".seq").c_str(), std::ios::out);
+ if (myfile.is_open()) { /* ok, proceed with output */
+ saveMSCforTrace2UML(myfile);
+ myfile.close();
+ }
+// };
+ }
+ is_open = false;
+}
+
+void MSCLogger::saveMSCforTrace2UML(std::ofstream& out) {
+ //try {
+ //TODO: errorhandling
+ out << "#generated MSC for Trace2UML";
+ out << std::endl ;
+ std::list<std::string>::iterator it = commandList.begin();
+ for ( ; it != commandList.end(); ++it) {
+ out << (*it) << std::endl;
+ }
+// } catch (IOException e) {
+// System.err.println("Error: " + e.getMessage());
+// }
+
+}
+
+
+}
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h
index 19b9d94ca..01499863d 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MSCLOGGER_H_
-#define MSCLOGGER_H_
-
-#include <string>
-#include <list>
-#include <iostream>
-#include <fstream>
-#include "MSCFilter.h"
-
-namespace etRuntime {
-
-class MSCLogger {
-public:
- MSCLogger();
- virtual ~MSCLogger();
-
- void setMSC(const std::string& msc_name_, const std::string& path_);
-
- //TODO synchronized
- void open() {is_open = true; };
- //TODO synchronized
- void addMessageAsyncOut(const std::string& source, const std::string& target, const std::string& message);
- //TODO synchronized
- void addMessageAsyncIn(const std::string& source, const std::string& target, const std::string& message);
- //TODO synchronized
- void addMessageSyncCall(const std::string& source, const std::string& target, const std::string& message);
- //TODO synchronized
- void addMessageSyncReturn(const std::string& source, const std::string& target, const std::string& message);
- //TODO synchronized
- void addActorState(const std::string& actor, const std::string& state);
- //TODO synchronized
- void close();
-
- const std::list<std::string>& getCommandList() { return commandList; };
- MSCFilter* getMSCFilter(){ return filter; };
-
-private:
- void createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message);
- void saveMSCforTrace2UML(std::ofstream& out);
-
- std::list<std::string> commandList;
- MSCFilter* filter;
-
- std::string path;
- std::string msc_name ;
- bool is_open;
-
- MSCLogger(const MSCLogger& right);
- MSCLogger& operator=(const MSCLogger& right);
-
-
-};
-
-
-} /* namespace etRuntime */
-#endif /* MSCLOGGER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MSCLOGGER_H_
+#define MSCLOGGER_H_
+
+#include <string>
+#include <list>
+#include <iostream>
+#include <fstream>
+#include "MSCFilter.h"
+
+namespace etRuntime {
+
+class MSCLogger {
+public:
+ MSCLogger();
+ virtual ~MSCLogger();
+
+ void setMSC(const std::string& msc_name_, const std::string& path_);
+
+ //TODO synchronized
+ void open() {is_open = true; };
+ //TODO synchronized
+ void addMessageAsyncOut(const std::string& source, const std::string& target, const std::string& message);
+ //TODO synchronized
+ void addMessageAsyncIn(const std::string& source, const std::string& target, const std::string& message);
+ //TODO synchronized
+ void addMessageSyncCall(const std::string& source, const std::string& target, const std::string& message);
+ //TODO synchronized
+ void addMessageSyncReturn(const std::string& source, const std::string& target, const std::string& message);
+ //TODO synchronized
+ void addActorState(const std::string& actor, const std::string& state);
+ //TODO synchronized
+ void close();
+
+ const std::list<std::string>& getCommandList() { return commandList; };
+ MSCFilter* getMSCFilter(){ return filter; };
+
+private:
+ void createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message);
+ void saveMSCforTrace2UML(std::ofstream& out);
+
+ std::list<std::string> commandList;
+ MSCFilter* filter;
+
+ std::string path;
+ std::string msc_name ;
+ bool is_open;
+
+ MSCLogger(const MSCLogger& right);
+ MSCLogger& operator=(const MSCLogger& right);
+
+
+};
+
+
+} /* namespace etRuntime */
+#endif /* MSCLOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h
index f9d46a43f..7086a8ac3 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef ABSTRACTMESSAGERECEIVER_H_
-#define ABSTRACTMESSAGERECEIVER_H_
-
-#include "common/messaging/Address.h"
-#include "common/messaging/IMessageReceiver.h"
-#include "common/messaging/RTObject.h"
-#include <string>
-
-namespace etRuntime {
-
-class AbstractMessageReceiver: public RTObject, public virtual IMessageReceiver {
-
-public:
- Address getAddress() const {
- return m_address;
- }
- virtual ~AbstractMessageReceiver() {};
-
-protected:
- AbstractMessageReceiver(IRTObject* parent, Address address, std::string name)
- : IMessageReceiver(),
- RTObject(parent, name),
- m_address(address)
- {
-
- }
-
-private:
- Address m_address;
-
- AbstractMessageReceiver();
-};
-
-
-}
-#endif /* ABSTRACTMESSAGERECEIVER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef ABSTRACTMESSAGERECEIVER_H_
+#define ABSTRACTMESSAGERECEIVER_H_
+
+#include "common/messaging/Address.h"
+#include "common/messaging/IMessageReceiver.h"
+#include "common/messaging/RTObject.h"
+#include <string>
+
+namespace etRuntime {
+
+class AbstractMessageReceiver: public RTObject, public virtual IMessageReceiver {
+
+public:
+ Address getAddress() const {
+ return m_address;
+ }
+ virtual ~AbstractMessageReceiver() {};
+
+protected:
+ AbstractMessageReceiver(IRTObject* parent, Address address, std::string name)
+ : IMessageReceiver(),
+ RTObject(parent, name),
+ m_address(address)
+ {
+
+ }
+
+private:
+ Address m_address;
+
+ AbstractMessageReceiver();
+};
+
+
+}
+#endif /* ABSTRACTMESSAGERECEIVER_H_ */
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 529f5b72c..4adbf895e 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
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "Address.h"
-#include <sstream>
-#include <iostream>
-
-namespace etRuntime {
-
-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 = (const Address& right) {
- if (this != &right) {
- m_nodeID = right.m_nodeID;
- m_threadID = right.m_threadID;
- m_objectID = right.m_objectID;
- }
- return *this;
-}
-
-bool Address::operator< (const Address& right) const {
- if (m_nodeID == right.m_nodeID) {
- if (m_threadID == right.m_threadID) {
- return (m_objectID < right.m_objectID);
- }
- else {
- return (m_threadID < right.m_threadID);
- }
- }
- else {
- return (m_nodeID < right.m_nodeID);
- }
-}
-
-Address::~Address() {
-}
-
-std::string Address::toString() const{
- std::stringstream strm;
- strm << "Address(nodeID=" << m_nodeID
- << ",threadID=" << m_threadID << ",objectID=" << m_objectID+")";
- return strm.str();
-}
-std::string Address::toID() const{
- 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);
-}
-
-void Address::printAddrVector(const std::vector<std::vector<etRuntime::Address> >& addresses){
- std::vector<std::vector<etRuntime::Address> >::const_iterator outerIt = addresses.begin();
- std::cout << "{" ;
- for (int i=0; outerIt!= addresses.end(); ++outerIt,++i) {
- std::cout << "{" ;
- std::vector<etRuntime::Address>::const_iterator it = (*outerIt).begin();
- for (int j=0; it!=(*outerIt).end(); ++it,++j) {
- std::cout << (*it).toID() << ":" << addresses[i][j].toID() << ",";
- }
- std::cout << "}" << std::endl;
- }
- std::cout << "}" << std::endl;
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "Address.h"
+#include <sstream>
+#include <iostream>
+
+namespace etRuntime {
+
+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 = (const Address& right) {
+ if (this != &right) {
+ m_nodeID = right.m_nodeID;
+ m_threadID = right.m_threadID;
+ m_objectID = right.m_objectID;
+ }
+ return *this;
+}
+
+bool Address::operator< (const Address& right) const {
+ if (m_nodeID == right.m_nodeID) {
+ if (m_threadID == right.m_threadID) {
+ return (m_objectID < right.m_objectID);
+ }
+ else {
+ return (m_threadID < right.m_threadID);
+ }
+ }
+ else {
+ return (m_nodeID < right.m_nodeID);
+ }
+}
+
+Address::~Address() {
+}
+
+std::string Address::toString() const{
+ std::stringstream strm;
+ strm << "Address(nodeID=" << m_nodeID
+ << ",threadID=" << m_threadID << ",objectID=" << m_objectID+")";
+ return strm.str();
+}
+std::string Address::toID() const{
+ 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);
+}
+
+void Address::printAddrVector(const std::vector<std::vector<etRuntime::Address> >& addresses){
+ std::vector<std::vector<etRuntime::Address> >::const_iterator outerIt = addresses.begin();
+ std::cout << "{" ;
+ for (int i=0; outerIt!= addresses.end(); ++outerIt,++i) {
+ std::cout << "{" ;
+ std::vector<etRuntime::Address>::const_iterator it = (*outerIt).begin();
+ for (int j=0; it!=(*outerIt).end(); ++it,++j) {
+ std::cout << (*it).toID() << ":" << addresses[i][j].toID() << ",";
+ }
+ std::cout << "}" << std::endl;
+ }
+ std::cout << "}" << std::endl;
+}
+
+} /* 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 d26acf52d..870e25500 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
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef ADDRESS_H_
-#define ADDRESS_H_
-
-#include <string>
-#include <vector>
-
-namespace etRuntime {
-
-class Address {
- public:
- explicit Address(int nodeID=0, int threadID=0, int objectID=0);
- Address(const Address & right);
- ~Address();
-
- Address & operator = (const Address& right);
- bool operator< (const Address& right) const;
-
- std::string toString() const;
- std::string toID()const;
-
- 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;
-
- //debug helper function
- static void printAddrVector(const std::vector<std::vector<etRuntime::Address> >& addresses);
-
- private:
-};
-
-} /* namespace etRuntime */
-#endif /* ADDRESS_H_ */
-
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef ADDRESS_H_
+#define ADDRESS_H_
+
+#include <string>
+#include <vector>
+
+namespace etRuntime {
+
+class Address {
+ public:
+ explicit Address(int nodeID=0, int threadID=0, int objectID=0);
+ Address(const Address & right);
+ ~Address();
+
+ Address & operator = (const Address& right);
+ bool operator< (const Address& right) const;
+
+ std::string toString() const;
+ std::string toID()const;
+
+ 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;
+
+ //debug helper function
+ static void printAddrVector(const std::vector<std::vector<etRuntime::Address> >& addresses);
+
+ 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 640628392..40e97cf86 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
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "IMessageReceiver.h"
-
-namespace etRuntime {
-
-IMessageReceiver::IMessageReceiver() {
-}
-
-IMessageReceiver::~IMessageReceiver() {
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "IMessageReceiver.h"
+
+namespace etRuntime {
+
+IMessageReceiver::IMessageReceiver() {
+}
+
+IMessageReceiver::~IMessageReceiver() {
+}
+
+} /* 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 cc6bdcd48..a1136ab7a 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
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef IMESSAGERECEIVER_H_
-#define IMESSAGERECEIVER_H_
-
-#include "common/messaging/Address.h"
-#include "common/messaging/Message.h"
-#include "common/messaging/IRTObject.h"
-
-namespace etRuntime {
-
-class IMessageReceiver{
-public:
- IMessageReceiver();
- virtual ~IMessageReceiver();
-
- virtual void receive(Message* msg) = 0;
- virtual Address getAddress() const = 0;
- virtual bool isMsgService() const { return false;};
-
-};
-
-} /* namespace etRuntime */
-#endif /* IMESSAGERECEIVER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef IMESSAGERECEIVER_H_
+#define IMESSAGERECEIVER_H_
+
+#include "common/messaging/Address.h"
+#include "common/messaging/Message.h"
+#include "common/messaging/IRTObject.h"
+
+namespace etRuntime {
+
+class IMessageReceiver{
+public:
+ IMessageReceiver();
+ virtual ~IMessageReceiver();
+
+ virtual void receive(Message* msg) = 0;
+ virtual Address getAddress() const = 0;
+ virtual bool isMsgService() const { return false;};
+
+};
+
+} /* namespace etRuntime */
+#endif /* IMESSAGERECEIVER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp
index 7f7e1259f..edf5ee57d 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "IRTObject.h"
-
-namespace etRuntime {
-
-const std::string IRTObject::NO_NAME = "<no name>";
-
-}
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "IRTObject.h"
+
+namespace etRuntime {
+
+const std::string IRTObject::NO_NAME = "<no name>";
+
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h
index 8553052d6..d10dd8022 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef IRTOBJECT_H_
-#define IRTOBJECT_H_
-
-#include <string>
-
-namespace etRuntime {
-
-class IRTObject {
-
-public:
- virtual ~IRTObject() {};
-
- static const char PATH_DELIM = '/';
- static const char PATHNAME_DELIM = '_';
- static const std::string NO_NAME;
-
- virtual const std::string& getInstancePath() const = 0;
- virtual const std::string& getInstancePathName() const = 0;
-};
-
-}
-
-#endif /* IRTOBJECT_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef IRTOBJECT_H_
+#define IRTOBJECT_H_
+
+#include <string>
+
+namespace etRuntime {
+
+class IRTObject {
+
+public:
+ virtual ~IRTObject() {};
+
+ static const char PATH_DELIM = '/';
+ static const char PATHNAME_DELIM = '_';
+ static const std::string NO_NAME;
+
+ virtual const std::string& getInstancePath() const = 0;
+ virtual const std::string& getInstancePathName() const = 0;
+};
+
+}
+
+#endif /* IRTOBJECT_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 bef4ff1fa..0a4aa42bb 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
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "Message.h"
-
-#include <sstream>
-
-namespace etRuntime {
-
-
-Message::~Message() {
- m_next = 0;
-}
-
-std::string Message::toString(){
- std::stringstream strm;
- strm << "EventMessage(" << m_address.toString() << ", evt=" << m_evtId << ")";
- if (m_data) {
- strm << std::showbase << std::hex << m_data;
- }
- return strm.str();
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "Message.h"
+
+#include <sstream>
+
+namespace etRuntime {
+
+
+Message::~Message() {
+ m_next = 0;
+}
+
+std::string Message::toString(){
+ std::stringstream strm;
+ strm << "EventMessage(" << m_address.toString() << ", evt=" << m_evtId << ")";
+ if (m_data) {
+ strm << std::showbase << std::hex << m_data;
+ }
+ 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 0b900a5b7..2307a1ead 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
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MESSAGE_H_
-#define MESSAGE_H_
-
-#include "common/messaging/Address.h"
-#include "etDatatypes.h"
-#include <string>
-
-namespace etRuntime {
-
-class Message {
-public:
- 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();
-
- 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; };
-
- 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();
- Message(const Message & right);
- Message & operator = (const Message& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* MESSAGE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MESSAGE_H_
+#define MESSAGE_H_
+
+#include "common/messaging/Address.h"
+#include "etDatatypes.h"
+#include <string>
+
+namespace etRuntime {
+
+class Message {
+public:
+ 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();
+
+ 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; };
+
+ 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();
+ Message(const Message & right);
+ Message & operator = (const Message& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* MESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp
index 045e4dbf9..9f5e2b759 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "MessageDispatcher.h"
-
-namespace etRuntime {
-
-
-MessageDispatcher::~MessageDispatcher() {
-}
-
-MessageDispatcher::MessageDispatcher(IRTObject* parent, Address addr, std::string name)
-: RTObject(parent, name) ,
- IMessageReceiver(),
- m_local_map(),
- m_thread_map(),
- m_node_map(),
- m_address(addr)
-{};
-
-void MessageDispatcher::addMessageReceiver(IMessageReceiver& receiver){
-if (! receiver.getAddress().isValid() )
- return;
-
-// TODO: does only work same thread (else)
-if (receiver.getAddress().m_nodeID != m_address.m_nodeID){
- m_node_map[receiver.getAddress().m_objectID] = &receiver;
-}
-else if(receiver.getAddress().m_threadID != m_address.m_threadID){
- m_thread_map[receiver.getAddress().m_threadID] = &receiver;
-}
-else {
- m_local_map[receiver.getAddress().m_objectID] = &receiver;
-}
-};
-
-void MessageDispatcher::receive(Message* msg) {
-// TODO: does only work same thread (else)
- //TODO: assert msg != 0
-IMessageReceiver* receiver = 0;
-std::map<int, IMessageReceiver*>::iterator it;
-if (msg->getAddress().m_nodeID != m_address.m_nodeID){
- it = m_node_map.find(msg->getAddress().m_objectID);
- if (it != m_node_map.end() ) {
- receiver = (*it).second;
- }
-}
-else if(msg->getAddress().m_threadID != m_address.m_threadID){
- it = m_thread_map.find(msg->getAddress().m_objectID);
- if (it != m_thread_map.end() ) {
- receiver = (*it).second;
- }
-}
-else {
- // Same node, same thread -> local call Dispatch Map
- it = m_local_map.find(msg->getAddress().m_objectID);
- if (it != m_local_map.end() ) {
- receiver = (*it).second;
- }
-}
-if (receiver!=0)
-{
- receiver->receive(msg);
- // TODO: error handling for not found addresses
-}
-}
-
-} /* namespace etRuntime */
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "MessageDispatcher.h"
+
+namespace etRuntime {
+
+
+MessageDispatcher::~MessageDispatcher() {
+}
+
+MessageDispatcher::MessageDispatcher(IRTObject* parent, Address addr, std::string name)
+: RTObject(parent, name) ,
+ IMessageReceiver(),
+ m_local_map(),
+ m_thread_map(),
+ m_node_map(),
+ m_address(addr)
+{};
+
+void MessageDispatcher::addMessageReceiver(IMessageReceiver& receiver){
+if (! receiver.getAddress().isValid() )
+ return;
+
+// TODO: does only work same thread (else)
+if (receiver.getAddress().m_nodeID != m_address.m_nodeID){
+ m_node_map[receiver.getAddress().m_objectID] = &receiver;
+}
+else if(receiver.getAddress().m_threadID != m_address.m_threadID){
+ m_thread_map[receiver.getAddress().m_threadID] = &receiver;
+}
+else {
+ m_local_map[receiver.getAddress().m_objectID] = &receiver;
+}
+};
+
+void MessageDispatcher::receive(Message* msg) {
+// TODO: does only work same thread (else)
+ //TODO: assert msg != 0
+IMessageReceiver* receiver = 0;
+std::map<int, IMessageReceiver*>::iterator it;
+if (msg->getAddress().m_nodeID != m_address.m_nodeID){
+ it = m_node_map.find(msg->getAddress().m_objectID);
+ if (it != m_node_map.end() ) {
+ receiver = (*it).second;
+ }
+}
+else if(msg->getAddress().m_threadID != m_address.m_threadID){
+ it = m_thread_map.find(msg->getAddress().m_objectID);
+ if (it != m_thread_map.end() ) {
+ receiver = (*it).second;
+ }
+}
+else {
+ // Same node, same thread -> local call Dispatch Map
+ it = m_local_map.find(msg->getAddress().m_objectID);
+ if (it != m_local_map.end() ) {
+ receiver = (*it).second;
+ }
+}
+if (receiver!=0)
+{
+ receiver->receive(msg);
+ // TODO: error handling for not found addresses
+}
+}
+
+} /* namespace etRuntime */
+
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h
index c49628a09..57b50e5f6 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MESSAGEDISPATCHER_H_
-#define MESSAGEDISPATCHER_H_
-
-#include "common/messaging/IMessageReceiver.h"
-#include "common/messaging/IRTObject.h"
-#include "common/messaging/RTObject.h"
-#include <map>
-#include <string>
-
-namespace etRuntime {
-
-class MessageDispatcher : public RTObject, public IMessageReceiver {
- public:
- MessageDispatcher(IRTObject* parent, Address addr, std::string name);
- virtual ~MessageDispatcher();
-
- void addMessageReceiver(IMessageReceiver& receiver);
- void receive(Message* msg);
-
- Address getAddress() const { return m_address; };
-
- private:
- std::map<int, IMessageReceiver*> m_local_map;
- std::map<int, IMessageReceiver*> m_thread_map;
- std::map<int, IMessageReceiver*> m_node_map;
- Address m_address;
-
- MessageDispatcher();
- MessageDispatcher(const MessageDispatcher& right);
- MessageDispatcher& operator=(const MessageDispatcher& right);
-};
-
-} /* namespace etRuntime */
-#endif /* MESSAGEDISPATCHER_H_ */
-
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MESSAGEDISPATCHER_H_
+#define MESSAGEDISPATCHER_H_
+
+#include "common/messaging/IMessageReceiver.h"
+#include "common/messaging/IRTObject.h"
+#include "common/messaging/RTObject.h"
+#include <map>
+#include <string>
+
+namespace etRuntime {
+
+class MessageDispatcher : public RTObject, public IMessageReceiver {
+ public:
+ MessageDispatcher(IRTObject* parent, Address addr, std::string name);
+ virtual ~MessageDispatcher();
+
+ void addMessageReceiver(IMessageReceiver& receiver);
+ void receive(Message* msg);
+
+ Address getAddress() const { return m_address; };
+
+ private:
+ std::map<int, IMessageReceiver*> m_local_map;
+ std::map<int, IMessageReceiver*> m_thread_map;
+ std::map<int, IMessageReceiver*> m_node_map;
+ Address m_address;
+
+ MessageDispatcher();
+ MessageDispatcher(const MessageDispatcher& right);
+ MessageDispatcher& operator=(const MessageDispatcher& right);
+};
+
+} /* namespace etRuntime */
+#endif /* MESSAGEDISPATCHER_H_ */
+
+
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp
index fcf619c9c..ab2f54a8b 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "MessageSeQueue.h"
-
-namespace etRuntime {
-
-
-MessageSeQueue::~MessageSeQueue() {
- m_first = 0;
- m_last = 0;
-}
-
-MessageSeQueue::MessageSeQueue(IRTObject* parent, std::string name)
- : RTObject(parent, name),
- m_first(0),
- m_last(0),
- m_highWaterMark(0),
- m_size(0)
-{
-}
-
-void MessageSeQueue::push(Message* msg) {
- // TODO: optimize queue for concurrent push / pop
- if (m_first == 0) {
- m_first = m_last = msg;
- } else {
- m_last->setNext(msg);
- m_last = msg;
- }
- if (++m_size > m_highWaterMark)
- m_highWaterMark++;
-
-}
-
-Message* MessageSeQueue::pop() {
- // TODO: optimize queue for concurrent push / pop
- Message* pop_msg = m_first;
- if (m_first == 0) {
- return m_first;
- }
- if (m_first->getNext() == 0) {
- m_first = m_last = 0;
- } else {
- m_first = m_first->getNext();
- }
-
- pop_msg->setNext(0);
- m_size--;
-
- return pop_msg;
-}
-
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "MessageSeQueue.h"
+
+namespace etRuntime {
+
+
+MessageSeQueue::~MessageSeQueue() {
+ m_first = 0;
+ m_last = 0;
+}
+
+MessageSeQueue::MessageSeQueue(IRTObject* parent, std::string name)
+ : RTObject(parent, name),
+ m_first(0),
+ m_last(0),
+ m_highWaterMark(0),
+ m_size(0)
+{
+}
+
+void MessageSeQueue::push(Message* msg) {
+ // TODO: optimize queue for concurrent push / pop
+ if (m_first == 0) {
+ m_first = m_last = msg;
+ } else {
+ m_last->setNext(msg);
+ m_last = msg;
+ }
+ if (++m_size > m_highWaterMark)
+ m_highWaterMark++;
+
+}
+
+Message* MessageSeQueue::pop() {
+ // TODO: optimize queue for concurrent push / pop
+ Message* pop_msg = m_first;
+ if (m_first == 0) {
+ return m_first;
+ }
+ if (m_first->getNext() == 0) {
+ m_first = m_last = 0;
+ } else {
+ m_first = m_first->getNext();
+ }
+
+ pop_msg->setNext(0);
+ m_size--;
+
+ return pop_msg;
+}
+
+
+} /* namespace etRuntime */
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 3e63a6b28..1468cea16 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
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MESSAGESEQUEUE_H_
-#define MESSAGESEQUEUE_H_
-
-#include "common/messaging/RTObject.h"
-#include <string>
-#include "common/messaging/Message.h"
-
-namespace etRuntime {
-
-class MessageSeQueue: public RTObject {
- public:
- MessageSeQueue(IRTObject* parent, std::string name);
- virtual ~MessageSeQueue();
-
- void push(Message* msg);
- Message* pop();
-
- long getSize() const {return m_size; }
- Message* getFirst() const {return m_first; }
- Message* getLast() const { return m_last; }
- bool isNotEmpty() const { return m_last != 0; }
- long getHightWaterMark() const { return m_highWaterMark; }
-
- private:
- Message* m_first;
- Message* m_last;
- long m_highWaterMark;
- long m_size;
-
- MessageSeQueue();
- MessageSeQueue(const MessageSeQueue& right);
- MessageSeQueue& operator=(const MessageSeQueue& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* MESSAGESEQUEUE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MESSAGESEQUEUE_H_
+#define MESSAGESEQUEUE_H_
+
+#include "common/messaging/RTObject.h"
+#include <string>
+#include "common/messaging/Message.h"
+
+namespace etRuntime {
+
+class MessageSeQueue: public RTObject {
+ public:
+ MessageSeQueue(IRTObject* parent, std::string name);
+ virtual ~MessageSeQueue();
+
+ void push(Message* msg);
+ Message* pop();
+
+ long getSize() const {return m_size; }
+ Message* getFirst() const {return m_first; }
+ Message* getLast() const { return m_last; }
+ bool isNotEmpty() const { return m_last != 0; }
+ long getHightWaterMark() const { return m_highWaterMark; }
+
+ private:
+ Message* m_first;
+ Message* m_last;
+ long m_highWaterMark;
+ long m_size;
+
+ MessageSeQueue();
+ MessageSeQueue(const MessageSeQueue& right);
+ MessageSeQueue& operator=(const MessageSeQueue& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* MESSAGESEQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp
index cd516c7bf..21153ce56 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "MessageService.h"
-#include <iostream>
-#include <stdlib.h>
-#include <unistd.h>
-
-namespace etRuntime {
-
-extern "C" {
- void* threadStarter(void* arg) {
- MessageService* thisPtr = static_cast<MessageService*>(arg);
- std::cout << "Thread " << thisPtr->getName() << " is started." << std::endl;
- thisPtr->run();
- return arg;
- // pthread_exit(NULL);
- }
-}
-
-MessageService::MessageService(IRTObject* parent, Address addr, std::string name, int priority)
- : IMessageReceiver(),
- RTObject(parent, name),
- m_running(false),
- m_thread(),
- m_mutex(),
- m_mutexAttr(),
- m_conditionVar(),
- m_threadAttr(),
- m_messageQueue(this, "Queue"),
- m_messageDispatcher( this,
- Address(addr.m_nodeID, addr.m_threadID, addr.m_objectID + 1),
- "Dispatcher"),
- m_address(addr),
- m_lastMessageTimestamp(0),
- m_asyncActors()
-{
- pthread_mutexattr_init(&m_mutexAttr);
- pthread_mutexattr_settype(&m_mutexAttr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&m_mutex, &m_mutexAttr);
- pthread_cond_init (&m_conditionVar, NULL);
- pthread_attr_init(&m_threadAttr);
- pthread_attr_setdetachstate(&m_threadAttr, PTHREAD_CREATE_JOINABLE);
-
- // check and set priority
-// assert priority >= Thread.MIN_PRIORITY : ("priority smaller than Thread.MIN_PRIORITY (1)");
-// assert priority <= Thread.MAX_PRIORITY : ("priority bigger than Thread.MAX_PRIORITY (10)");
-// this.setPriority(priority);
-
-}
-
-MessageService::~MessageService() {
- pthread_attr_destroy(&m_threadAttr);
- pthread_mutex_destroy(&m_mutex);
- pthread_cond_destroy(&m_conditionVar);
- pthread_exit(NULL);
-
-}
-
-void MessageService::start(bool singlethreaded) {
- if (singlethreaded) {
- std::cout << "starting message service " << getName() << " singlethreaded" << std::endl;
- }
- else {
- std::cout << "starting message service " << getName() << " on own thread" << std::endl;
- int rc = pthread_create(&m_thread, &m_threadAttr, threadStarter, static_cast<void *>(this));
- if (rc){
- std::cout << "ERROR; return code from pthread_create() is " << rc << std::endl;
- exit(-1);
- }
- }
-}
-
-void MessageService::join() {
- void *status;
- int rc = pthread_join(m_thread, &status);
- if (rc){
- std::cout << "ERROR; return code from pthread_join() is " << rc << std::endl;
- exit(-1);
- }
-}
-void MessageService::run() {
- m_running = true;
- while (m_running) {
- pollOneMessage();
- usleep(10000);
- }
- std::cout << "ending message service " << getName() << " on own thread" << std::endl;
-}
-
-void MessageService::runOnce() {
- pollAsyncActors();
- while (m_messageQueue.isNotEmpty()){
- Message* msg = m_messageQueue.pop(); // get next Message from Queue
- if (msg != 0) {
- m_messageDispatcher.receive(msg);
- }
- }
-}
-
-void MessageService::receive(Message* msg) {
- pthread_mutex_lock(&m_mutex);
- if (msg != 0) {
- m_messageQueue.push(msg);
- pthread_cond_signal(&m_conditionVar); // wake up thread to compute message
- }
- pthread_mutex_unlock(&m_mutex);
-}
-
-
-// TODO: synchronized
-void MessageService::terminate() {
- pthread_mutex_lock(&m_mutex);
- if (m_running) {
- m_running = false;
- pthread_cond_signal(&m_conditionVar); // wake up thread to terminate
- }
- pthread_mutex_unlock(&m_mutex);
-}
-
-void MessageService::pollOneMessage() {
- pthread_mutex_lock(&m_mutex);
- Message* msg = m_messageQueue.pop(); // get next Message from Queue
- if (msg == 0) {
- // no message in queue -> wait till Thread is notified
- pthread_cond_wait(&m_conditionVar, &m_mutex);
- } else {
- //TODO: set timestamp
- // m_lastMessageTimestamp = System.currentTimeMillis();
- m_messageDispatcher.receive(msg);
- }
- pthread_mutex_unlock(&m_mutex);
-
-}
-
-void MessageService::addAsyncActor(IEventReceiver& evtReceiver) {
- m_asyncActors.push_back(&evtReceiver);
-}
-
-void MessageService::pollAsyncActors() {
- std::vector<IEventReceiver*>::iterator it = m_asyncActors.begin();
- for ( ; it != m_asyncActors.end(); ++it) {
- // polling event
- (*it)->receiveEvent(0,0,0);
- }
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "MessageService.h"
+#include <iostream>
+#include <stdlib.h>
+#include <unistd.h>
+
+namespace etRuntime {
+
+extern "C" {
+ void* threadStarter(void* arg) {
+ MessageService* thisPtr = static_cast<MessageService*>(arg);
+ std::cout << "Thread " << thisPtr->getName() << " is started." << std::endl;
+ thisPtr->run();
+ return arg;
+ // pthread_exit(NULL);
+ }
+}
+
+MessageService::MessageService(IRTObject* parent, Address addr, std::string name, int priority)
+ : IMessageReceiver(),
+ RTObject(parent, name),
+ m_running(false),
+ m_thread(),
+ m_mutex(),
+ m_mutexAttr(),
+ m_conditionVar(),
+ m_threadAttr(),
+ m_messageQueue(this, "Queue"),
+ m_messageDispatcher( this,
+ Address(addr.m_nodeID, addr.m_threadID, addr.m_objectID + 1),
+ "Dispatcher"),
+ m_address(addr),
+ m_lastMessageTimestamp(0),
+ m_asyncActors()
+{
+ pthread_mutexattr_init(&m_mutexAttr);
+ pthread_mutexattr_settype(&m_mutexAttr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&m_mutex, &m_mutexAttr);
+ pthread_cond_init (&m_conditionVar, NULL);
+ pthread_attr_init(&m_threadAttr);
+ pthread_attr_setdetachstate(&m_threadAttr, PTHREAD_CREATE_JOINABLE);
+
+ // check and set priority
+// assert priority >= Thread.MIN_PRIORITY : ("priority smaller than Thread.MIN_PRIORITY (1)");
+// assert priority <= Thread.MAX_PRIORITY : ("priority bigger than Thread.MAX_PRIORITY (10)");
+// this.setPriority(priority);
+
+}
+
+MessageService::~MessageService() {
+ pthread_attr_destroy(&m_threadAttr);
+ pthread_mutex_destroy(&m_mutex);
+ pthread_cond_destroy(&m_conditionVar);
+ pthread_exit(NULL);
+
+}
+
+void MessageService::start(bool singlethreaded) {
+ if (singlethreaded) {
+ std::cout << "starting message service " << getName() << " singlethreaded" << std::endl;
+ }
+ else {
+ std::cout << "starting message service " << getName() << " on own thread" << std::endl;
+ int rc = pthread_create(&m_thread, &m_threadAttr, threadStarter, static_cast<void *>(this));
+ if (rc){
+ std::cout << "ERROR; return code from pthread_create() is " << rc << std::endl;
+ exit(-1);
+ }
+ }
+}
+
+void MessageService::join() {
+ void *status;
+ int rc = pthread_join(m_thread, &status);
+ if (rc){
+ std::cout << "ERROR; return code from pthread_join() is " << rc << std::endl;
+ exit(-1);
+ }
+}
+void MessageService::run() {
+ m_running = true;
+ while (m_running) {
+ pollOneMessage();
+ usleep(10000);
+ }
+ std::cout << "ending message service " << getName() << " on own thread" << std::endl;
+}
+
+void MessageService::runOnce() {
+ pollAsyncActors();
+ while (m_messageQueue.isNotEmpty()){
+ Message* msg = m_messageQueue.pop(); // get next Message from Queue
+ if (msg != 0) {
+ m_messageDispatcher.receive(msg);
+ }
+ }
+}
+
+void MessageService::receive(Message* msg) {
+ pthread_mutex_lock(&m_mutex);
+ if (msg != 0) {
+ m_messageQueue.push(msg);
+ pthread_cond_signal(&m_conditionVar); // wake up thread to compute message
+ }
+ pthread_mutex_unlock(&m_mutex);
+}
+
+
+// TODO: synchronized
+void MessageService::terminate() {
+ pthread_mutex_lock(&m_mutex);
+ if (m_running) {
+ m_running = false;
+ pthread_cond_signal(&m_conditionVar); // wake up thread to terminate
+ }
+ pthread_mutex_unlock(&m_mutex);
+}
+
+void MessageService::pollOneMessage() {
+ pthread_mutex_lock(&m_mutex);
+ Message* msg = m_messageQueue.pop(); // get next Message from Queue
+ if (msg == 0) {
+ // no message in queue -> wait till Thread is notified
+ pthread_cond_wait(&m_conditionVar, &m_mutex);
+ } else {
+ //TODO: set timestamp
+ // m_lastMessageTimestamp = System.currentTimeMillis();
+ m_messageDispatcher.receive(msg);
+ }
+ pthread_mutex_unlock(&m_mutex);
+
+}
+
+void MessageService::addAsyncActor(IEventReceiver& evtReceiver) {
+ m_asyncActors.push_back(&evtReceiver);
+}
+
+void MessageService::pollAsyncActors() {
+ std::vector<IEventReceiver*>::iterator it = m_asyncActors.begin();
+ for ( ; it != m_asyncActors.end(); ++it) {
+ // polling event
+ (*it)->receiveEvent(0,0,0);
+ }
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h
index e34b17ab6..3a9a91f61 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MESSAGESERVICE_H_
-#define MESSAGESERVICE_H_
-
-#include <string>
-#include <vector>
-#include <pthread.h>
-#include "common/messaging/MessageDispatcher.h"
-#include "common/messaging/Address.h"
-#include "common/modelbase/IEventReceiver.h"
-#include "MessageSeQueue.h"
-
-namespace etRuntime {
-
-//TODO: abstraction from posix threads missing
-
-class MessageService: public IMessageReceiver, public RTObject {
-public:
- MessageService(IRTObject* parent, Address addr, std::string name, int priority = 0);
- virtual ~MessageService();
-
- Address getAddress() const { return m_address; } ;
-
- void start(bool singlethreaded);
- void run();
- // for single threaded configuration only
- void runOnce();
-
- void join();
- void terminate();
- void receive(Message* msg);
-
- virtual MessageDispatcher& getMessageDispatcher() { return m_messageDispatcher; }
- virtual bool isMsgService() const { return true;};
-
- void addAsyncActor(IEventReceiver& evtReceiver);
- void pollAsyncActors();
-
-
- // protected methods for sole use by test cases
-protected:
- MessageSeQueue& getMessageQueue() { return m_messageQueue; }
- long getLastMessageTimestamp() const { return m_lastMessageTimestamp; }
-
-private:
- //TODO: synchronized
- void pollOneMessage();
-
- bool m_running;
- pthread_t m_thread;
- pthread_mutex_t m_mutex;
- pthread_mutexattr_t m_mutexAttr;
- pthread_cond_t m_conditionVar;
- pthread_attr_t m_threadAttr;
-
- // TODO: add internal message queue for less locks (faster thread internal
- // messaging)
- MessageSeQueue m_messageQueue;
- MessageDispatcher m_messageDispatcher;
- Address m_address;
- long m_lastMessageTimestamp;
-
- std::vector<IEventReceiver*> m_asyncActors;
-
- MessageService();
- MessageService(const MessageService& right);
- MessageService& operator=(const MessageService& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* MESSAGESERVICE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MESSAGESERVICE_H_
+#define MESSAGESERVICE_H_
+
+#include <string>
+#include <vector>
+#include <pthread.h>
+#include "common/messaging/MessageDispatcher.h"
+#include "common/messaging/Address.h"
+#include "common/modelbase/IEventReceiver.h"
+#include "MessageSeQueue.h"
+
+namespace etRuntime {
+
+//TODO: abstraction from posix threads missing
+
+class MessageService: public IMessageReceiver, public RTObject {
+public:
+ MessageService(IRTObject* parent, Address addr, std::string name, int priority = 0);
+ virtual ~MessageService();
+
+ Address getAddress() const { return m_address; } ;
+
+ void start(bool singlethreaded);
+ void run();
+ // for single threaded configuration only
+ void runOnce();
+
+ void join();
+ void terminate();
+ void receive(Message* msg);
+
+ virtual MessageDispatcher& getMessageDispatcher() { return m_messageDispatcher; }
+ virtual bool isMsgService() const { return true;};
+
+ void addAsyncActor(IEventReceiver& evtReceiver);
+ void pollAsyncActors();
+
+
+ // protected methods for sole use by test cases
+protected:
+ MessageSeQueue& getMessageQueue() { return m_messageQueue; }
+ long getLastMessageTimestamp() const { return m_lastMessageTimestamp; }
+
+private:
+ //TODO: synchronized
+ void pollOneMessage();
+
+ bool m_running;
+ pthread_t m_thread;
+ pthread_mutex_t m_mutex;
+ pthread_mutexattr_t m_mutexAttr;
+ pthread_cond_t m_conditionVar;
+ pthread_attr_t m_threadAttr;
+
+ // TODO: add internal message queue for less locks (faster thread internal
+ // messaging)
+ MessageSeQueue m_messageQueue;
+ MessageDispatcher m_messageDispatcher;
+ Address m_address;
+ long m_lastMessageTimestamp;
+
+ std::vector<IEventReceiver*> m_asyncActors;
+
+ MessageService();
+ MessageService(const MessageService& right);
+ MessageService& operator=(const MessageService& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* MESSAGESERVICE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp
index fbf903313..6a71f9a81 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "MessageServiceController.h"
-
-namespace etRuntime {
-
-
-MessageServiceController::~MessageServiceController() {
- // TODO Auto-generated destructor stub
-}
-
-MessageServiceController::MessageServiceController(/*IRTObject parent*/)
- : m_messageServiceList(),
- m_running(false) {
- // TODO: Who is parent of MessageServices and Controller?
- // this.parent = parent;
-}
-
-void MessageServiceController::addMsgSvc(MessageService& msgSvc) {
- // TODO TS: Who is parent of MessageServices ?
- //TODO assert
- //assert(msgSvc.getAddress().m_threadID == m_messageServiceList.size());
- m_messageServiceList.push_back(&msgSvc);
-}
-
-MessageService* MessageServiceController::getMsgSvc(int threadID) {
- return m_messageServiceList.at(threadID);
-}
-
-void MessageServiceController::connectAll() {
- for (size_t i = 0; i < m_messageServiceList.size(); i++) {
- MessageDispatcher& dispatcher = getMsgSvc(i)->getMessageDispatcher();
- for (size_t j = 0; j < m_messageServiceList.size(); j++) {
- if (i != j) {
- dispatcher.addMessageReceiver(*RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(j));
- }
- }
- }
-}
-
-void MessageServiceController::start(bool singlethreaded) {
- // start all message services
- for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
- it != m_messageServiceList.end(); ++it) {
- (*it)->start(singlethreaded);
- // TODO TS: start in order of priorities
- }
- m_running = true;
-}
-
-void MessageServiceController::stop(bool singlethreaded) {
- //dumpThreads("org.eclipse.etrice.runtime.java.messaging.MessageServiceController.stop()");
- if (! singlethreaded) {
- terminate();
- waitTerminate();
- }
-}
-
-void MessageServiceController::waitTerminate() {
- for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
- it != m_messageServiceList.end(); ++it) {
- (*it)->join();
- }
-}
-
-void MessageServiceController::dumpThreads(std::string msg) {
- std::cout << "<<< begin dump threads <<<" << std::endl;
- std::cout << "=== " << msg << std::endl;
- //TODO dump stack traces
-// Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
-// for (Thread thread : traces.keySet()) {
-// std::cout << "thread " << thread.getName() << std::endl;
-// StackTraceElement[] elements = traces.get(thread);
-// int n = 2;
-// if (elements.length < n)
-// n = elements.length;
-// for (int i = 0; i < n; i++) {
-// std::cout << " " << elements[i].toString() << std::endl;
-// }
-// }
- std::cout <<(">>> end dump threads >>>");
-}
-
-void MessageServiceController::terminate() {
- if (!m_running) {
- return;
- }
- m_running = false;
-
- // terminate all message services
- for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
- it != m_messageServiceList.end(); ++it) {
- (*it)->terminate();
- //TODO TS: stop in order of priorities
- }
-}
-
-void MessageServiceController::runOnce() {
- if (!m_running) {
- return;
- }
-
- for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
- it != m_messageServiceList.end(); ++it) {
- (*it)->runOnce();
- }
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "MessageServiceController.h"
+
+namespace etRuntime {
+
+
+MessageServiceController::~MessageServiceController() {
+ // TODO Auto-generated destructor stub
+}
+
+MessageServiceController::MessageServiceController(/*IRTObject parent*/)
+ : m_messageServiceList(),
+ m_running(false) {
+ // TODO: Who is parent of MessageServices and Controller?
+ // this.parent = parent;
+}
+
+void MessageServiceController::addMsgSvc(MessageService& msgSvc) {
+ // TODO TS: Who is parent of MessageServices ?
+ //TODO assert
+ //assert(msgSvc.getAddress().m_threadID == m_messageServiceList.size());
+ m_messageServiceList.push_back(&msgSvc);
+}
+
+MessageService* MessageServiceController::getMsgSvc(int threadID) {
+ return m_messageServiceList.at(threadID);
+}
+
+void MessageServiceController::connectAll() {
+ for (size_t i = 0; i < m_messageServiceList.size(); i++) {
+ MessageDispatcher& dispatcher = getMsgSvc(i)->getMessageDispatcher();
+ for (size_t j = 0; j < m_messageServiceList.size(); j++) {
+ if (i != j) {
+ dispatcher.addMessageReceiver(*RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(j));
+ }
+ }
+ }
+}
+
+void MessageServiceController::start(bool singlethreaded) {
+ // start all message services
+ for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
+ it != m_messageServiceList.end(); ++it) {
+ (*it)->start(singlethreaded);
+ // TODO TS: start in order of priorities
+ }
+ m_running = true;
+}
+
+void MessageServiceController::stop(bool singlethreaded) {
+ //dumpThreads("org.eclipse.etrice.runtime.java.messaging.MessageServiceController.stop()");
+ if (! singlethreaded) {
+ terminate();
+ waitTerminate();
+ }
+}
+
+void MessageServiceController::waitTerminate() {
+ for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
+ it != m_messageServiceList.end(); ++it) {
+ (*it)->join();
+ }
+}
+
+void MessageServiceController::dumpThreads(std::string msg) {
+ std::cout << "<<< begin dump threads <<<" << std::endl;
+ std::cout << "=== " << msg << std::endl;
+ //TODO dump stack traces
+// Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
+// for (Thread thread : traces.keySet()) {
+// std::cout << "thread " << thread.getName() << std::endl;
+// StackTraceElement[] elements = traces.get(thread);
+// int n = 2;
+// if (elements.length < n)
+// n = elements.length;
+// for (int i = 0; i < n; i++) {
+// std::cout << " " << elements[i].toString() << std::endl;
+// }
+// }
+ std::cout <<(">>> end dump threads >>>");
+}
+
+void MessageServiceController::terminate() {
+ if (!m_running) {
+ return;
+ }
+ m_running = false;
+
+ // terminate all message services
+ for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
+ it != m_messageServiceList.end(); ++it) {
+ (*it)->terminate();
+ //TODO TS: stop in order of priorities
+ }
+}
+
+void MessageServiceController::runOnce() {
+ if (!m_running) {
+ return;
+ }
+
+ for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin();
+ it != m_messageServiceList.end(); ++it) {
+ (*it)->runOnce();
+ }
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h
index d975233a5..5f79bbea0 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef MESSAGESERVICECONTROLLER_H_
-#define MESSAGESERVICECONTROLLER_H_
-
-#include "common/messaging/MessageService.h"
-#include "common/messaging/RTServices.h"
-#include <vector>
-#include <string>
-#include <iostream>
-#include <algorithm>
-
-namespace etRuntime {
-
-class MessageServiceController {
-public:
- MessageServiceController(/*IRTObject parent*/);
- virtual ~MessageServiceController();
-
- void addMsgSvc(MessageService& msgSvc);
- //raises an exception if the service does not exist for this threadID
- MessageService* getMsgSvc(int threadID);
-
- void addAsyncActor(IEventReceiver& evtReceiver);
- void pollAsyncActors();
-
- //the connectAll method connects all messageServices
- //it is included for test purposes
- //currently it is not called
- void connectAll();
- void start(bool singlethreaded);
- void stop(bool singlethreaded);
-
- //TODO: this is only for single threaded configurations
- void runOnce();
-
- /**
- * waitTerminate waits blocking for all MessageServices to terminate
- * ! not threadsafe !
- */
- void waitTerminate();
-
-protected:
- void dumpThreads(std::string msg);
-
-private:
- void terminate();
-
- MessageServiceController(const MessageServiceController& right);
- MessageServiceController& operator=(const MessageServiceController& right);
-
-
- std::vector<MessageService*> m_messageServiceList;
- // IRTObject parent = null;
- bool m_running;
-
-};
-
-} /* namespace etRuntime */
-#endif /* MESSAGESERVICECONTROLLER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MESSAGESERVICECONTROLLER_H_
+#define MESSAGESERVICECONTROLLER_H_
+
+#include "common/messaging/MessageService.h"
+#include "common/messaging/RTServices.h"
+#include <vector>
+#include <string>
+#include <iostream>
+#include <algorithm>
+
+namespace etRuntime {
+
+class MessageServiceController {
+public:
+ MessageServiceController(/*IRTObject parent*/);
+ virtual ~MessageServiceController();
+
+ void addMsgSvc(MessageService& msgSvc);
+ //raises an exception if the service does not exist for this threadID
+ MessageService* getMsgSvc(int threadID);
+
+ void addAsyncActor(IEventReceiver& evtReceiver);
+ void pollAsyncActors();
+
+ //the connectAll method connects all messageServices
+ //it is included for test purposes
+ //currently it is not called
+ void connectAll();
+ void start(bool singlethreaded);
+ void stop(bool singlethreaded);
+
+ //TODO: this is only for single threaded configurations
+ void runOnce();
+
+ /**
+ * waitTerminate waits blocking for all MessageServices to terminate
+ * ! not threadsafe !
+ */
+ void waitTerminate();
+
+protected:
+ void dumpThreads(std::string msg);
+
+private:
+ void terminate();
+
+ MessageServiceController(const MessageServiceController& right);
+ MessageServiceController& operator=(const MessageServiceController& right);
+
+
+ std::vector<MessageService*> m_messageServiceList;
+ // IRTObject parent = null;
+ bool m_running;
+
+};
+
+} /* namespace etRuntime */
+#endif /* MESSAGESERVICECONTROLLER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp
index 2ccccb590..68ba311fa 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "RTObject.h"
-
-namespace etRuntime {
-
-RTObject::RTObject() :
- IRTObject(),
- m_parent(0),
- m_name(NO_NAME) ,
- m_instancePath(),
- m_instancePathName()
-{
- setPathNames();
-}
-
-RTObject::RTObject(IRTObject* parent, std::string name) :
- IRTObject(),
- m_parent(parent),
- m_name(name),
- m_instancePath(),
- m_instancePathName()
-{
- setPathNames();
-}
-
-RTObject::RTObject(const RTObject & right) :
- m_parent(right.m_parent),
- m_name(right.m_name),
- m_instancePath(right.m_instancePath),
- m_instancePathName(right.m_instancePathName)
-{
-}
-
-RTObject & RTObject::operator = (RTObject right) {
- std::swap(right, *this);
- return *this;
-}
-
-RTObject::~RTObject() {
- m_parent = 0;
-}
-
-void RTObject::setPathNames() {
- if (m_parent != 0) {
- m_instancePath = m_parent->getInstancePath() + PATH_DELIM + m_name;
- m_instancePathName = m_parent->getInstancePathName() + PATHNAME_DELIM + m_name;
- }
- else {
- m_instancePath = PATH_DELIM + m_name;
- m_instancePathName = PATHNAME_DELIM + m_name;
- }
-}
-
-const std::string& RTObject::getInstancePath() const{
- return m_instancePath;
-}
-
-const std::string& RTObject::getInstancePathName() const{
- return m_instancePathName;
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "RTObject.h"
+
+namespace etRuntime {
+
+RTObject::RTObject() :
+ IRTObject(),
+ m_parent(0),
+ m_name(NO_NAME) ,
+ m_instancePath(),
+ m_instancePathName()
+{
+ setPathNames();
+}
+
+RTObject::RTObject(IRTObject* parent, std::string name) :
+ IRTObject(),
+ m_parent(parent),
+ m_name(name),
+ m_instancePath(),
+ m_instancePathName()
+{
+ setPathNames();
+}
+
+RTObject::RTObject(const RTObject & right) :
+ m_parent(right.m_parent),
+ m_name(right.m_name),
+ m_instancePath(right.m_instancePath),
+ m_instancePathName(right.m_instancePathName)
+{
+}
+
+RTObject & RTObject::operator = (RTObject right) {
+ std::swap(right, *this);
+ return *this;
+}
+
+RTObject::~RTObject() {
+ m_parent = 0;
+}
+
+void RTObject::setPathNames() {
+ if (m_parent != 0) {
+ m_instancePath = m_parent->getInstancePath() + PATH_DELIM + m_name;
+ m_instancePathName = m_parent->getInstancePathName() + PATHNAME_DELIM + m_name;
+ }
+ else {
+ m_instancePath = PATH_DELIM + m_name;
+ m_instancePathName = PATHNAME_DELIM + m_name;
+ }
+}
+
+const std::string& RTObject::getInstancePath() const{
+ return m_instancePath;
+}
+
+const std::string& RTObject::getInstancePathName() const{
+ return m_instancePathName;
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h
index 60266b14f..e70059035 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef RTOBJECT_H_
-#define RTOBJECT_H_
-
-#include <string>
-#include "common/messaging/IRTObject.h"
-
-namespace etRuntime {
-
-class RTObject : public virtual IRTObject{
-public:
- RTObject();
- RTObject(IRTObject* parent, std::string name);
- RTObject(const RTObject & right);
- RTObject & operator = (RTObject right);
-
- virtual ~RTObject();
-
- IRTObject* getParent() const { return m_parent; };
- const std::string& getName() const { return m_name; };
-
- virtual const std::string& getInstancePath() const;
- virtual const std::string& getInstancePathName() const;
-
-private:
- void setPathNames();
-
- IRTObject* m_parent;
- std::string m_name;
- // for speed optimization the instance paths are created at instantiation
- // and used as const ref parameters in the logging methods to avoid copying
- std::string m_instancePath;
- std::string m_instancePathName;
-
-};
-
-} /* namespace etRuntime */
-#endif /* RTOBJECT_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef RTOBJECT_H_
+#define RTOBJECT_H_
+
+#include <string>
+#include "common/messaging/IRTObject.h"
+
+namespace etRuntime {
+
+class RTObject : public virtual IRTObject{
+public:
+ RTObject();
+ RTObject(IRTObject* parent, std::string name);
+ RTObject(const RTObject & right);
+ RTObject & operator = (RTObject right);
+
+ virtual ~RTObject();
+
+ IRTObject* getParent() const { return m_parent; };
+ const std::string& getName() const { return m_name; };
+
+ virtual const std::string& getInstancePath() const;
+ virtual const std::string& getInstancePathName() const;
+
+private:
+ void setPathNames();
+
+ IRTObject* m_parent;
+ std::string m_name;
+ // for speed optimization the instance paths are created at instantiation
+ // and used as const ref parameters in the logging methods to avoid copying
+ std::string m_instancePath;
+ std::string m_instancePathName;
+
+};
+
+} /* namespace etRuntime */
+#endif /* RTOBJECT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp
index 0d7ad9865..6aa7b5656 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "RTServices.h"
-
-namespace etRuntime {
-
-RTServices* RTServices::s_instance = 0;
-
-RTServices::RTServices()
- : m_subSystem(0),
- m_messageServiceController( new MessageServiceController())
-{
-}
-
-RTServices::~RTServices() {
- // TODO Auto-generated destructor stub
-}
-
-void RTServices::destroy() {
- // TODO: also clean up all sub elements
- m_subSystem = 0;
- m_messageServiceController = 0;
- //TODO is delete necessary here??
- //delete s_instance;
- s_instance = 0;
-}
-
-MessageServiceController& RTServices::getMsgSvcCtrl() {
- //TODO
- //assert(m_messageServiceController != 0);
- return *m_messageServiceController;
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "RTServices.h"
+
+namespace etRuntime {
+
+RTServices* RTServices::s_instance = 0;
+
+RTServices::RTServices()
+ : m_subSystem(0),
+ m_messageServiceController( new MessageServiceController())
+{
+}
+
+RTServices::~RTServices() {
+ // TODO Auto-generated destructor stub
+}
+
+void RTServices::destroy() {
+ // TODO: also clean up all sub elements
+ m_subSystem = 0;
+ m_messageServiceController = 0;
+ //TODO is delete necessary here??
+ //delete s_instance;
+ s_instance = 0;
+}
+
+MessageServiceController& RTServices::getMsgSvcCtrl() {
+ //TODO
+ //assert(m_messageServiceController != 0);
+ return *m_messageServiceController;
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h
index 8bebd49c4..fe9c36395 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef RTSERVICES_H_
-#define RTSERVICES_H_
-#include "common/messaging/MessageServiceController.h"
-
-namespace etRuntime {
-
-class SubSystemClassBase;
-class MessageServiceController;
-
-
-class RTServices {
-public:
- virtual ~RTServices();
-
- static RTServices& getInstance() {
- if (s_instance == 0) {
- s_instance = new RTServices();
- }
- return *s_instance;
- }
-
- void destroy();
- MessageServiceController& getMsgSvcCtrl();
- SubSystemClassBase* getSubSystem() { return m_subSystem; };
- void setSubSystem(SubSystemClassBase* subSystem) { m_subSystem = subSystem; };
-
-private:
- static RTServices* s_instance;
-
- SubSystemClassBase* m_subSystem;
- MessageServiceController* m_messageServiceController;
-
- RTServices();
- RTServices(const RTServices & right);
- RTServices & operator = (const RTServices& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* RTSERVICES_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef RTSERVICES_H_
+#define RTSERVICES_H_
+#include "common/messaging/MessageServiceController.h"
+
+namespace etRuntime {
+
+class SubSystemClassBase;
+class MessageServiceController;
+
+
+class RTServices {
+public:
+ virtual ~RTServices();
+
+ static RTServices& getInstance() {
+ if (s_instance == 0) {
+ s_instance = new RTServices();
+ }
+ return *s_instance;
+ }
+
+ void destroy();
+ MessageServiceController& getMsgSvcCtrl();
+ SubSystemClassBase* getSubSystem() { return m_subSystem; };
+ void setSubSystem(SubSystemClassBase* subSystem) { m_subSystem = subSystem; };
+
+private:
+ static RTServices* s_instance;
+
+ SubSystemClassBase* m_subSystem;
+ MessageServiceController* m_messageServiceController;
+
+ RTServices();
+ RTServices(const RTServices & right);
+ RTServices & operator = (const RTServices& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* RTSERVICES_H_ */
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 963340860..34ab12c46 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
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "RTSystemServicesProtocol.h"
-#include "common/debugging/DebuggingService.h"
-
-namespace etRuntime {
-
-std::string RTSystemServicesProtocol::s_messageStrings[] =
- { "MIN",
- "dummy",
- "executeInitialTransition",
- "startDebugging",
- "stopDebugging",
- "MAX"};
-
-std::string RTSystemServicesProtocol::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() {
-}
-
-
-//------------------------------------------------------------------
-// RTSystemServicesProtocolPort
-//------------------------------------------------------------------
-
-RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
- int localId, Address addr, Address peerAddress, bool doRegistration)
-:PortBase(actor, parent, name, localId, 0, addr, peerAddress)
-{
- if (doRegistration) {
- DebuggingService::getInstance().addPortInstance(*this);
- }
-};
-
-RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
- int localId, int idx, Address addr, Address peerAddress, bool doRegistration)
-: PortBase(actor, parent, name, localId, idx, addr, peerAddress)
-{
- if (doRegistration) {
- DebuggingService::getInstance().addPortInstance(*this);
- }
-};
-
-void RTSystemServicesProtocolPort::receive(Message* msg) {
- if (! RTSystemServicesProtocol::isValidIncomingEvtID(msg->getEvtId())) {
- std::cout << "unknown" << std::endl;
- }
- else {
- if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag
- DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId()));
- }
- getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData());
- }
-};
-
-// sent messages
-
-void RTSystemServicesProtocolPort::dummy() {
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
- RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::OUT_dummy));
- PortBase::send(RTSystemServicesProtocol::OUT_dummy);
-};
-
-//------------------------------------------------------------------
-// RTSystemServicesProtocolPortRepl
-//------------------------------------------------------------------
-
-
-RTSystemServicesProtocolPortRepl::
-RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address> peerAddress)
-: m_replication(addr.size()),
- m_ports()
-{
- char numstr[10]; // enough to hold all numbers up to 32-bits
-
- //m_ports.reserve(m_replication);
- m_ports = reinterpret_cast<RTSystemServicesProtocolPort*> (new char[sizeof(RTSystemServicesProtocolPort) * addr.size()]);
-
- for (int i = 0; i < m_replication; ++i) {
- snprintf(numstr, sizeof(numstr), "%d", i);
- new (&m_ports[i]) RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);
-
- //m_ports.push_back(std::auto_ptr_ref<RTSystemServicesProtocolPort>(new RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i], false)));
- //m_ports[i] = std::auto_ptr<RTSystemServicesProtocolPort>(new RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]));
- }
-// for (int i = 0; i < m_replication; ++i) {
-// DebuggingService::getInstance().addPortInstance(m_ports.at(i));
-// }
-
-};
-
-// outgoing messages
-
-void RTSystemServicesProtocolPortRepl::dummy() {
- for (int i = 0; i < m_replication; ++i) {
- m_ports[i].dummy();
- }
-};
-
-//------------------------------------------------------------------
-// RTSystemServicesProtocolConjPort
-//------------------------------------------------------------------
-
-RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
- std::string name, int localId, Address addr, Address peerAddress, bool doRegistration)
- : PortBase(actor, parent, name, localId, 0, addr, peerAddress)
-{
- if (doRegistration) {
- DebuggingService::getInstance().addPortInstance(*this);
- }
-}
-RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
- std::string name, int localId, int idx, Address addr,
- Address peerAddress, bool doRegistration)
-: PortBase(actor, parent, name, localId, idx, addr, peerAddress)
-{
- if (doRegistration) {
- DebuggingService::getInstance().addPortInstance(*this);
- }
-}
-
-void RTSystemServicesProtocolConjPort::receive(Message* msg) {
- if (! RTSystemServicesProtocol::isValidOutgoingEvtID(msg->getEvtId())) { //conjugated port receives out-messages
- std::cout << "unknown" << std::endl;
- }
- else {
- if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag
- DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId()));
- }
- getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData());
- }
-}
-
-// sent messages
-
-void RTSystemServicesProtocolConjPort::executeInitialTransition() {
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
- RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_executeInitialTransition));
- PortBase::send(RTSystemServicesProtocol::IN_executeInitialTransition);
-}
-
-void RTSystemServicesProtocolConjPort::startDebugging() {
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
- RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_startDebugging));
- PortBase::send(RTSystemServicesProtocol::IN_startDebugging);
-}
-
-void RTSystemServicesProtocolConjPort::stopDebugging() {
- DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
- RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_stopDebugging));
- PortBase::send(RTSystemServicesProtocol::IN_stopDebugging);
-}
-
-//------------------------------------------------------------------
-// RTSystemServicesProtocolConjPortRepl
-//------------------------------------------------------------------
-
-RTSystemServicesProtocolConjPortRepl::
-RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address>& peerAddress)
-: m_replication(addr.size()),
- m_ports()
-{
- char numstr[10]; // enough to hold all numbers up to 32-bits
- m_ports = reinterpret_cast<RTSystemServicesProtocolConjPort*> (new char[sizeof(RTSystemServicesProtocolConjPort) * addr.size()]);
- for (int i = 0; i < m_replication; ++i) {
- snprintf(numstr, sizeof(numstr), "%d", i);
- //placement new to avoid copy construction, therefore no vector is used
- new (&m_ports[i]) RTSystemServicesProtocolConjPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);
- }
-
-};
-
-// sent messages
-
-void RTSystemServicesProtocolConjPortRepl::executeInitialTransition() {
- for (int i = 0; i < m_replication; ++i) {
- m_ports[i].executeInitialTransition();
- }
-}
-
-void RTSystemServicesProtocolConjPortRepl::startDebugging() {
- for (int i = 0; i < m_replication; ++i) {
- m_ports[i].startDebugging();
- }
-}
-
-void RTSystemServicesProtocolConjPortRepl::stopDebugging() {
- for (int i = 0; i < m_replication; ++i) {
- m_ports[i].stopDebugging();
- }
-}
-
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "RTSystemServicesProtocol.h"
+#include "common/debugging/DebuggingService.h"
+
+namespace etRuntime {
+
+std::string RTSystemServicesProtocol::s_messageStrings[] =
+ { "MIN",
+ "dummy",
+ "executeInitialTransition",
+ "startDebugging",
+ "stopDebugging",
+ "MAX"};
+
+std::string RTSystemServicesProtocol::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() {
+}
+
+
+//------------------------------------------------------------------
+// RTSystemServicesProtocolPort
+//------------------------------------------------------------------
+
+RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
+ int localId, Address addr, Address peerAddress, bool doRegistration)
+:PortBase(actor, parent, name, localId, 0, addr, peerAddress)
+{
+ if (doRegistration) {
+ DebuggingService::getInstance().addPortInstance(*this);
+ }
+};
+
+RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
+ int localId, int idx, Address addr, Address peerAddress, bool doRegistration)
+: PortBase(actor, parent, name, localId, idx, addr, peerAddress)
+{
+ if (doRegistration) {
+ DebuggingService::getInstance().addPortInstance(*this);
+ }
+};
+
+void RTSystemServicesProtocolPort::receive(Message* msg) {
+ if (! RTSystemServicesProtocol::isValidIncomingEvtID(msg->getEvtId())) {
+ std::cout << "unknown" << std::endl;
+ }
+ else {
+ if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag
+ DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId()));
+ }
+ getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData());
+ }
+};
+
+// sent messages
+
+void RTSystemServicesProtocolPort::dummy() {
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::OUT_dummy));
+ PortBase::send(RTSystemServicesProtocol::OUT_dummy);
+};
+
+//------------------------------------------------------------------
+// RTSystemServicesProtocolPortRepl
+//------------------------------------------------------------------
+
+
+RTSystemServicesProtocolPortRepl::
+RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address> peerAddress)
+: m_replication(addr.size()),
+ m_ports()
+{
+ char numstr[10]; // enough to hold all numbers up to 32-bits
+
+ //m_ports.reserve(m_replication);
+ m_ports = reinterpret_cast<RTSystemServicesProtocolPort*> (new char[sizeof(RTSystemServicesProtocolPort) * addr.size()]);
+
+ for (int i = 0; i < m_replication; ++i) {
+ snprintf(numstr, sizeof(numstr), "%d", i);
+ new (&m_ports[i]) RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);
+
+ //m_ports.push_back(std::auto_ptr_ref<RTSystemServicesProtocolPort>(new RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i], false)));
+ //m_ports[i] = std::auto_ptr<RTSystemServicesProtocolPort>(new RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]));
+ }
+// for (int i = 0; i < m_replication; ++i) {
+// DebuggingService::getInstance().addPortInstance(m_ports.at(i));
+// }
+
+};
+
+// outgoing messages
+
+void RTSystemServicesProtocolPortRepl::dummy() {
+ for (int i = 0; i < m_replication; ++i) {
+ m_ports[i].dummy();
+ }
+};
+
+//------------------------------------------------------------------
+// RTSystemServicesProtocolConjPort
+//------------------------------------------------------------------
+
+RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
+ std::string name, int localId, Address addr, Address peerAddress, bool doRegistration)
+ : PortBase(actor, parent, name, localId, 0, addr, peerAddress)
+{
+ if (doRegistration) {
+ DebuggingService::getInstance().addPortInstance(*this);
+ }
+}
+RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
+ std::string name, int localId, int idx, Address addr,
+ Address peerAddress, bool doRegistration)
+: PortBase(actor, parent, name, localId, idx, addr, peerAddress)
+{
+ if (doRegistration) {
+ DebuggingService::getInstance().addPortInstance(*this);
+ }
+}
+
+void RTSystemServicesProtocolConjPort::receive(Message* msg) {
+ if (! RTSystemServicesProtocol::isValidOutgoingEvtID(msg->getEvtId())) { //conjugated port receives out-messages
+ std::cout << "unknown" << std::endl;
+ }
+ else {
+ if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag
+ DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId()));
+ }
+ getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData());
+ }
+}
+
+// sent messages
+
+void RTSystemServicesProtocolConjPort::executeInitialTransition() {
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_executeInitialTransition));
+ PortBase::send(RTSystemServicesProtocol::IN_executeInitialTransition);
+}
+
+void RTSystemServicesProtocolConjPort::startDebugging() {
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_startDebugging));
+ PortBase::send(RTSystemServicesProtocol::IN_startDebugging);
+}
+
+void RTSystemServicesProtocolConjPort::stopDebugging() {
+ DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
+ RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_stopDebugging));
+ PortBase::send(RTSystemServicesProtocol::IN_stopDebugging);
+}
+
+//------------------------------------------------------------------
+// RTSystemServicesProtocolConjPortRepl
+//------------------------------------------------------------------
+
+RTSystemServicesProtocolConjPortRepl::
+RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address>& peerAddress)
+: m_replication(addr.size()),
+ m_ports()
+{
+ char numstr[10]; // enough to hold all numbers up to 32-bits
+ m_ports = reinterpret_cast<RTSystemServicesProtocolConjPort*> (new char[sizeof(RTSystemServicesProtocolConjPort) * addr.size()]);
+ for (int i = 0; i < m_replication; ++i) {
+ snprintf(numstr, sizeof(numstr), "%d", i);
+ //placement new to avoid copy construction, therefore no vector is used
+ new (&m_ports[i]) RTSystemServicesProtocolConjPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);
+ }
+
+};
+
+// sent messages
+
+void RTSystemServicesProtocolConjPortRepl::executeInitialTransition() {
+ for (int i = 0; i < m_replication; ++i) {
+ m_ports[i].executeInitialTransition();
+ }
+}
+
+void RTSystemServicesProtocolConjPortRepl::startDebugging() {
+ for (int i = 0; i < m_replication; ++i) {
+ m_ports[i].startDebugging();
+ }
+}
+
+void RTSystemServicesProtocolConjPortRepl::stopDebugging() {
+ for (int i = 0; i < m_replication; ++i) {
+ m_ports[i].stopDebugging();
+ }
+}
+
+
+} /* namespace etRuntime */
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 ccdb38876..d2646df61 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
@@ -1,148 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef RTSYSTEMSERVICESPROTOCOL_H_
-#define RTSYSTEMSERVICESPROTOCOL_H_
-
-#include "common/modelbase/PortBase.h"
-#include "common/modelbase/IEventReceiver.h"
-#include "common/messaging/Address.h"
-#include <vector>
-#include <string>
-#include <memory>
-
-namespace etRuntime {
-
-//---------------------------------------------------
-// interface for port class
-//---------------------------------------------------
-class IRTSystemServicesProtocolPort {
-public:
- virtual ~IRTSystemServicesProtocolPort() {};
- virtual void dummy() = 0;
-};
-
-//---------------------------------------------------
-// interface for conjugated port class
-//---------------------------------------------------
-class IRTSystemServicesProtocolConjPort {
-public:
- virtual ~IRTSystemServicesProtocolConjPort() {};
- virtual void executeInitialTransition() = 0;
- virtual void startDebugging() = 0;
- virtual void stopDebugging() = 0;
-};
-
-
-class RTSystemServicesProtocol {
-public:
- enum eventIDs {
- MSG_MIN = 0,
- OUT_dummy = 1,
- MSG_SEP = 2,
- IN_executeInitialTransition = 2,
- IN_startDebugging = 3,
- IN_stopDebugging = 4,
- MSG_MAX = 5
- };
- static bool isValidEvtID(int evtId) {
- return ((MSG_MIN < evtId) && (evtId < MSG_MAX));
- };
- static bool isValidOutgoingEvtID(int evtId) {
- return ((MSG_MIN < evtId) && (evtId < MSG_SEP));
- };
- static bool isValidIncomingEvtID(int evtId) {
- return ((MSG_SEP <= evtId) && (evtId < MSG_MAX));
- };
- static std::string getMessageString(int msg_id);
-
- private:
- static std::string s_messageStrings[];
-
- RTSystemServicesProtocol();
- virtual ~RTSystemServicesProtocol();
-};
-
- //---------------------------------------------------
- // port class
- //---------------------------------------------------
- class RTSystemServicesProtocolPort : public PortBase , public IRTSystemServicesProtocolPort {
- public:
- RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
- int localId, Address addr, Address peerAddress, bool doRegistration = true);
-
- RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
- int localId, int idx, Address addr, Address peerAddress, bool doRegistration = true);
-
- virtual void receive(Message* m);
- // sent messages
- void dummy();
- };
-
- //---------------------------------------------------
- // replicated port class
- //---------------------------------------------------
- class RTSystemServicesProtocolPortRepl: public IRTSystemServicesProtocolPort {
- private:
- int m_replication;
- RTSystemServicesProtocolPort* m_ports;
-
- public:
- 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[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, bool doRegistration = true);
- RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
- std::string name, int localId, int idx, Address addr,
- Address peerAddress, bool doRegistration = true);
-
- virtual void receive(Message* m);
- void executeInitialTransition();
- void startDebugging();
- void stopDebugging();
- };
-
- //---------------------------------------------------
- // replicated conjugated port class
- //---------------------------------------------------
- class RTSystemServicesProtocolConjPortRepl : public IRTSystemServicesProtocolConjPort{
- private:
- int m_replication;
- RTSystemServicesProtocolConjPort* m_ports; //dynamic array used instead of vector to avoid copy construction
-
- public:
- 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[i]; };
-
- void executeInitialTransition();
- void startDebugging();
- void stopDebugging();
- };
-
-} /* namespace etRuntime */
-#endif /* RTSYSTEMSERVICESPROTOCOL_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef RTSYSTEMSERVICESPROTOCOL_H_
+#define RTSYSTEMSERVICESPROTOCOL_H_
+
+#include "common/modelbase/PortBase.h"
+#include "common/modelbase/IEventReceiver.h"
+#include "common/messaging/Address.h"
+#include <vector>
+#include <string>
+#include <memory>
+
+namespace etRuntime {
+
+//---------------------------------------------------
+// interface for port class
+//---------------------------------------------------
+class IRTSystemServicesProtocolPort {
+public:
+ virtual ~IRTSystemServicesProtocolPort() {};
+ virtual void dummy() = 0;
+};
+
+//---------------------------------------------------
+// interface for conjugated port class
+//---------------------------------------------------
+class IRTSystemServicesProtocolConjPort {
+public:
+ virtual ~IRTSystemServicesProtocolConjPort() {};
+ virtual void executeInitialTransition() = 0;
+ virtual void startDebugging() = 0;
+ virtual void stopDebugging() = 0;
+};
+
+
+class RTSystemServicesProtocol {
+public:
+ enum eventIDs {
+ MSG_MIN = 0,
+ OUT_dummy = 1,
+ MSG_SEP = 2,
+ IN_executeInitialTransition = 2,
+ IN_startDebugging = 3,
+ IN_stopDebugging = 4,
+ MSG_MAX = 5
+ };
+ static bool isValidEvtID(int evtId) {
+ return ((MSG_MIN < evtId) && (evtId < MSG_MAX));
+ };
+ static bool isValidOutgoingEvtID(int evtId) {
+ return ((MSG_MIN < evtId) && (evtId < MSG_SEP));
+ };
+ static bool isValidIncomingEvtID(int evtId) {
+ return ((MSG_SEP <= evtId) && (evtId < MSG_MAX));
+ };
+ static std::string getMessageString(int msg_id);
+
+ private:
+ static std::string s_messageStrings[];
+
+ RTSystemServicesProtocol();
+ virtual ~RTSystemServicesProtocol();
+};
+
+ //---------------------------------------------------
+ // port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolPort : public PortBase , public IRTSystemServicesProtocolPort {
+ public:
+ RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
+ int localId, Address addr, Address peerAddress, bool doRegistration = true);
+
+ RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name,
+ int localId, int idx, Address addr, Address peerAddress, bool doRegistration = true);
+
+ virtual void receive(Message* m);
+ // sent messages
+ void dummy();
+ };
+
+ //---------------------------------------------------
+ // replicated port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolPortRepl: public IRTSystemServicesProtocolPort {
+ private:
+ int m_replication;
+ RTSystemServicesProtocolPort* m_ports;
+
+ public:
+ 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[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, bool doRegistration = true);
+ RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent,
+ std::string name, int localId, int idx, Address addr,
+ Address peerAddress, bool doRegistration = true);
+
+ virtual void receive(Message* m);
+ void executeInitialTransition();
+ void startDebugging();
+ void stopDebugging();
+ };
+
+ //---------------------------------------------------
+ // replicated conjugated port class
+ //---------------------------------------------------
+ class RTSystemServicesProtocolConjPortRepl : public IRTSystemServicesProtocolConjPort{
+ private:
+ int m_replication;
+ RTSystemServicesProtocolConjPort* m_ports; //dynamic array used instead of vector to avoid copy construction
+
+ public:
+ 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[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 3c8c872cf..6cfc0cc92 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
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "ActorClassBase.h"
-
-namespace etRuntime {
-
-ActorClassBase::ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr)
- : EventReceiver(parent, name),
- IMessageReceiver(),
- m_state(0),
- history(0), //to be instantiated by derived class
- m_RTSystemPort(0),
- m_className("noname"),
- m_ownAddr(ownAddr),
- m_ownMsgsvc(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddr.m_threadID)) {
-
- // own ports
- m_RTSystemPort = new RTSystemServicesProtocolPort(*this, this, "RTSystemPort", 0, 0, ownAddr,
- systemPortPeerAddr);
-}
-
-ActorClassBase::~ActorClassBase() {
- delete m_RTSystemPort;
- m_RTSystemPort = 0;
- delete history;
- history = 0;
-}
-
-bool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {
- if ((ifitem != 0) && (ifitem->getLocalId() != 0)) {
- return false;
- }
-
- switch (evt) {
- case RTSystemServicesProtocol::IN_executeInitialTransition:
- executeInitTransition();
- break;
- case RTSystemServicesProtocol::IN_startDebugging:
- break;
- case RTSystemServicesProtocol::IN_stopDebugging:
- break;
- default:
- return false;
- }
- return true;
-}
-
-std::string ActorClassBase::toString() {
- return "ActorClass(className=" + m_className + ", instancePath=" + getInstancePath() + ")";
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "ActorClassBase.h"
+
+namespace etRuntime {
+
+ActorClassBase::ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr)
+ : EventReceiver(parent, name),
+ IMessageReceiver(),
+ m_state(0),
+ history(0), //to be instantiated by derived class
+ m_RTSystemPort(0),
+ m_className("noname"),
+ m_ownAddr(ownAddr),
+ m_ownMsgsvc(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddr.m_threadID)) {
+
+ // own ports
+ m_RTSystemPort = new RTSystemServicesProtocolPort(*this, this, "RTSystemPort", 0, 0, ownAddr,
+ systemPortPeerAddr);
+}
+
+ActorClassBase::~ActorClassBase() {
+ delete m_RTSystemPort;
+ m_RTSystemPort = 0;
+ delete history;
+ history = 0;
+}
+
+bool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {
+ if ((ifitem != 0) && (ifitem->getLocalId() != 0)) {
+ return false;
+ }
+
+ switch (evt) {
+ case RTSystemServicesProtocol::IN_executeInitialTransition:
+ executeInitTransition();
+ break;
+ case RTSystemServicesProtocol::IN_startDebugging:
+ break;
+ case RTSystemServicesProtocol::IN_stopDebugging:
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+std::string ActorClassBase::toString() {
+ return "ActorClass(className=" + m_className + ", instancePath=" + getInstancePath() + ")";
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h
index 30b0d3399..3efca3121 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef ACTORCLASSBASE_H_
-#define ACTORCLASSBASE_H_
-
-#include "common/modelbase/EventReceiver.h"
-#include "common/messaging/IMessageReceiver.h"
-#include "common/messaging/RTServices.h"
-#include "common/messaging/RTSystemServicesProtocol.h"
-
-namespace etRuntime {
-
-class ActorClassBase: public EventReceiver, public IMessageReceiver {
-public:
- ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr);
- virtual ~ActorClassBase();
-
- std::string toString();
- std::string getClassName() const { return m_className; }
- void setClassName(std::string className) { m_className = className; }
- virtual Address getAddress() const {
- // TODO: Actor should have its own address for services and debugging
- return Address(0,0,0);
- }
-
- //--------------------- lifecycle functions
- // automatically generated lifecycle functions
- virtual void init() = 0;
- virtual void start() = 0;
- virtual void stop() = 0;
- virtual void destroy() = 0;
- virtual void executeInitTransition() = 0;
-
- // not automatically generated lifecycle functions
- // are called, but with empty implementation -> can be overridden by user
- void initUser() { }
- void startUser() { }
- void stopUser() { }
- void destroyUser() { }
- virtual void receive(Message* msg) { }
-
- int getState() const { return m_state; }
- MessageService* getMsgsvc() const { return m_ownMsgsvc; }
-
-protected:
- static const int EVT_SHIFT = 1000; // TODOHRR: use 256 or shift operation later
- static const int NO_STATE = 0;
- static const int STATE_TOP = 1;
- static const int NOT_CAUGHT = 0;
-
- /**
- * the current state
- */
- int m_state;
- int* history; //Todo pka: name is not prefixed by m_ because generic generator uses this member
-
- RTSystemServicesProtocolPort* m_RTSystemPort;
-
- virtual bool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data);
-private:
- std::string m_className;
- Address m_ownAddr;
- MessageService* m_ownMsgsvc;
-
-};
-
-} /* namespace etRuntime */
-#endif /* ACTORCLASSBASE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef ACTORCLASSBASE_H_
+#define ACTORCLASSBASE_H_
+
+#include "common/modelbase/EventReceiver.h"
+#include "common/messaging/IMessageReceiver.h"
+#include "common/messaging/RTServices.h"
+#include "common/messaging/RTSystemServicesProtocol.h"
+
+namespace etRuntime {
+
+class ActorClassBase: public EventReceiver, public IMessageReceiver {
+public:
+ ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr);
+ virtual ~ActorClassBase();
+
+ std::string toString();
+ std::string getClassName() const { return m_className; }
+ void setClassName(std::string className) { m_className = className; }
+ virtual Address getAddress() const {
+ // TODO: Actor should have its own address for services and debugging
+ return Address(0,0,0);
+ }
+
+ //--------------------- lifecycle functions
+ // automatically generated lifecycle functions
+ virtual void init() = 0;
+ virtual void start() = 0;
+ virtual void stop() = 0;
+ virtual void destroy() = 0;
+ virtual void executeInitTransition() = 0;
+
+ // not automatically generated lifecycle functions
+ // are called, but with empty implementation -> can be overridden by user
+ void initUser() { }
+ void startUser() { }
+ void stopUser() { }
+ void destroyUser() { }
+ virtual void receive(Message* msg) { }
+
+ int getState() const { return m_state; }
+ MessageService* getMsgsvc() const { return m_ownMsgsvc; }
+
+protected:
+ static const int EVT_SHIFT = 1000; // TODOHRR: use 256 or shift operation later
+ static const int NO_STATE = 0;
+ static const int STATE_TOP = 1;
+ static const int NOT_CAUGHT = 0;
+
+ /**
+ * the current state
+ */
+ int m_state;
+ int* history; //Todo pka: name is not prefixed by m_ because generic generator uses this member
+
+ RTSystemServicesProtocolPort* m_RTSystemPort;
+
+ virtual bool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data);
+private:
+ std::string m_className;
+ Address m_ownAddr;
+ MessageService* m_ownMsgsvc;
+
+};
+
+} /* namespace etRuntime */
+#endif /* ACTORCLASSBASE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp
index 10c0a59d7..818229e9f 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "EventReceiver.h"
-
-namespace etRuntime {
-
-
-EventReceiver::~EventReceiver() {
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "EventReceiver.h"
+
+namespace etRuntime {
+
+
+EventReceiver::~EventReceiver() {
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h
index 1bb699617..6a2dfae38 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef EVENTRECEIVER_H_
-#define EVENTRECEIVER_H_
-
-#include "common/messaging/RTObject.h"
-#include "common/modelbase/IEventReceiver.h"
-#include <string>
-
-namespace etRuntime {
-
-class EventReceiver : public RTObject, public IEventReceiver{
-public:
- EventReceiver(IRTObject* parent, std::string name)
- : RTObject(parent, name),
- IEventReceiver()
- {};
- virtual ~EventReceiver();
-
-private:
- EventReceiver();
- EventReceiver(const EventReceiver& right);
- EventReceiver& operator=(const EventReceiver& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* EVENTRECEIVER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef EVENTRECEIVER_H_
+#define EVENTRECEIVER_H_
+
+#include "common/messaging/RTObject.h"
+#include "common/modelbase/IEventReceiver.h"
+#include <string>
+
+namespace etRuntime {
+
+class EventReceiver : public RTObject, public IEventReceiver{
+public:
+ EventReceiver(IRTObject* parent, std::string name)
+ : RTObject(parent, name),
+ IEventReceiver()
+ {};
+ virtual ~EventReceiver();
+
+private:
+ EventReceiver();
+ EventReceiver(const EventReceiver& right);
+ EventReceiver& operator=(const EventReceiver& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* EVENTRECEIVER_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 558ec8e9f..c0051f968 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
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "IEventReceiver.h"
-
-namespace etRuntime {
-
-IEventReceiver::IEventReceiver() {
-}
-
-IEventReceiver::~IEventReceiver() {
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "IEventReceiver.h"
+
+namespace etRuntime {
+
+IEventReceiver::IEventReceiver() {
+}
+
+IEventReceiver::~IEventReceiver() {
+}
+
+} /* 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 7b75e68f8..627195838 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
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef IEVENTRECEIVER_H_
-#define IEVENTRECEIVER_H_
-
-#include "common/messaging/IRTObject.h"
-
-namespace etRuntime {
- class InterfaceItemBase;
-
-class IEventReceiver {
-public:
- IEventReceiver();
- virtual ~IEventReceiver();
-
- virtual void receiveEvent(InterfaceItemBase* ifitem, int evt, void* data) = 0;
-
-};
-
-} /* namespace etRuntime */
-#endif /* IEVENTRECEIVER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef IEVENTRECEIVER_H_
+#define IEVENTRECEIVER_H_
+
+#include "common/messaging/IRTObject.h"
+
+namespace etRuntime {
+ class InterfaceItemBase;
+
+class IEventReceiver {
+public:
+ IEventReceiver();
+ virtual ~IEventReceiver();
+
+ virtual void receiveEvent(InterfaceItemBase* ifitem, int evt, void* data) = 0;
+
+};
+
+} /* 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 5560db077..c689f5feb 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
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "InterfaceItemBase.h"
-#include "common/messaging/AbstractMessageReceiver.h"
-#include "common/messaging/RTServices.h"
-
-namespace etRuntime {
-
-InterfaceItemBase::InterfaceItemBase (IEventReceiver& evtReceiver, IRTObject* parent, std::string name, int localId, int idx, Address ownAddress, Address peerAddress)
-: AbstractMessageReceiver(parent, ownAddress, name),
- m_idx(idx),
- m_localId(localId),
- m_actorPath(name),
- m_peerAddress(peerAddress),
- m_ownMsgReceiver(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddress.m_threadID)),
- m_peerMsgReceiver(peerAddress.isValid()? RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(peerAddress.m_threadID): 0),
- m_eventReceiver(&evtReceiver)
-{
- if (getAddress().isValid() && m_ownMsgReceiver->isMsgService()) {
- MessageService* ms = static_cast<MessageService*>(m_ownMsgReceiver);
- // register at the own dispatcher to receive messages
- ms->getMessageDispatcher().addMessageReceiver(*this);
- }
- if (parent) {
- m_actorPath = parent->getInstancePath();
- }
-}
-
-InterfaceItemBase::InterfaceItemBase(const InterfaceItemBase & right)
-: AbstractMessageReceiver(right),
- m_idx(right.m_idx),
- m_localId(right.m_localId),
- m_actorPath(right.m_actorPath),
- m_peerAddress(right.m_peerAddress),
- m_ownMsgReceiver(right.m_ownMsgReceiver),
- m_peerMsgReceiver(right.m_peerMsgReceiver),
- m_eventReceiver(right.m_eventReceiver)
-{
-
-}
-
-
-InterfaceItemBase::~InterfaceItemBase() {
- m_ownMsgReceiver = 0;
- m_peerMsgReceiver = 0;
- m_eventReceiver = 0;
-
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "InterfaceItemBase.h"
+#include "common/messaging/AbstractMessageReceiver.h"
+#include "common/messaging/RTServices.h"
+
+namespace etRuntime {
+
+InterfaceItemBase::InterfaceItemBase (IEventReceiver& evtReceiver, IRTObject* parent, std::string name, int localId, int idx, Address ownAddress, Address peerAddress)
+: AbstractMessageReceiver(parent, ownAddress, name),
+ m_idx(idx),
+ m_localId(localId),
+ m_actorPath(name),
+ m_peerAddress(peerAddress),
+ m_ownMsgReceiver(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddress.m_threadID)),
+ m_peerMsgReceiver(peerAddress.isValid()? RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(peerAddress.m_threadID): 0),
+ m_eventReceiver(&evtReceiver)
+{
+ if (getAddress().isValid() && m_ownMsgReceiver->isMsgService()) {
+ MessageService* ms = static_cast<MessageService*>(m_ownMsgReceiver);
+ // register at the own dispatcher to receive messages
+ ms->getMessageDispatcher().addMessageReceiver(*this);
+ }
+ if (parent) {
+ m_actorPath = parent->getInstancePath();
+ }
+}
+
+InterfaceItemBase::InterfaceItemBase(const InterfaceItemBase & right)
+: AbstractMessageReceiver(right),
+ m_idx(right.m_idx),
+ m_localId(right.m_localId),
+ m_actorPath(right.m_actorPath),
+ m_peerAddress(right.m_peerAddress),
+ m_ownMsgReceiver(right.m_ownMsgReceiver),
+ m_peerMsgReceiver(right.m_peerMsgReceiver),
+ m_eventReceiver(right.m_eventReceiver)
+{
+
+}
+
+
+InterfaceItemBase::~InterfaceItemBase() {
+ m_ownMsgReceiver = 0;
+ m_peerMsgReceiver = 0;
+ m_eventReceiver = 0;
+
+}
+
+} /* namespace etRuntime */
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 70d977949..70187be3e 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
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef INTERFACEITEMBASE_H_
-#define INTERFACEITEMBASE_H_
-
-#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 : public AbstractMessageReceiver{
-public:
- InterfaceItemBase (IEventReceiver& evtReceiver, IRTObject* parentActor, std::string name, int localId, int idx, Address ownAddress, Address peerAddress);
- InterfaceItemBase(const InterfaceItemBase & right);
- virtual ~InterfaceItemBase();
-
- int getIdx() const { return m_idx; } ;
- IEventReceiver& getEventReceiver() { return *m_eventReceiver; };
- std::string& getActorPath() { return m_actorPath; };
- int getLocalId() const {return m_localId; };
-
- void setMsgReceiver(IMessageReceiver& msgReceiver) { m_ownMsgReceiver = &msgReceiver; };
-
-protected:
- IMessageReceiver* getMsgReceiver() const{ return m_ownMsgReceiver; };
- IMessageReceiver* getPeerMsgReceiver() const { return m_peerMsgReceiver; };
- Address getPeerAddress() const { return m_peerAddress; };
-
-private:
-
- int m_idx;
- int m_localId;
-
- std::string m_actorPath;
-
- Address m_peerAddress;
- IMessageReceiver* m_ownMsgReceiver;
- IMessageReceiver* m_peerMsgReceiver;
- IEventReceiver* m_eventReceiver;
-
- InterfaceItemBase();
- InterfaceItemBase & operator = (const InterfaceItemBase& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* INTERFACEITEMBASE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef INTERFACEITEMBASE_H_
+#define INTERFACEITEMBASE_H_
+
+#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 : public AbstractMessageReceiver{
+public:
+ InterfaceItemBase (IEventReceiver& evtReceiver, IRTObject* parentActor, std::string name, int localId, int idx, Address ownAddress, Address peerAddress);
+ InterfaceItemBase(const InterfaceItemBase & right);
+ virtual ~InterfaceItemBase();
+
+ int getIdx() const { return m_idx; } ;
+ IEventReceiver& getEventReceiver() { return *m_eventReceiver; };
+ std::string& getActorPath() { return m_actorPath; };
+ int getLocalId() const {return m_localId; };
+
+ void setMsgReceiver(IMessageReceiver& msgReceiver) { m_ownMsgReceiver = &msgReceiver; };
+
+protected:
+ IMessageReceiver* getMsgReceiver() const{ return m_ownMsgReceiver; };
+ IMessageReceiver* getPeerMsgReceiver() const { return m_peerMsgReceiver; };
+ Address getPeerAddress() const { return m_peerAddress; };
+
+private:
+
+ int m_idx;
+ int m_localId;
+
+ std::string m_actorPath;
+
+ Address m_peerAddress;
+ IMessageReceiver* m_ownMsgReceiver;
+ IMessageReceiver* m_peerMsgReceiver;
+ IEventReceiver* m_eventReceiver;
+
+ InterfaceItemBase();
+ InterfaceItemBase & operator = (const InterfaceItemBase& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* INTERFACEITEMBASE_H_ */
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 7390106d4..ad880933d 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
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "PortBase.h"
-
-namespace etRuntime {
-
-
-PortBase::~PortBase() {
-}
-
-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 */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "PortBase.h"
+
+namespace etRuntime {
+
+
+PortBase::~PortBase() {
+}
+
+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 2f2fa29e6..9b0e6f04a 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
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef PORTBASE_H_
-#define PORTBASE_H_
-
-#include "common/modelbase/InterfaceItemBase.h"
-#include "common/messaging/Address.h"
-#include <string>
-
-namespace etRuntime {
-class IEventReceiver;
-
-class PortBase : public InterfaceItemBase{
-public:
- PortBase (IEventReceiver& actor, IRTObject* parent, std::string name, int localId, int idx, Address address, Address peerAddress)
- : InterfaceItemBase(actor, parent, name, localId, idx, address, peerAddress){};
- PortBase(const PortBase & right)
- : InterfaceItemBase(right) {};
-
-
- virtual ~PortBase();
-
- virtual void send(int evtID);
-
-
-private:
- PortBase();
- PortBase & operator = (const PortBase& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* PORTBASE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef PORTBASE_H_
+#define PORTBASE_H_
+
+#include "common/modelbase/InterfaceItemBase.h"
+#include "common/messaging/Address.h"
+#include <string>
+
+namespace etRuntime {
+class IEventReceiver;
+
+class PortBase : public InterfaceItemBase{
+public:
+ PortBase (IEventReceiver& actor, IRTObject* parent, std::string name, int localId, int idx, Address address, Address peerAddress)
+ : InterfaceItemBase(actor, parent, name, localId, idx, address, peerAddress){};
+ PortBase(const PortBase & right)
+ : InterfaceItemBase(right) {};
+
+
+ virtual ~PortBase();
+
+ virtual void send(int evtID);
+
+
+private:
+ PortBase();
+ PortBase & operator = (const PortBase& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* PORTBASE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp
index 1a23bbb8e..550dba3dc 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "SubSystemClassBase.h"
-#include "common/messaging/MessageService.h"
-#include "common/messaging/RTServices.h"
-#include "ActorClassBase.h"
-#include "common/debugging/DebuggingService.h"
-
-namespace etRuntime {
-
-
-SubSystemClassBase::~SubSystemClassBase() {
- m_testSem = 0;
- m_RTSystemPort = 0;
-}
-
-SubSystemClassBase::SubSystemClassBase(IRTObject* parent, std::string name)
- : RTObject(parent, name),
- IEventReceiver(),
- m_RTSystemPort(0),
- m_instances(),
- m_testSem(0),
- m_testErrorCode(0)
-{
- DebuggingService::getInstance().getAsyncLogger().setMSC(name + "_Async", "");
- DebuggingService::getInstance().getAsyncLogger().open();
- DebuggingService::getInstance().getSyncLogger().setMSC(name + "_Sync", "");
- DebuggingService::getInstance().getSyncLogger().open();
-
- RTServices::getInstance().setSubSystem(this);
-}
-
-void SubSystemClassBase::init() {
-
- std::cout << "*** MainComponent " << getInstancePath() << "::init ***" << std::endl;
-
- // MessageService
- instantiateMessageServices();
-
- // this is the place to connect the message services if necessary
- // normaly the ports will address the correct target message service directly
- // it is just for test purposes
- // RTServices::getInstance().getMsgSvcCtrl().connectAll();
-
- instantiateActors();
-
- // initialize all actor m_instances
- for (unsigned int i = 0; i < m_instances.size(); i++) {
- m_instances[i]->init();
- }
-}
-
-void SubSystemClassBase::start(bool singlethreaded) {
- // start all actors instances
- m_RTSystemPort->executeInitialTransition();
-
- // start all message services
- RTServices::getInstance().getMsgSvcCtrl().start(singlethreaded);
-
-}
-
-void SubSystemClassBase::stop(bool singlethreaded) {
- std::cout << "*** MainComponent " << this->getInstancePath() << "::stop ***" << std::endl;
-
- RTServices::getInstance().getMsgSvcCtrl().stop(singlethreaded);
- std::cout << "=== done stop MsgSvcCtrl" << std::endl;
-
- // stop all actor instances
- for (unsigned int i = 0; i < m_instances.size(); i++) {
- m_instances[i]->stop();
- }
- std::cout << "=== done stop actor instances" << std::endl;
-}
-
-void SubSystemClassBase::runOnce() {
- // run all message services one time
- RTServices::getInstance().getMsgSvcCtrl().runOnce();
-
-}
-
-void SubSystemClassBase::destroy() {
- std::cout << "*** MainComponent " << this->getInstancePath() << "::destroy ***" << std::endl;
- for (unsigned int i = 0; i < m_instances.size(); i++) {
- m_instances[i]->destroy();
- }
- std::cout << "=== done destroy actor instances" << std::endl;
-
- DebuggingService::getInstance().getAsyncLogger().close();
- DebuggingService::getInstance().getSyncLogger().close();
- std::cout << "=== done close loggers" << std::endl;
-
- RTServices::getInstance().destroy();
- std::cout << "=== done destroy RTServices\n\n\n" << std::endl;
-}
-
-MessageService* SubSystemClassBase::getMsgService(int idx) const {
- return RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(idx);
-}
-
-ActorClassBase* SubSystemClassBase::getInstance(unsigned int i) {
- if (i < 0 || i >= m_instances.size())
- return 0;
-
- return m_instances[i];
-}
-
-ActorClassBase* SubSystemClassBase::getInstance(std::string path) {
- for (unsigned int i = 0; i < m_instances.size(); i++) {
- if (m_instances[i]->getInstancePath() == path)
- return m_instances[i];
- }
-
- return 0;
-}
-
-// this is to run integration tests
-// TODO synchronized
-void SubSystemClassBase::setTestSemaphore(TestSemaphore& sem) {
- m_testErrorCode = -1;
- m_testSem = &sem;
-}
-
-//TODO synchronized
-int SubSystemClassBase::getTestErrorCode() const {
- return m_testErrorCode;
-}
-
-void SubSystemClassBase::testFinished(int errorCode) {
- if (m_testSem != 0) {
- std::cout
- << "org.eclipse.etrice.runtime.cpp.modelbase.SubSystemClassBase.testFinished(int): before releasing semaphore"
- << std::endl;
- //m_testSem.printWaitingThreads();
- //TODO synchronized (this) {
- m_testErrorCode = errorCode;
- m_testSem->give();
- //}
- std::cout
- << "org.eclipse.etrice.runtime.cpp.modelbase.SubSystemClassBase.testFinished(int): semaphore released"
- << std::endl;
- //m_testSem.printWaitingThreads();
- //TODO
- //Thread.yield();
- }
-}
-
-
-} /* namespace etRuntime */
-
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "SubSystemClassBase.h"
+#include "common/messaging/MessageService.h"
+#include "common/messaging/RTServices.h"
+#include "ActorClassBase.h"
+#include "common/debugging/DebuggingService.h"
+
+namespace etRuntime {
+
+
+SubSystemClassBase::~SubSystemClassBase() {
+ m_testSem = 0;
+ m_RTSystemPort = 0;
+}
+
+SubSystemClassBase::SubSystemClassBase(IRTObject* parent, std::string name)
+ : RTObject(parent, name),
+ IEventReceiver(),
+ m_RTSystemPort(0),
+ m_instances(),
+ m_testSem(0),
+ m_testErrorCode(0)
+{
+ DebuggingService::getInstance().getAsyncLogger().setMSC(name + "_Async", "");
+ DebuggingService::getInstance().getAsyncLogger().open();
+ DebuggingService::getInstance().getSyncLogger().setMSC(name + "_Sync", "");
+ DebuggingService::getInstance().getSyncLogger().open();
+
+ RTServices::getInstance().setSubSystem(this);
+}
+
+void SubSystemClassBase::init() {
+
+ std::cout << "*** MainComponent " << getInstancePath() << "::init ***" << std::endl;
+
+ // MessageService
+ instantiateMessageServices();
+
+ // this is the place to connect the message services if necessary
+ // normaly the ports will address the correct target message service directly
+ // it is just for test purposes
+ // RTServices::getInstance().getMsgSvcCtrl().connectAll();
+
+ instantiateActors();
+
+ // initialize all actor m_instances
+ for (unsigned int i = 0; i < m_instances.size(); i++) {
+ m_instances[i]->init();
+ }
+}
+
+void SubSystemClassBase::start(bool singlethreaded) {
+ // start all actors instances
+ m_RTSystemPort->executeInitialTransition();
+
+ // start all message services
+ RTServices::getInstance().getMsgSvcCtrl().start(singlethreaded);
+
+}
+
+void SubSystemClassBase::stop(bool singlethreaded) {
+ std::cout << "*** MainComponent " << this->getInstancePath() << "::stop ***" << std::endl;
+
+ RTServices::getInstance().getMsgSvcCtrl().stop(singlethreaded);
+ std::cout << "=== done stop MsgSvcCtrl" << std::endl;
+
+ // stop all actor instances
+ for (unsigned int i = 0; i < m_instances.size(); i++) {
+ m_instances[i]->stop();
+ }
+ std::cout << "=== done stop actor instances" << std::endl;
+}
+
+void SubSystemClassBase::runOnce() {
+ // run all message services one time
+ RTServices::getInstance().getMsgSvcCtrl().runOnce();
+
+}
+
+void SubSystemClassBase::destroy() {
+ std::cout << "*** MainComponent " << this->getInstancePath() << "::destroy ***" << std::endl;
+ for (unsigned int i = 0; i < m_instances.size(); i++) {
+ m_instances[i]->destroy();
+ }
+ std::cout << "=== done destroy actor instances" << std::endl;
+
+ DebuggingService::getInstance().getAsyncLogger().close();
+ DebuggingService::getInstance().getSyncLogger().close();
+ std::cout << "=== done close loggers" << std::endl;
+
+ RTServices::getInstance().destroy();
+ std::cout << "=== done destroy RTServices\n\n\n" << std::endl;
+}
+
+MessageService* SubSystemClassBase::getMsgService(int idx) const {
+ return RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(idx);
+}
+
+ActorClassBase* SubSystemClassBase::getInstance(unsigned int i) {
+ if (i < 0 || i >= m_instances.size())
+ return 0;
+
+ return m_instances[i];
+}
+
+ActorClassBase* SubSystemClassBase::getInstance(std::string path) {
+ for (unsigned int i = 0; i < m_instances.size(); i++) {
+ if (m_instances[i]->getInstancePath() == path)
+ return m_instances[i];
+ }
+
+ return 0;
+}
+
+// this is to run integration tests
+// TODO synchronized
+void SubSystemClassBase::setTestSemaphore(TestSemaphore& sem) {
+ m_testErrorCode = -1;
+ m_testSem = &sem;
+}
+
+//TODO synchronized
+int SubSystemClassBase::getTestErrorCode() const {
+ return m_testErrorCode;
+}
+
+void SubSystemClassBase::testFinished(int errorCode) {
+ if (m_testSem != 0) {
+ std::cout
+ << "org.eclipse.etrice.runtime.cpp.modelbase.SubSystemClassBase.testFinished(int): before releasing semaphore"
+ << std::endl;
+ //m_testSem.printWaitingThreads();
+ //TODO synchronized (this) {
+ m_testErrorCode = errorCode;
+ m_testSem->give();
+ //}
+ std::cout
+ << "org.eclipse.etrice.runtime.cpp.modelbase.SubSystemClassBase.testFinished(int): semaphore released"
+ << std::endl;
+ //m_testSem.printWaitingThreads();
+ //TODO
+ //Thread.yield();
+ }
+}
+
+
+} /* namespace etRuntime */
+
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h
index 526cc93dd..ed5c8522b 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef SUBSYSTEMCLASSBASE_H_
-#define SUBSYSTEMCLASSBASE_H_
-
-#include "common/messaging/RTSystemServicesProtocol.h"
-#include "common/messaging/IRTObject.h"
-#include "common/debugging/MSCLogger.h"
-#include "common/modelbase/TestSemaphore.h"
-#include <string>
-#include <vector>
-#include <iostream>
-
-namespace etRuntime {
-
-class MessageService;
-class ActorClassBase;
-
-class SubSystemClassBase: public RTObject, public IEventReceiver {
-public:
- SubSystemClassBase(IRTObject* parent, std::string name);
- virtual ~SubSystemClassBase();
-
- void init();
- virtual void instantiateMessageServices() = 0;
- virtual void instantiateActors() = 0;
-
- void start(bool singlethreaded);
- void stop(bool singlethreaded);
- void runOnce();
-
- void destroy();
-
- MessageService* getMsgService(int idx) const;
-
- ActorClassBase* getInstance(unsigned int i);
- ActorClassBase* getInstance(std::string path);
-
- //---------------------------------------------
- // this is to run integration tests
- //---------------------------------------------
- // TODO synchronized
- void setTestSemaphore(TestSemaphore& sem);
- //TODO synchronized
- int getTestErrorCode() const;
- void testFinished(int errorCode);
-
-protected:
- RTSystemServicesProtocolConjPortRepl* m_RTSystemPort;
- //--------------------- interface item IDs
- static const int IFITEM_RTSystemPort = 0;
- std::vector<ActorClassBase*> m_instances;
-private:
- TestSemaphore* m_testSem;
- int m_testErrorCode;
-
- SubSystemClassBase();
- SubSystemClassBase(const SubSystemClassBase& right);
- SubSystemClassBase& operator=(const SubSystemClassBase& right);
-};
-
-} /* namespace etRuntime */
-#endif /* SUBSYSTEMCLASSBASE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef SUBSYSTEMCLASSBASE_H_
+#define SUBSYSTEMCLASSBASE_H_
+
+#include "common/messaging/RTSystemServicesProtocol.h"
+#include "common/messaging/IRTObject.h"
+#include "common/debugging/MSCLogger.h"
+#include "common/modelbase/TestSemaphore.h"
+#include <string>
+#include <vector>
+#include <iostream>
+
+namespace etRuntime {
+
+class MessageService;
+class ActorClassBase;
+
+class SubSystemClassBase: public RTObject, public IEventReceiver {
+public:
+ SubSystemClassBase(IRTObject* parent, std::string name);
+ virtual ~SubSystemClassBase();
+
+ void init();
+ virtual void instantiateMessageServices() = 0;
+ virtual void instantiateActors() = 0;
+
+ void start(bool singlethreaded);
+ void stop(bool singlethreaded);
+ void runOnce();
+
+ void destroy();
+
+ MessageService* getMsgService(int idx) const;
+
+ ActorClassBase* getInstance(unsigned int i);
+ ActorClassBase* getInstance(std::string path);
+
+ //---------------------------------------------
+ // this is to run integration tests
+ //---------------------------------------------
+ // TODO synchronized
+ void setTestSemaphore(TestSemaphore& sem);
+ //TODO synchronized
+ int getTestErrorCode() const;
+ void testFinished(int errorCode);
+
+protected:
+ RTSystemServicesProtocolConjPortRepl* m_RTSystemPort;
+ //--------------------- interface item IDs
+ static const int IFITEM_RTSystemPort = 0;
+ std::vector<ActorClassBase*> m_instances;
+private:
+ TestSemaphore* m_testSem;
+ int m_testErrorCode;
+
+ SubSystemClassBase();
+ SubSystemClassBase(const SubSystemClassBase& right);
+ SubSystemClassBase& operator=(const SubSystemClassBase& right);
+};
+
+} /* namespace etRuntime */
+#endif /* SUBSYSTEMCLASSBASE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp
index 108c7a8a5..9348c0d84 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp
@@ -1,123 +1,123 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "common/modelbase/SubSystemRunnerBase.h"
-#include "common/modelbase/SubSystemClassBase.h"
-#include "common/platform/etTimer.h"
-#include <unistd.h>
-#include <iostream>
-#include <sstream>
-
-namespace etRuntime {
-
-const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST = "-run_as_test";
-const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST_SINGLETHREADED = "-run_as_test_single_threaded";
-const std::string SubSystemRunnerBase::OPTION_RUN_SINGLETHREADED = "-run_single_threaded";
-
-TestSemaphore SubSystemRunnerBase::s_testSem;
-
-SubSystemRunnerBase::SubSystemRunnerBase() {
-}
-
-SubSystemRunnerBase::~SubSystemRunnerBase() {
-}
-
-void SubSystemRunnerBase::run(SubSystemClassBase& mainComponent, int argc, char* argv[] ) {
-
- //etUserEntry(); /* platform specific */
-
- std::cout << "*** T H E B E G I N ***" << std::endl;
-
- bool test = false;
- bool singleThreaded = false;
- int cycles = 100;
-
- for (int i=1; i<argc; ++i) { // omit first argument, which is the program name
- if (SubSystemRunnerBase::OPTION_RUN_AS_TEST.compare(argv[i]) == 0) {
- std::cout << "*** running as test" << std::endl;
- test = true;
- }
- else if (SubSystemRunnerBase::OPTION_RUN_AS_TEST_SINGLETHREADED.compare(argv[i]) == 0) {
-
- singleThreaded = true;
- i++;
- if (i < argc) {
- std::stringstream sstr(argv[i]);
- sstr >> cycles;
- }
- std::cout << "*** running as test singlethreaded " << cycles << " cycles" << std::endl;
- }
- else if (SubSystemRunnerBase::OPTION_RUN_SINGLETHREADED.compare(argv[i]) == 0) {
-
- singleThreaded = true;
- i++;
- if (i < argc) {
- std::stringstream sstr(argv[i]);
- sstr >> cycles;
- }
- std::cout << "*** running singlethreaded " << cycles << " cycles" << std::endl;
- }
- else {
- std::cout << "*** running multithreaded" << std::endl;
- }
- }
-
- if (test)
- mainComponent.setTestSemaphore(s_testSem);
-
- mainComponent.init(); // lifecycle init
- mainComponent.start(singleThreaded); // lifecycle start
-
- // application runs until quit
- if (test) {
- waitForTestcase();
- }
- else if (singleThreaded){
- waitAndPollSingleThreaded(mainComponent, cycles);
- }
- else {
- waitForQuitMultiThreaded();
- }
- // end the lifecycle
- mainComponent.stop(singleThreaded); // lifecycle stop
- mainComponent.destroy(); // lifecycle destroy
-
- std::cout << "*** T H E E N D ***" << std::endl;
-
- //etUserExit(); /* platform specific */
-}
-
-void SubSystemRunnerBase::waitForTestcase() {
- //std::cout << "=== waitForTestcase: before acq. semaphore, thread " << Thread.currentThread().getName() << std::endl;
- s_testSem.take();
- //std::cout << "=== waitForTestcase: after acq. semaphore, thread " << Thread.currentThread().getName() << std::endl;
-}
-
-void SubSystemRunnerBase::waitForQuitMultiThreaded() {
- // waiting for command line input
- std::string token = "";
- std::cout << "type 'quit' to exit" << std::endl;
- while (token != "quit") {
- std::getline(std::cin, token);
- std::cout << "echo: " << token << std::endl;
- }
-}
-
-void SubSystemRunnerBase::waitAndPollSingleThreaded(SubSystemClassBase& mainComponent, int cycles) {
- for (int i=0; i< cycles; ++i) {
- if (etTimer_executeNeeded()) {
- mainComponent.runOnce();
- }
- usleep(100000);
- }
-}
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "common/modelbase/SubSystemRunnerBase.h"
+#include "common/modelbase/SubSystemClassBase.h"
+#include "common/platform/etTimer.h"
+#include <unistd.h>
+#include <iostream>
+#include <sstream>
+
+namespace etRuntime {
+
+const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST = "-run_as_test";
+const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST_SINGLETHREADED = "-run_as_test_single_threaded";
+const std::string SubSystemRunnerBase::OPTION_RUN_SINGLETHREADED = "-run_single_threaded";
+
+TestSemaphore SubSystemRunnerBase::s_testSem;
+
+SubSystemRunnerBase::SubSystemRunnerBase() {
+}
+
+SubSystemRunnerBase::~SubSystemRunnerBase() {
+}
+
+void SubSystemRunnerBase::run(SubSystemClassBase& mainComponent, int argc, char* argv[] ) {
+
+ //etUserEntry(); /* platform specific */
+
+ std::cout << "*** T H E B E G I N ***" << std::endl;
+
+ bool test = false;
+ bool singleThreaded = false;
+ int cycles = 100;
+
+ for (int i=1; i<argc; ++i) { // omit first argument, which is the program name
+ if (SubSystemRunnerBase::OPTION_RUN_AS_TEST.compare(argv[i]) == 0) {
+ std::cout << "*** running as test" << std::endl;
+ test = true;
+ }
+ else if (SubSystemRunnerBase::OPTION_RUN_AS_TEST_SINGLETHREADED.compare(argv[i]) == 0) {
+
+ singleThreaded = true;
+ i++;
+ if (i < argc) {
+ std::stringstream sstr(argv[i]);
+ sstr >> cycles;
+ }
+ std::cout << "*** running as test singlethreaded " << cycles << " cycles" << std::endl;
+ }
+ else if (SubSystemRunnerBase::OPTION_RUN_SINGLETHREADED.compare(argv[i]) == 0) {
+
+ singleThreaded = true;
+ i++;
+ if (i < argc) {
+ std::stringstream sstr(argv[i]);
+ sstr >> cycles;
+ }
+ std::cout << "*** running singlethreaded " << cycles << " cycles" << std::endl;
+ }
+ else {
+ std::cout << "*** running multithreaded" << std::endl;
+ }
+ }
+
+ if (test)
+ mainComponent.setTestSemaphore(s_testSem);
+
+ mainComponent.init(); // lifecycle init
+ mainComponent.start(singleThreaded); // lifecycle start
+
+ // application runs until quit
+ if (test) {
+ waitForTestcase();
+ }
+ else if (singleThreaded){
+ waitAndPollSingleThreaded(mainComponent, cycles);
+ }
+ else {
+ waitForQuitMultiThreaded();
+ }
+ // end the lifecycle
+ mainComponent.stop(singleThreaded); // lifecycle stop
+ mainComponent.destroy(); // lifecycle destroy
+
+ std::cout << "*** T H E E N D ***" << std::endl;
+
+ //etUserExit(); /* platform specific */
+}
+
+void SubSystemRunnerBase::waitForTestcase() {
+ //std::cout << "=== waitForTestcase: before acq. semaphore, thread " << Thread.currentThread().getName() << std::endl;
+ s_testSem.take();
+ //std::cout << "=== waitForTestcase: after acq. semaphore, thread " << Thread.currentThread().getName() << std::endl;
+}
+
+void SubSystemRunnerBase::waitForQuitMultiThreaded() {
+ // waiting for command line input
+ std::string token = "";
+ std::cout << "type 'quit' to exit" << std::endl;
+ while (token != "quit") {
+ std::getline(std::cin, token);
+ std::cout << "echo: " << token << std::endl;
+ }
+}
+
+void SubSystemRunnerBase::waitAndPollSingleThreaded(SubSystemClassBase& mainComponent, int cycles) {
+ for (int i=0; i< cycles; ++i) {
+ if (etTimer_executeNeeded()) {
+ mainComponent.runOnce();
+ }
+ usleep(100000);
+ }
+}
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h
index c2f2ec1c0..971c38cdf 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef SUBSYSTEMRUNNERBASE_H_
-#define SUBSYSTEMRUNNERBASE_H_
-
-#include <iostream>
-#include <string>
-#include "common/modelbase/TestSemaphore.h"
-
-namespace etRuntime {
-
-class SubSystemClassBase;
-
-class SubSystemRunnerBase {
-public:
- SubSystemRunnerBase();
- ~SubSystemRunnerBase();
- static void run(SubSystemClassBase& mainComponent, int argc, char* argv[] );
-
-protected:
- /**
- * blocks until the String "quit" is entered on the console
- */
- static void waitForTestcase();
- static TestSemaphore s_testSem;
-
-private:
- static const std::string OPTION_RUN_AS_TEST;
- static const std::string OPTION_RUN_AS_TEST_SINGLETHREADED;
- static const std::string OPTION_RUN_SINGLETHREADED;
- static void waitForQuitMultiThreaded();
- static void waitAndPollSingleThreaded(SubSystemClassBase& mainComponent, int cycles);
-};
-
-} /* namespace etRuntime */
-#endif /* SUBSYSTEMRUNNERBASE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef SUBSYSTEMRUNNERBASE_H_
+#define SUBSYSTEMRUNNERBASE_H_
+
+#include <iostream>
+#include <string>
+#include "common/modelbase/TestSemaphore.h"
+
+namespace etRuntime {
+
+class SubSystemClassBase;
+
+class SubSystemRunnerBase {
+public:
+ SubSystemRunnerBase();
+ ~SubSystemRunnerBase();
+ static void run(SubSystemClassBase& mainComponent, int argc, char* argv[] );
+
+protected:
+ /**
+ * blocks until the String "quit" is entered on the console
+ */
+ static void waitForTestcase();
+ static TestSemaphore s_testSem;
+
+private:
+ static const std::string OPTION_RUN_AS_TEST;
+ static const std::string OPTION_RUN_AS_TEST_SINGLETHREADED;
+ static const std::string OPTION_RUN_SINGLETHREADED;
+ static void waitForQuitMultiThreaded();
+ static void waitAndPollSingleThreaded(SubSystemClassBase& mainComponent, int cycles);
+};
+
+} /* namespace etRuntime */
+#endif /* SUBSYSTEMRUNNERBASE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp
index 52440f182..99a43383f 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#include "TestSemaphore.h"
-
-namespace etRuntime {
-
-
-TestSemaphore::~TestSemaphore() {
- sem_destroy(&m_sem);
-}
-
-void TestSemaphore::printWaitingThreads() {
- std::cout << ">>> begin semaphore info >>>" << std::endl;
- int value;
- sem_getvalue(&m_sem, &value);
- std::cout << "value of the semaphore:" << value << std::endl;
-// std::cout << "current thread is " + Thread.currentThread().getName() << std::endl;
-// Collection < Thread > threads = getQueuedThreads();
-// if (threads.isEmpty())
-// std::cout << " no waiting threads" << std::endl;
-// else
-// for (Thread thread : threads) {
-// std::cout << " blocked: " << thread.getName() << std::endl;
-// }
- std::cout << "<<< end semaphore info <<<" << std::endl;
-}
-
-} /* namespace etRuntime */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "TestSemaphore.h"
+
+namespace etRuntime {
+
+
+TestSemaphore::~TestSemaphore() {
+ sem_destroy(&m_sem);
+}
+
+void TestSemaphore::printWaitingThreads() {
+ std::cout << ">>> begin semaphore info >>>" << std::endl;
+ int value;
+ sem_getvalue(&m_sem, &value);
+ std::cout << "value of the semaphore:" << value << std::endl;
+// std::cout << "current thread is " + Thread.currentThread().getName() << std::endl;
+// Collection < Thread > threads = getQueuedThreads();
+// if (threads.isEmpty())
+// std::cout << " no waiting threads" << std::endl;
+// else
+// for (Thread thread : threads) {
+// std::cout << " blocked: " << thread.getName() << std::endl;
+// }
+ std::cout << "<<< end semaphore info <<<" << std::endl;
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h
index 9d1ba1bc0..b65ba9dee 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Peter Karlitschek (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef TESTSEMAPHORE_H_
-#define TESTSEMAPHORE_H_
-
-#include <iostream>
-#include <semaphore.h>
-
-namespace etRuntime {
-
-class TestSemaphore { //extends Semaphore
-public:
- TestSemaphore(int permits = 1)
- : m_sem()
- {
- sem_init(&m_sem, 0, permits);
- }
-
- virtual ~TestSemaphore();
-
- void give() { sem_post(&m_sem); };
- void take() { sem_wait(&m_sem); };
-
- void printWaitingThreads();
-
-private:
- sem_t m_sem;
-
- TestSemaphore(const TestSemaphore& right);
- TestSemaphore& operator=(const TestSemaphore& right);
-
-};
-
-} /* namespace etRuntime */
-#endif /* TESTSEMAPHORE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef TESTSEMAPHORE_H_
+#define TESTSEMAPHORE_H_
+
+#include <iostream>
+#include <semaphore.h>
+
+namespace etRuntime {
+
+class TestSemaphore { //extends Semaphore
+public:
+ TestSemaphore(int permits = 1)
+ : m_sem()
+ {
+ sem_init(&m_sem, 0, permits);
+ }
+
+ virtual ~TestSemaphore();
+
+ void give() { sem_post(&m_sem); };
+ void take() { sem_wait(&m_sem); };
+
+ void printWaitingThreads();
+
+private:
+ sem_t m_sem;
+
+ TestSemaphore(const TestSemaphore& right);
+ TestSemaphore& operator=(const TestSemaphore& right);
+
+};
+
+} /* namespace etRuntime */
+#endif /* TESTSEMAPHORE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h
index 4f2c25bb9..449c5588a 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Jung (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETTIMER_H_
-#define _ETTIMER_H_
-
-#include "etDatatypes.h"
-
-typedef struct etTargetTime {
- unsigned long nSec;
- unsigned long sec;
-} etTargetTime_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void etTimer_init(void);
-
-uint32 getNSecFromTarget(void);
-uint32 getSecFromTarget(void);
-
-void getTimeFromTarget(etTargetTime_t *t);
-
-int isTimeGreaterThanActualTime(const etTargetTime_t *t);
-
-etBool etTimer_executeNeeded(void);
-
-uint32 getTimeBaseNS(void);
-
-uint32 getTimeBaseUS(void);
-
-uint32 getTimeBaseMS(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __ETTIMER_H__ */
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTIMER_H_
+#define _ETTIMER_H_
+
+#include "etDatatypes.h"
+
+typedef struct etTargetTime {
+ unsigned long nSec;
+ unsigned long sec;
+} etTargetTime_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void etTimer_init(void);
+
+uint32 getNSecFromTarget(void);
+uint32 getSecFromTarget(void);
+
+void getTimeFromTarget(etTargetTime_t *t);
+
+int isTimeGreaterThanActualTime(const etTargetTime_t *t);
+
+etBool etTimer_executeNeeded(void);
+
+uint32 getTimeBaseNS(void);
+
+uint32 getTimeBaseUS(void);
+
+uint32 getTimeBaseMS(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __ETTIMER_H__ */

Back to the top