Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp')
-rw-r--r--runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp26
1 files changed, 11 insertions, 15 deletions
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) {

Back to the top