Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase')
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp13
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h9
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp26
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h7
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h5
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp13
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h7
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.cpp16
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.h10
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp26
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h17
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp44
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h13
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp18
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h6
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h3
22 files changed, 119 insertions, 141 deletions
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 5f67b8ac5..4884bac09 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
@@ -15,14 +15,11 @@
#include "common/modelbase/RTSystemServicesProtocol.h"
#include "common/modelbase/SystemPortOwner.h"
#include "etDatatypes.h"
-#include <iterator>
-#include <string>
-#include <vector>
namespace etRuntime {
-ActorClassBase::ActorClassBase(IRTObject* parent, const std::string& name) :
+ActorClassBase::ActorClassBase(IRTObject* parent, const String& name) :
SystemPortOwner(parent, name),
m_state(0),
m_RTSystemPort(this, IFITEM_RTSystemPort),
@@ -51,7 +48,7 @@ void ActorClassBase::initialize() {
//--------------------- life cycle functions
void ActorClassBase::init() {
ActorClassBase* child = 0;
- for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
+ for (ChildList::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
if ((child = dynamic_cast<ActorClassBase*>(*it)) != 0)
child->init();
}
@@ -61,7 +58,7 @@ void ActorClassBase::init() {
void ActorClassBase::start() {
ActorClassBase* child = 0;
- for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
+ for (ChildList::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
if ((child = dynamic_cast<ActorClassBase*>(*it)) != 0)
child->start();
}
@@ -73,7 +70,7 @@ void ActorClassBase::stop() {
stopUser();
ActorClassBase* child = 0;
- for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
+ for (ChildList::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
if ((child = dynamic_cast<ActorClassBase*>(*it)) != 0)
child->stop();
}
@@ -102,7 +99,7 @@ etBool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, voi
return true;
}
-std::string ActorClassBase::toString() const {
+String ActorClassBase::toString() const {
ActorClassBase* thisPtr = const_cast<ActorClassBase*>(this);
char buffer[10];
sprintf(buffer, "%i", thisPtr->getThread());
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 52d876b17..9c4ca8485 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
@@ -18,7 +18,6 @@
#include "common/modelbase/RTSystemProtocol.h"
#include "common/modelbase/SystemPortOwner.h"
#include "etDatatypes.h"
-#include <string>
namespace etRuntime {
@@ -28,11 +27,11 @@ public:
virtual ~ActorClassBase();
- const std::string& getClassName() const {
+ const String& getClassName() const {
return m_className;
}
- void setClassName(const std::string& className) {
+ void setClassName(const String& className) {
m_className = className;
}
@@ -72,7 +71,7 @@ public:
protected:
- ActorClassBase(IRTObject* parent, const std::string&);
+ ActorClassBase(IRTObject* parent, const String& name);
static const int EVT_SHIFT = 1000; // TODOHRR: use 256 or shift operation later
static const int NO_STATE = 0;
@@ -88,9 +87,9 @@ protected:
RTSystemPort m_RTSystemPort;
virtual etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data);
- std::string toString() const;
+ String toString() const;
private:
- std::string m_className;
+ String m_className;
ActorClassBase();
ActorClassBase(ActorClassBase const&);
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp
index 5726012ac..42d6f3dec 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp
@@ -11,11 +11,10 @@
*******************************************************************************/
#include "common/modelbase/DataPort.h"
-#include <string>
namespace etRuntime {
-void DataPortBase::connect(IRTObject* obj, const std::string& path1, const std::string& path2) {
+void DataPortBase::connect(IRTObject* obj, const String& path1, const String& path2) {
IRTObject* obj1 = obj->getObject(path1);
IRTObject* obj2 = obj->getObject(path2);
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h
index eac2b6b21..1cb3de715 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h
@@ -13,15 +13,14 @@
#define SRC_COMMON_MODELBASE_DATAPORT_H_
#include "common/messaging/RTObject.h"
-#include <string>
namespace etRuntime {
class DataPortBase: public RTObject {
public:
- static void connect(IRTObject* obj, const std::string& path1, const std::string& path2);
+ static void connect(IRTObject* obj, const String& path1, const String& path2);
- DataPortBase(IRTObject* parent, const std::string& name, int localId) :
+ DataPortBase(IRTObject* parent, const String& name, int localId) :
RTObject(parent, name),
m_localId(localId) {
}
@@ -40,7 +39,7 @@ private:
class DataSendPort: public DataPortBase {
public:
- DataSendPort(IRTObject* parent, const std::string& name, int localId) :
+ DataSendPort(IRTObject* parent, const String& name, int localId) :
DataPortBase(parent, name, localId) {
}
@@ -53,7 +52,7 @@ private:
class DataReceivePort: public DataPortBase {
friend class DataPortBase;
public:
- DataReceivePort(IRTObject* parent, const std::string& name, int localId) :
+ DataReceivePort(IRTObject* parent, const String& name, int localId) :
DataPortBase(parent, name, localId) {
}
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 9ca651026..4c6829b44 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
@@ -11,11 +11,10 @@
*******************************************************************************/
#include "common/modelbase/EventReceiver.h"
-#include <string>
namespace etRuntime {
-EventReceiver::EventReceiver(IRTObject* parent, const std::string& name) :
+EventReceiver::EventReceiver(IRTObject* parent, const String& name) :
RTObject(parent, name),
m_thread(-1) {
}
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 e67df44b9..cfdb7c230 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
@@ -15,7 +15,6 @@
#include "common/messaging/RTObject.h"
#include "common/modelbase/IEventReceiver.h"
-#include <string>
namespace etRuntime {
@@ -27,7 +26,7 @@ public:
virtual int getThread();
protected:
- EventReceiver(IRTObject* parent, const std::string& name);
+ EventReceiver(IRTObject* parent, const String& name);
private:
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 498137c69..0e45bc4de 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
@@ -17,11 +17,10 @@
#include "common/modelbase/IInterfaceItemOwner.h"
#include "common/modelbase/InterfaceItemBase.h"
#include "common/modelbase/IReplicatedInterfaceItem.h"
-#include <string>
namespace etRuntime {
-void InterfaceItemBase::connect(IRTObject* obj, const std::string& path1, const std::string& path2) {
+void InterfaceItemBase::connect(IRTObject* obj, const String& path1, const String& path2) {
IRTObject* obj1 = obj->getObject(path1);
IRTObject* obj2 = obj->getObject(path2);
@@ -33,7 +32,7 @@ void InterfaceItemBase::connect(IRTObject* obj, const std::string& path1, const
}
}
-InterfaceItemBase::InterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId, int idx) :
+InterfaceItemBase::InterfaceItemBase(IInterfaceItemOwner* owner, const String& name, int localId, int idx) :
AbstractMessageReceiver(owner->getEventReceiver(), name),
m_localId(localId),
m_idx(idx),
@@ -135,20 +134,19 @@ void InterfaceItemBase::destroy() {
AbstractMessageReceiver::destroy();
}
-std::string InterfaceItemBase::toString() const {
- std::stringstream result;
-
- result << ((m_replicator != 0) ? "sub " : "");
- result << "port " + getName() << " " << getAddress().toID() << " ";
- if(m_peerMsgReceiver == 0)
- result << "UNCONNECTED";
+String InterfaceItemBase::toString() const {
+ char buffer [256];
+ const char* sub = (m_replicator != 0) ? "sub " : "";
+ int pos = sprintf(buffer, "%sport %s %s ", sub, getName().c_str(), getAddress().toID().c_str());
+ if (m_peerMsgReceiver == 0) {
+ sprintf(buffer+pos, "UNCONNECTED");
+ }
else {
- result << " -> ";
- result << ((m_peer != 0) ? m_peer->getName() : "?");
- result << " " << m_peerAddress.toID();
+ const char* peerName = (m_peer != 0) ? m_peer->getName().c_str() : "?";
+ sprintf(buffer + pos, " -> %s %s", peerName, m_peerAddress.toID().c_str());
}
- return result.str();
+ return buffer;
}
} /* 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 cdb12d99d..004cb129d 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
@@ -17,7 +17,6 @@
#include "common/messaging/Address.h"
#include "common/messaging/IMessageService.h"
#include "common/modelbase/IInterfaceItem.h"
-#include <string>
namespace etRuntime {
@@ -28,7 +27,7 @@ class IMessageService;
class InterfaceItemBase: public AbstractMessageReceiver, public virtual IInterfaceItem {
public:
- static void connect(IRTObject* obj, const std::string& path1, const std::string& path2);
+ static void connect(IRTObject* obj, const String& path1, const String& path2);
virtual ~InterfaceItemBase();
@@ -45,9 +44,9 @@ public:
IEventReceiver* getActor() const;
- virtual std::string toString() const;
+ virtual String toString() const;
protected:
- InterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId, int idx);
+ InterfaceItemBase(IInterfaceItemOwner* owner, const String& name, int localId, int idx);
IMessageReceiver* getMsgReceiver() const {
return m_ownMsgReceiver;
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 9fbb2c1be..8be912354 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
@@ -15,7 +15,6 @@
#include "common/modelbase/IInterfaceItemOwner.h"
#include "common/modelbase/InterfaceItemBase.h"
-#include <string>
namespace etRuntime {
@@ -25,11 +24,11 @@ public:
virtual ~PortBase() {}
protected:
- PortBase(IInterfaceItemOwner* owner, const std::string& name, int localId) :
+ PortBase(IInterfaceItemOwner* owner, const String& name, int localId) :
InterfaceItemBase(owner, name, localId, 0) {
}
- PortBase(IInterfaceItemOwner* owner, const std::string& name, int localId, int idx) :
+ PortBase(IInterfaceItemOwner* owner, const String& name, int localId, int idx) :
InterfaceItemBase(owner, name, localId, idx) {
}
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h
index 4dbae420c..afee89e71 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h
@@ -13,14 +13,14 @@
#define SRC_COMMON_MODELBASE_RTSYSTEM_H_
#include "common/messaging/RTObject.h"
-#include <string>
+#include "common/containers/String.h"
namespace etRuntime {
class RTSystem: public RTObject {
public:
- explicit RTSystem(std::string name) :
+ explicit RTSystem(String name) :
RTObject(0, name) {
}
virtual ~RTSystem() {}
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp
index 9a9f930b0..eaf8ec682 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp
@@ -12,26 +12,25 @@
#include "common/modelbase/IEventReceiver.h"
#include "common/modelbase/RTSystemProtocol.h"
-#include <string>
namespace etRuntime {
-const std::string RTSystemProtocol::RT_SYSTEM_PORT_NAME = "RTSystemPort";
+const String RTSystemProtocol::RT_SYSTEM_PORT_NAME = "RTSystemPort";
RTSystemPort::RTSystemPort(IInterfaceItemOwner* actor, int localId) :
- RTSystemServicesProtocolPort(actor, RTSystemProtocol::RT_SYSTEM_PORT_NAME, localId) {
+ RTSystemServicesProtocolPort(actor, RTSystemProtocol::RT_SYSTEM_PORT_NAME.c_str(), localId) {
}
RTSystemConjPort::RTSystemConjPort(IInterfaceItemOwner* actor, int localId) :
- RTSystemServicesProtocolConjReplPort(actor, RTSystemProtocol::RT_SYSTEM_PORT_NAME, localId) {
+ RTSystemServicesProtocolConjReplPort(actor, RTSystemProtocol::RT_SYSTEM_PORT_NAME.c_str(), localId) {
}
-InterfaceItemBase* RTSystemConjPort::createInterfaceItem(IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) {
+InterfaceItemBase* RTSystemConjPort::createInterfaceItem(IInterfaceItemOwner* rcv, const String& name, int lid, int idx) {
return new RTSystemConjSubPort(rcv, name, lid, idx);
}
-RTSystemConjSubPort::RTSystemConjSubPort(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx) :
- RTSystemServicesProtocolConjPort(actor, name, localId, idx) {
+RTSystemConjSubPort::RTSystemConjSubPort(IInterfaceItemOwner* actor, const String& name, int localId, int idx) :
+ RTSystemServicesProtocolConjPort(actor, name.c_str(), localId, idx) {
}
} // namespace etRuntime
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h
index 61f0b8665..0536d2102 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h
@@ -9,13 +9,12 @@
#define SRC_COMMON_MESSAGING_RTSYSTEMPROTOCOL_H_
#include "common/modelbase/RTSystemServicesProtocol.h"
-#include <string>
namespace etRuntime {
class RTSystemProtocol {
public:
- static const std::string RT_SYSTEM_PORT_NAME;
+ static const String RT_SYSTEM_PORT_NAME;
};
@@ -37,7 +36,7 @@ public:
virtual ~RTSystemConjPort() {}
protected:
- virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx);
+ virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const String& name, int lid, int idx);
private:
RTSystemConjPort();
@@ -47,7 +46,7 @@ private:
class RTSystemConjSubPort: public RTSystemServicesProtocolConjPort {
public:
- RTSystemConjSubPort(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx);
+ RTSystemConjSubPort(IInterfaceItemOwner* actor, const String& name, int localId, int idx);
virtual ~RTSystemConjSubPort() {}
private:
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.cpp
index fc9747cc0..923a327eb 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.cpp
@@ -14,33 +14,35 @@
namespace etRuntime {
-ReplicatedActorClassBase::ReplicatedActorClassBase(IRTObject* parent, const std::string& name) :
+ReplicatedActorClassBase::ReplicatedActorClassBase(IRTObject* parent, const String& name) :
RTObject(parent, name), m_items() {
}
ReplicatedActorClassBase::~ReplicatedActorClassBase() {
- for(std::vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
+ for(Vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
delete *it;
}
}
void ReplicatedActorClassBase::createSubActors(int number) {
+ m_items.reserve(m_items.size() + number);
+
for (int i = 0; i < number; i++) {
- std::stringstream itemName;
- itemName << getName() << SEP << i;
- ActorClassBase* item = createActor(getParent(), itemName.str());
+ char buffer[64];
+ sprintf(buffer, "%s%c%d", getName().c_str(), SEP, i);
+ ActorClassBase* item = createActor(getParent(), buffer);
m_items.push_back(item);
}
}
void ReplicatedActorClassBase::initialize() {
- for(std::vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
+ for(Vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
(*it)->initialize();
}
}
void ReplicatedActorClassBase::setProbesActive(bool recursive, bool active) {
- for(std::vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it)
+ for(Vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it)
(*it)->setProbesActive(recursive, active);
}
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.h
index 6a1eba38d..b4eb3b0bf 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedActorClassBase.h
@@ -15,6 +15,8 @@
#include "common/messaging/RTObject.h"
#include "common/modelbase/ActorClassBase.h"
+#include "common/containers/String.h"
+#include "common/containers/Vector.h"
namespace etRuntime {
@@ -23,19 +25,19 @@ class ReplicatedActorClassBase : public RTObject {
public:
static const char SEP = ':';
- ReplicatedActorClassBase(IRTObject* parent, const std::string& name);
+ ReplicatedActorClassBase(IRTObject* parent, const String& name);
virtual ~ReplicatedActorClassBase(void);
void createSubActors(int number);
void initialize(void);
void setProbesActive(bool recursive, bool active);
int getNSubActors(void) { return m_items.size(); }
- ActorClassBase* getSubActor(int index) { return m_items.at(index); }
+ ActorClassBase* getSubActor(int index) { return m_items[index]; }
protected:
- virtual ActorClassBase* createActor(IRTObject* parent, const std::string& name) = 0;
+ virtual ActorClassBase* createActor(IRTObject* parent, const String& name) = 0;
private:
- std::vector<ActorClassBase*> m_items;
+ Vector<ActorClassBase*> m_items;
};
} // namespace et Runtime
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp
index 6e5b536d2..c89d87137 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp
@@ -13,14 +13,10 @@
#include "common/messaging/RTObject.h"
#include "common/modelbase/IEventReceiver.h"
#include "common/modelbase/ReplicatedInterfaceItemBase.h"
-#include <iterator>
-#include <queue>
-#include <string>
-#include <vector>
namespace etRuntime {
-ReplicatedInterfaceItemBase::ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId) :
+ReplicatedInterfaceItemBase::ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const String& name, int localId) :
RTObject(owner, name),
m_localId(localId),
m_items(),
@@ -28,29 +24,29 @@ ReplicatedInterfaceItemBase::ReplicatedInterfaceItemBase(IInterfaceItemOwner* ow
}
ReplicatedInterfaceItemBase::~ReplicatedInterfaceItemBase() {
- for(std::vector<InterfaceItemBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
+ for(Vector<InterfaceItemBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
delete *it;
}
}
InterfaceItemBase* ReplicatedInterfaceItemBase::createSubInterfaceItem() {
int newIndex = getFreeIndex();
- std::stringstream itemName;
- itemName << getName() << SEP << newIndex;
+ char buffer[64];
+ sprintf(buffer, "%s%c%d", getName().c_str(), SEP, newIndex);
- InterfaceItemBase* item = createInterfaceItem(this, itemName.str(), m_localId, newIndex);
+ InterfaceItemBase* item = createInterfaceItem(this, buffer, m_localId, newIndex);
m_items.push_back(item);
return item;
}
void ReplicatedInterfaceItemBase::removeItem(InterfaceItemBase& item) {
- std::vector<InterfaceItemBase*>::iterator it = m_items.begin();
+ Vector<InterfaceItemBase*>::iterator it = m_items.begin();
while (it != m_items.end() && *it != &item) {
++it;
}
if (it != m_items.end()) {
m_items.erase(it);
- m_releasedIndices.push(item.getIdx());
+ m_releasedIndices.push_back(item.getIdx());
}
}
@@ -59,14 +55,14 @@ int ReplicatedInterfaceItemBase::getFreeIndex() {
return m_items.size();
else {
int idx = m_releasedIndices.front();
- m_releasedIndices.pop();
+ m_releasedIndices.pop_back();
return idx;
}
}
InterfaceItemBase* ReplicatedInterfaceItemBase::getInterfaceItem(int idx) const {
- for (std::vector<InterfaceItemBase*>::const_iterator it = m_items.begin(); it != m_items.end(); ++it) {
+ for (Vector<InterfaceItemBase*>::const_iterator it = m_items.begin(); it != m_items.end(); ++it) {
if ((*it)->getIdx() == idx)
return *it;
}
@@ -82,8 +78,8 @@ IReplicatedInterfaceItem* ReplicatedInterfaceItemBase::getSystemPort() const {
return dynamic_cast<IInterfaceItemOwner*>(getParent())->getSystemPort();
}
-std::string ReplicatedInterfaceItemBase::toString() const {
- return "replicated port " + getName();
+String ReplicatedInterfaceItemBase::toString() const {
+ return String("replicated port ") + getName();
}
IInterfaceItem* ReplicatedInterfaceItemBase::connectWith(IInterfaceItem* peer) {
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h
index 4738382da..bf1447154 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h
@@ -15,9 +15,8 @@
#include "common/modelbase/IInterfaceItemOwner.h"
#include "common/modelbase/InterfaceItemBase.h"
#include "common/modelbase/IReplicatedInterfaceItem.h"
-#include <queue>
-#include <string>
-#include <vector>
+#include "common/containers/String.h"
+#include "common/containers/Vector.h"
namespace etRuntime {
@@ -45,23 +44,23 @@ public:
virtual IEventReceiver* getEventReceiver() const;
virtual IReplicatedInterfaceItem* getSystemPort() const;
- std::string toString() const;
+ String toString() const;
virtual IInterfaceItem* connectWith(IInterfaceItem* peer);
protected:
- ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId);
+ ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const String& name, int localId);
- std::vector<InterfaceItemBase*>& getItems() {
+ Vector<InterfaceItemBase*>& getItems() {
return m_items;
}
- virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) = 0;
+ virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const String& name, int lid, int idx) = 0;
private:
int m_localId;
- std::vector<InterfaceItemBase*> m_items;
- std::queue<int> m_releasedIndices;
+ Vector<InterfaceItemBase*> m_items;
+ Vector<int> m_releasedIndices;
int getFreeIndex();
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h
index a3975093a..b4afdd76e 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h
@@ -13,7 +13,6 @@
#define SRC_COMMON_MODELBASE_REPLICATEDPORTBASE_H_
#include "common/modelbase/ReplicatedInterfaceItemBase.h"
-#include <string>
namespace etRuntime {
@@ -22,7 +21,7 @@ public:
virtual ~ReplicatedPortBase() {}
protected:
- ReplicatedPortBase(IInterfaceItemOwner* owner, const std::string& name, int localId) :
+ ReplicatedPortBase(IInterfaceItemOwner* owner, const String& name, int localId) :
ReplicatedInterfaceItemBase(owner, name, localId) {
}
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 d7e33a04a..762ca2910 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
@@ -16,22 +16,20 @@
#include "common/messaging/MessageServiceController.h"
#include "common/messaging/RTServices.h"
#include "common/modelbase/ActorClassBase.h"
-#include <iostream>
-#include <iterator>
-#include <map>
-#include <string>
-#include <vector>
-
namespace etRuntime {
-SubSystemClassBase::SubSystemClassBase(IRTObject* parent, std::string name) :
+SubSystemClassBase::SubSystemClassBase(IRTObject* parent, String name) :
RTObject(parent, name),
m_RTSystemPort(this, IFITEM_RTSystemPort) {
- DebuggingService::getInstance().getAsyncLogger().setMSC(name + "_Async", "log/");
+ String asyncMSCname(name);
+ asyncMSCname += "_Async";
+ String syncMSCname(name);
+ syncMSCname += "_Sync";
+ DebuggingService::getInstance().getAsyncLogger().setMSC(asyncMSCname.c_str(), "log/");
DebuggingService::getInstance().getAsyncLogger().open();
- DebuggingService::getInstance().getSyncLogger().setMSC(name + "_Sync", "log/");
+ DebuggingService::getInstance().getSyncLogger().setMSC(syncMSCname.c_str(), "log/");
DebuggingService::getInstance().getSyncLogger().open();
DebuggingService::getInstance().getSyncLogger().setObjectName("main");
@@ -40,7 +38,7 @@ SubSystemClassBase::SubSystemClassBase(IRTObject* parent, std::string name) :
void SubSystemClassBase::init() {
- std::cout << "*** MainComponent " << getInstancePath() << "::init ***" << std::endl;
+ printf("*** MainComponent %s::init ***\n", getInstancePath().c_str());
// MessageService
instantiateMessageServices();
@@ -55,7 +53,7 @@ void SubSystemClassBase::init() {
// std::cout << toStringRecursive() << std::endl;
// initialize all actor instances
- for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
+ for (ChildList::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
ActorClassBase* child = dynamic_cast<ActorClassBase*>(*it);
if (child != 0)
child->init();
@@ -72,50 +70,50 @@ void SubSystemClassBase::start() {
}
void SubSystemClassBase::stop() {
- std::cout << "*** MainComponent " << getInstancePath() << "::stop ***" << std::endl;
+ printf("*** MainComponent %s::stop ***\n", getInstancePath().c_str());
RTServices::getInstance().getMsgSvcCtrl().stop();
- std::cout << "=== done stop MsgSvcCtrl" << std::endl;
+ printf("=== done stop MsgSvcCtrl\n");
// stop all actor instances
- for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
+ for (ChildList::iterator it = getChildren().begin(); it != getChildren().end(); ++it) {
ActorClassBase* child = dynamic_cast<ActorClassBase*>(*it);
if (child != 0)
child->stop();
}
- std::cout << "=== done stop actor instances" << std::endl;
+ printf("=== done stop actor instances\n");
}
void SubSystemClassBase::destroy() {
- std::cout << "*** MainComponent " << this->getInstancePath() << "::destroy ***" << std::endl;
+ printf("*** MainComponent %s::destroy ***\n", this->getInstancePath().c_str());
RTObject::destroy();
// std::cout << toStringRecursive() << std::endl;
- std::cout << "=== done destroy actor instances" << std::endl;
+ printf("=== done destroy actor instances\n");
DebuggingService::getInstance().getAsyncLogger().close();
DebuggingService::getInstance().getSyncLogger().close();
- std::cout << "=== done close loggers" << std::endl;
+ printf("=== done close loggers\n");
RTServices::getInstance().destroy();
- std::cout << "=== done destroy RTServices\n\n\n" << std::endl;
+ printf("=== done destroy RTServices\n\n\n\n");
}
IMessageService* SubSystemClassBase::getMsgService(int idx) const {
return RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(idx);
}
-ActorClassBase* SubSystemClassBase::getInstance(const std::string& path) const {
+ActorClassBase* SubSystemClassBase::getInstance(const String& path) const {
IRTObject* object = getObject(path);
return dynamic_cast<ActorClassBase*>(object);
}
-void SubSystemClassBase::addPathToThread(const std::string& path, int thread) {
+void SubSystemClassBase::addPathToThread(const String& path, int thread) {
m_path2thread[path] = thread;
}
-int SubSystemClassBase::getThreadForPath(const std::string& path) const {
- std::map<std::string, int> ::const_iterator it = m_path2thread.find(path);
+int SubSystemClassBase::getThreadForPath(const String& path) const {
+ Map<String, int> ::const_iterator it = m_path2thread.find(path);
if (it == m_path2thread.end())
return -1;
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 11bd28c61..f0172333f 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
@@ -13,13 +13,12 @@
#ifndef SUBSYSTEMCLASSBASE_H_
#define SUBSYSTEMCLASSBASE_H_
+#include "common/containers/Map.h"
#include "common/modelbase/IEventReceiver.h"
#include "common/modelbase/IInterfaceItemOwner.h"
#include "common/modelbase/IReplicatedInterfaceItem.h"
#include "common/modelbase/RTSystemProtocol.h"
#include "etDatatypes.h"
-#include <map>
-#include <string>
namespace etRuntime {
@@ -43,10 +42,10 @@ public:
IMessageService* getMsgService(int idx) const;
Address getFreeAddress(int msgSvcId) const;
- ActorClassBase* getInstance(const std::string& path) const;
+ ActorClassBase* getInstance(const String& path) const;
- void addPathToThread(const std::string& path, int thread);
- int getThreadForPath(const std::string& path) const;
+ void addPathToThread(const String& path, int thread);
+ int getThreadForPath(const String& path) const;
void resetAll();
@@ -68,7 +67,7 @@ public:
protected:
- SubSystemClassBase(IRTObject* parent, std::string name);
+ SubSystemClassBase(IRTObject* parent, String name);
//--------------------- ports
RTSystemConjPort m_RTSystemPort;
@@ -78,7 +77,7 @@ protected:
private:
- std::map<std::string, int> m_path2thread;
+ Map<String, int> m_path2thread;
SubSystemClassBase();
SubSystemClassBase(SubSystemClassBase const&);
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 931527644..09c8102d0 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
@@ -15,26 +15,24 @@
#include "common/modelbase/SubSystemClassBase.h"
#include "runtime/etRuntime.h"
#include "etUnit/etUnit.h"
-#include <iostream>
-#include <sstream>
#include <cstring>
namespace etRuntime {
-const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST = "-run_as_test";
-const std::string SubSystemRunnerBase::OPTION_RUN_HEADLESS = "-headless";
+const String SubSystemRunnerBase::OPTION_RUN_AS_TEST = "-run_as_test";
+const String SubSystemRunnerBase::OPTION_RUN_HEADLESS = "-headless";
void SubSystemRunnerBase::run(SubSystemClassBase& main_component, int argc, char* argv[]) {
- std::cout << "*** T H E B E G I N ***" << std::endl;
+ printf("*** T H E B E G I N ***\n");
etBool headless = false;
for (int i = 1; i < argc; ++i) { // omit first argument, which is the program name
if (OPTION_RUN_AS_TEST.compare(argv[i]) == 0) {
- std::cout << "*** running as test" << std::endl;
+ printf("*** running as test\n");
headless = true;
} else if (OPTION_RUN_HEADLESS.compare(argv[i]) == 0) {
- std::cout << "*** running headless" << std::endl;
+ printf("*** running headless\n");
headless = true;
}
}
@@ -52,7 +50,7 @@ void SubSystemRunnerBase::run(SubSystemClassBase& main_component, int argc, char
main_component.stop(); // lifecycle stop
main_component.destroy(); // lifecycle destroy
- std::cout << "*** T H E E N D ***" << std::endl;
+ printf("*** T H E E N D ***\n");
}
@@ -83,9 +81,9 @@ void SubSystemRunnerBase::waitForQuit() {
}
void SubSystemRunnerBase::waitForTerminate() {
- std::cout << "=== waitForTestcase: before acq. semaphore" << std::endl;
+ printf("=== waitForTestcase: before acq. semaphore\n");
etSema_waitForWakeup(etRuntime_getTerminateSemaphore());
- std::cout << "=== waitForTestcase: after acq. semaphore" << std::endl;
+ printf("=== waitForTestcase: after acq. semaphore\n");
}
} /* 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 156f1d096..89e44f535 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
@@ -13,7 +13,7 @@
#ifndef SUBSYSTEMRUNNERBASE_H_
#define SUBSYSTEMRUNNERBASE_H_
-#include <string>
+#include "common/containers/String.h"
namespace etRuntime {
@@ -33,8 +33,8 @@ protected:
static void waitForQuit();
private:
- static const std::string OPTION_RUN_AS_TEST;
- static const std::string OPTION_RUN_HEADLESS;
+ static const String OPTION_RUN_AS_TEST;
+ static const String OPTION_RUN_HEADLESS;
SubSystemRunnerBase(SubSystemRunnerBase const&);
SubSystemRunnerBase& operator=(SubSystemRunnerBase const&);
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h
index 4cd43f9a6..8b74e9d20 100644
--- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h
+++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h
@@ -15,7 +15,6 @@
#include "common/messaging/RTObject.h"
#include "common/modelbase/EventReceiver.h"
#include "common/modelbase/IInterfaceItemOwner.h"
-#include <string>
namespace etRuntime {
@@ -39,7 +38,7 @@ public:
}
protected:
- SystemPortOwner(IRTObject* parent, const std::string& name) :
+ SystemPortOwner(IRTObject* parent, const String& name) :
EventReceiver(parent, name) {
}

Back to the top