Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2017-01-04 15:07:12 -0500
committerHenrik Rentz-Reichert2017-01-09 11:41:16 -0500
commit9b02d5a62ea41136b46b744f7b2c1cf50f30a888 (patch)
treed7473847da1a9e3a470195f384f62322b48057db /plugins/org.eclipse.etrice.generator.cpp
parentb8fd69cd558c0673971bcdaea495131bc4d7cd82 (diff)
downloadorg.eclipse.etrice-9b02d5a62ea41136b46b744f7b2c1cf50f30a888.tar.gz
org.eclipse.etrice-9b02d5a62ea41136b46b744f7b2c1cf50f30a888.tar.xz
org.eclipse.etrice-9b02d5a62ea41136b46b744f7b2c1cf50f30a888.zip
Bug 509875 - [runtime.cpp] replace STL containers with own containers that are more light weight
* replaced streaming code with (s)printf constructs * added String, Vector, Set, Pair and Map with tests * using new String class in * Address * Message * MSCFilter * MSCLogger * RTObject * and affected classes * using new Vector class in * RTObject * MSCLogger * MessageServiceController * ReplicatedActorClassBase * ReplicatedInterfaceItemBase * and affected classes * using new Set class in * MessageDispatcher * using new Map class in * SubSystemClassBase * DebuggingService * adjusted cpp generator Change-Id: I9c91289057185e6e36b9453ecf03f6f6d3834ec6
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.cpp')
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend9
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend12
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend44
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend8
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java31
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java55
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java8
10 files changed, 110 insertions, 75 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
index cf705d93d..a9366db52 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
@@ -78,7 +78,6 @@ class ActorClassGen extends GenericActorClassGenerator {
#include "common/messaging/Address.h"
#include "common/messaging/IMessageReceiver.h"
#include "common/debugging/DebuggingService.h"
- #include <vector>
«FOR pc : root.getReferencedProtocolClasses(ac)»
#include "«pc.path»«pc.name».h"
@@ -140,7 +139,7 @@ class ActorClassGen extends GenericActorClassGenerator {
public:
//--------------------- construction
- «ac.name»(etRuntime::IRTObject* parent, const std::string& name);
+ «ac.name»(etRuntime::IRTObject* parent, const String& name);
void initialize(void);
«IF Main::settings.generateMSCInstrumentation»
void setProbesActive(bool recursive, bool active);
@@ -181,11 +180,11 @@ class ActorClassGen extends GenericActorClassGenerator {
class Replicated«clsname» : public ReplicatedActorClassBase {
public:
- Replicated«clsname»(IRTObject* parent, const std::string& name) :
+ Replicated«clsname»(IRTObject* parent, const String& name) :
ReplicatedActorClassBase(parent, name) {}
protected:
- ActorClassBase* createActor(IRTObject* parent, const std::string& name) {
+ ActorClassBase* createActor(IRTObject* parent, const String& name) {
return new «clsname»(parent, name);
}
};
@@ -244,7 +243,7 @@ class ActorClassGen extends GenericActorClassGenerator {
«ac.userCode3.userCode»
- «clsname»::«clsname»(etRuntime::IRTObject* parent, const std::string& name)
+ «clsname»::«clsname»(etRuntime::IRTObject* parent, const String& name)
«ac.generateConstructorInitalizerList»
{
«IF Main::settings.generateMSCInstrumentation»
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
index 48a98f833..bf05af6c7 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
@@ -114,7 +114,7 @@ class NodeGen {
«ENDIF»
«ENDFOR»
- «clsname»(IRTObject* parent, const std::string& name);
+ «clsname»(IRTObject* parent, const String& name);
~«clsname»();
virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);
@@ -199,7 +199,7 @@ class NodeGen {
const int «clsname»::«thread.value.threadId» = «thread.index0»;
«ENDFOR»
- «clsname»::«clsname»(IRTObject* parent, const std::string& name)
+ «clsname»::«clsname»(IRTObject* parent, const String& name)
«cc.generateConstructorInitalizerList»
«FOR thread : threads»
, msgSvc_«thread.name»(NULL)
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
index 5c205ff64..181a815be 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
@@ -90,6 +90,10 @@ class NodeRunnerGen {
#include "«clsname».h"
#include "common/modelbase/RTSystem.h"
+ #include "common/containers/String.h"
+ #include "common/containers/Vector.h"
+ #include "common/containers/Set.h"
+ #include "common/containers/Map.h"
using namespace etRuntime;
@@ -108,6 +112,14 @@ class NodeRunnerGen {
««« // TODO JH crash
//delete sys;
+
+ printf("String allocations %d and deallocations %d\n", etRuntime::String::getNAllocations(), etRuntime::String::getNDeallocations());
+ printf("String creations %d and destructions %d\n", etRuntime::String::getNCreated(), etRuntime::String::getNDestroyed());
+ printf("Vector allocations %d and deallocations %d\n", etRuntime::VectorStats::getNAllocations(), etRuntime::VectorStats::getNDeallocations());
+ printf("Vector creations %d and destructions %d\n", etRuntime::VectorStats::getNCreated(), etRuntime::VectorStats::getNDestroyed());
+ printf("Set creations %d and destructions %d\n", etRuntime::SetStats::getNCreated(), etRuntime::SetStats::getNDestroyed());
+ printf("Map creations %d and destructions %d\n", etRuntime::MapStats::getNCreated(), etRuntime::MapStats::getNDestroyed());
+ fflush(stdout);
return 0;
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
index ead55a961..223cf131d 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
@@ -106,10 +106,10 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
static bool isValidIncomingEvtID(int evtId) {
return ((«IF pc.incomingMessages.size == 0»MSG_MAX«ELSE»IN_«pc.incomingMessages.get(0).name»«ENDIF» <= evtId) && (evtId < MSG_MAX));
}
- static const std::string& getMessageString(int msg_id);
+ static const etRuntime::String& getMessageString(int msg_id);
private:
- static const std::string s_messageStrings[];
+ static const etRuntime::String s_messageStrings[];
};
@@ -135,8 +135,8 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«pclass.userCode.userCode»
«ENDIF»
public:
- «portClassName»(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId);
- «portClassName»(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId, int idx);
+ «portClassName»(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);
+ «portClassName»(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId, int idx);
«IF Main::settings.generateMSCInstrumentation»
virtual void destroy();
@@ -162,7 +162,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
class «replPortClassName» : public etRuntime::ReplicatedPortBase {
public:
- «replPortClassName»(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId);
+ «replPortClassName»(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);
int getReplication() const { return getNInterfaceItems(); }
int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); }
@@ -181,7 +181,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«ENDIF»
protected:
- virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) {
+ virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const etRuntime::String& name, int lid, int idx) {
return new «portClassName»(rcv, name, lid, idx);
}
@@ -205,8 +205,6 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
#include "common/messaging/Address.h"
#include "common/messaging/Message.h"
#include "common/modelbase/IEventReceiver.h"
- #include <iterator>
- #include <vector>
using namespace etRuntime;
@@ -215,14 +213,14 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«pc.userCode(3)»
/* message names as strings for debugging (generate MSC) */
- const std::string «pc.name»::s_messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
+ const String «pc.name»::s_messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"};
- const std::string& «pc.name»::getMessageString(int msg_id) {
+ const String& «pc.name»::getMessageString(int msg_id) {
if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) {
return s_messageStrings[msg_id];
} else {
// id out of range
- static const std::string errorMsg = "Message ID out of range";
+ static const String errorMsg = "Message ID out of range";
return errorMsg;
}
}
@@ -245,12 +243,12 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// «IF conj»conjugated «ENDIF»port class
//------------------------------------------------------------------------------------------------------------
- «portClassName»::«portClassName»(IInterfaceItemOwner* actor, const std::string& name, int localId)
+ «portClassName»::«portClassName»(IInterfaceItemOwner* actor, const String& name, int localId)
«pclass.generateConstructorInitalizerList('0')»
{
}
- «portClassName»::«portClassName»(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx)
+ «portClassName»::«portClassName»(IInterfaceItemOwner* actor, const String& name, int localId, int idx)
«pclass.generateConstructorInitalizerList('idx')»
{
«IF pclass != null»«initHelper.genExtraInitializers(pclass.attributes)»«ENDIF»
@@ -266,11 +264,11 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
void «portClassName»::receive(const Message* msg) {
// TODO JH further
if (! «pc.name»::«IF conj»isValidOutgoingEvtID«ELSE»isValidIncomingEvtID«ENDIF»(msg->getEvtId())) {
- std::cout << "unknown" << std::endl;
+ //std::cout << "unknown" << std::endl;
}
«IF Main::settings.generateMSCInstrumentation»
- DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), «pc.name»::getMessageString(msg->getEvtId()));
+ DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), «pc.name»::getMessageString(msg->getEvtId()).c_str());
«ENDIF»
«IF pc.handlesReceive(conj)»
@@ -305,7 +303,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
//------------------------------------------------------------------------------------------------------------
// «IF conj»conjugated «ENDIF»replicated port class
//------------------------------------------------------------------------------------------------------------
- «replPortClassName»::«replPortClassName»(IInterfaceItemOwner* actor, const std::string& name, int localId) :
+ «replPortClassName»::«replPortClassName»(IInterfaceItemOwner* actor, const String& name, int localId) :
ReplicatedPortBase(actor, name, localId)
{
}
@@ -314,7 +312,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// incoming messages
«FOR m : pc.getAllIncomingMessages()»
«messageSignatureDefinition(m, replPortClassName, false)»{
- for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {
+ for (Vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {
(dynamic_cast<«portClassName»*>(*it))->«messageCall(m, false)»;
}
}
@@ -323,7 +321,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// outgoing messages
«FOR m : pc.getAllOutgoingMessages()»
«messageSignatureDefinition(m, replPortClassName, false)»{
- for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {
+ for (Vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {
(dynamic_cast<«portClassName»*>(*it))->«messageCall(m, false)»;
}
}
@@ -375,7 +373,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«messageSignatureDefinition(m, classPrefix, true)» {
«IF Main::settings.generateMSCInstrumentation»
DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
- «portClassName»::getMessageString(«portClassName»::«dir»_«m.name»));
+ «portClassName»::getMessageString(«portClassName»::«dir»_«m.name»).c_str());
«ENDIF»
if (getPeerAddress().isValid()) {
««« we have to use a dynamic cast here because we have a virtual base class
@@ -422,7 +420,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
class «pc.getPortClassName(true)» : public etRuntime::DataSendPort {
public:
- «pc.getPortClassName(true)»(etRuntime::IRTObject* parent, const std::string& name, int localId);
+ «pc.getPortClassName(true)»(etRuntime::IRTObject* parent, const etRuntime::String& name, int localId);
// getters and setters
«FOR msg : sentMsgs»
@@ -444,7 +442,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
class «pc.getPortClassName(false)» : public etRuntime::DataReceivePort {
public:
- «pc.getPortClassName(false)»(etRuntime::IRTObject* parent, const std::string& name, int localId);
+ «pc.getPortClassName(false)»(etRuntime::IRTObject* parent, const etRuntime::String& name, int localId);
// getters
«FOR msg : sentMsgs»
@@ -489,7 +487,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// send port holds data
// constructor
- «pc.getPortClassName(true)»::«pc.getPortClassName(true)»(IRTObject* parent, const std::string& name, int localId) :
+ «pc.getPortClassName(true)»::«pc.getPortClassName(true)»(IRTObject* parent, const String& name, int localId) :
DataSendPort(parent, name, localId)
{
}
@@ -497,7 +495,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
// receive port accesses send port
// constructor
- «pc.getPortClassName(false)»::«pc.getPortClassName(false)»(IRTObject* parent, const std::string& name, int localId) :
+ «pc.getPortClassName(false)»::«pc.getPortClassName(false)»(IRTObject* parent, const String& name, int localId) :
DataReceivePort(parent, name, localId),
m_peer(0)
{
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
index 3e1c142ac..514cd75db 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
@@ -40,7 +40,7 @@ class StateMachineGen extends GenericStateMachineGenerator {
'''
«IF Main::settings.generateMSCInstrumentation || Main::settings.generateWithVerboseOutput»
// state names
- const std::string «clsName»::s_stateStrings[] = {
+ const String «clsName»::s_stateStrings[] = {
"<no state>",
"<top>",
«FOR state : states SEPARATOR ","»
@@ -52,11 +52,11 @@ class StateMachineGen extends GenericStateMachineGenerator {
void «clsName»::setState(int new_state) {
«IF Main::settings.generateMSCInstrumentation»
- DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]);
+ DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state].c_str());
«ENDIF»
«IF Main::settings.generateWithVerboseOutput»
if (s_stateStrings[new_state] != "Idle") {
- std::cout << getInstancePath() << " -> " << s_stateStrings[new_state] << std::endl;
+ std::cout << getInstancePath().c_str() << " -> " << s_stateStrings[new_state].c_str() << std::endl;
}
«ENDIF»
m_state = new_state;
@@ -65,7 +65,7 @@ class StateMachineGen extends GenericStateMachineGenerator {
else
'''
«IF Main::settings.generateMSCInstrumentation || Main::settings.generateWithVerboseOutput»
- static const std::string s_stateStrings[];
+ static const String s_stateStrings[];
«ENDIF»
static const int s_numberOfStates;
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java
index 9505a4fc0..270831896 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java
@@ -207,8 +207,6 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.newLine();
_builder.append("#include \"common/debugging/DebuggingService.h\"");
_builder.newLine();
- _builder.append("#include <vector>");
- _builder.newLine();
_builder.newLine();
{
EList<ProtocolClass> _referencedProtocolClasses = root.getReferencedProtocolClasses(ac);
@@ -405,7 +403,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("\t\t");
String _name_11 = ac.getName();
_builder.append(_name_11, "\t\t");
- _builder.append("(etRuntime::IRTObject* parent, const std::string& name);");
+ _builder.append("(etRuntime::IRTObject* parent, const String& name);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("void initialize(void);");
@@ -542,7 +540,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("\t");
_builder.append("Replicated");
_builder.append(clsname, "\t");
- _builder.append("(IRTObject* parent, const std::string& name) :");
+ _builder.append("(IRTObject* parent, const String& name) :");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("ReplicatedActorClassBase(parent, name) {}");
@@ -552,7 +550,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append("protected:");
_builder.newLine();
_builder.append("\t");
- _builder.append("ActorClassBase* createActor(IRTObject* parent, const std::string& name) {");
+ _builder.append("ActorClassBase* createActor(IRTObject* parent, const String& name) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return new ");
@@ -770,7 +768,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
_builder.append(clsname, "");
_builder.append("::");
_builder.append(clsname, "");
- _builder.append("(etRuntime::IRTObject* parent, const std::string& name)");
+ _builder.append("(etRuntime::IRTObject* parent, const String& name)");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(ac);
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java
index 8b127a7db..74632625e 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java
@@ -255,7 +255,7 @@ public class NodeGen {
_builder.newLine();
_builder.append("\t\t");
_builder.append(clsname, "\t\t");
- _builder.append("(IRTObject* parent, const std::string& name);");
+ _builder.append("(IRTObject* parent, const String& name);");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("~");
@@ -472,7 +472,7 @@ public class NodeGen {
_builder.append(clsname, "");
_builder.append("::");
_builder.append(clsname, "");
- _builder.append("(IRTObject* parent, const std::string& name)");
+ _builder.append("(IRTObject* parent, const String& name)");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(cc);
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java
index 8a3c52ab3..715a31c75 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java
@@ -186,6 +186,14 @@ public class NodeRunnerGen {
_builder.newLineIfNotEmpty();
_builder.append("#include \"common/modelbase/RTSystem.h\"");
_builder.newLine();
+ _builder.append("#include \"common/containers/String.h\"");
+ _builder.newLine();
+ _builder.append("#include \"common/containers/Vector.h\"");
+ _builder.newLine();
+ _builder.append("#include \"common/containers/Set.h\"");
+ _builder.newLine();
+ _builder.append("#include \"common/containers/Map.h\"");
+ _builder.newLine();
_builder.newLine();
_builder.append("using namespace etRuntime;");
_builder.newLine();
@@ -252,6 +260,29 @@ public class NodeRunnerGen {
_builder.append("\t");
_builder.append("//delete sys;");
_builder.newLine();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("printf(\"String allocations %d and deallocations %d\\n\", etRuntime::String::getNAllocations(), etRuntime::String::getNDeallocations());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("printf(\"String creations %d and destructions %d\\n\", etRuntime::String::getNCreated(), etRuntime::String::getNDestroyed());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("printf(\"Vector allocations %d and deallocations %d\\n\", etRuntime::VectorStats::getNAllocations(), etRuntime::VectorStats::getNDeallocations());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("printf(\"Vector creations %d and destructions %d\\n\", etRuntime::VectorStats::getNCreated(), etRuntime::VectorStats::getNDestroyed());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("printf(\"Set creations %d and destructions %d\\n\", etRuntime::SetStats::getNCreated(), etRuntime::SetStats::getNDestroyed());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("printf(\"Map creations %d and destructions %d\\n\", etRuntime::MapStats::getNCreated(), etRuntime::MapStats::getNDestroyed());");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("fflush(stdout);");
+ _builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("return 0;");
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
index 3da64299f..a1a46c78d 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java
@@ -269,14 +269,14 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("static const std::string& getMessageString(int msg_id);");
+ _builder.append("static const etRuntime::String& getMessageString(int msg_id);");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("private:");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("static const std::string s_messageStrings[];");
+ _builder.append("static const etRuntime::String s_messageStrings[];");
_builder.newLine();
_builder.newLine();
_builder.append("};");
@@ -337,11 +337,11 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("\t ");
_builder.append(portClassName, "\t ");
- _builder.append("(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId);");
+ _builder.append("(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);");
_builder.newLineIfNotEmpty();
_builder.append("\t ");
_builder.append(portClassName, "\t ");
- _builder.append("(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId, int idx);");
+ _builder.append("(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId, int idx);");
_builder.newLineIfNotEmpty();
_builder.newLine();
{
@@ -417,7 +417,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("\t\t");
_builder.append(replPortClassName, "\t\t");
- _builder.append("(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId);");
+ _builder.append("(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t\t");
@@ -469,7 +469,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("protected:");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) {");
+ _builder.append("virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const etRuntime::String& name, int lid, int idx) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("return new ");
@@ -527,10 +527,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("#include \"common/modelbase/IEventReceiver.h\"");
_builder.newLine();
- _builder.append("#include <iterator>");
- _builder.newLine();
- _builder.append("#include <vector>");
- _builder.newLine();
_builder.newLine();
_builder.append("using namespace etRuntime;");
_builder.newLine();
@@ -545,7 +541,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.newLine();
_builder.append("/* message names as strings for debugging (generate MSC) */");
_builder.newLine();
- _builder.append("const std::string ");
+ _builder.append("const String ");
String _name_1 = pc.getName();
_builder.append(_name_1, "");
_builder.append("::s_messageStrings[] = {\"MIN\", ");
@@ -571,7 +567,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\"MAX\"};");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("const std::string& ");
+ _builder.append("const String& ");
String _name_4 = pc.getName();
_builder.append(_name_4, "");
_builder.append("::getMessageString(int msg_id) {");
@@ -589,7 +585,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("// id out of range");
_builder.newLine();
_builder.append("\t\t");
- _builder.append("static const std::string errorMsg = \"Message ID out of range\";");
+ _builder.append("static const String errorMsg = \"Message ID out of range\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return errorMsg;");
@@ -637,7 +633,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(portClassName, "");
_builder.append("::");
_builder.append(portClassName, "");
- _builder.append("(IInterfaceItemOwner* actor, const std::string& name, int localId)");
+ _builder.append("(IInterfaceItemOwner* actor, const String& name, int localId)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
CharSequence _generateConstructorInitalizerList = this.generateConstructorInitalizerList(pclass, "0");
@@ -651,7 +647,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(portClassName, "");
_builder.append("::");
_builder.append(portClassName, "");
- _builder.append("(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx)");
+ _builder.append("(IInterfaceItemOwner* actor, const String& name, int localId, int idx)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
CharSequence _generateConstructorInitalizerList_1 = this.generateConstructorInitalizerList(pclass, "idx");
@@ -713,7 +709,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("(msg->getEvtId())) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
- _builder.append("std::cout << \"unknown\" << std::endl;");
+ _builder.append("//std::cout << \"unknown\" << std::endl;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
@@ -727,7 +723,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), ");
String _name_1 = pc.getName();
_builder.append(_name_1, "\t");
- _builder.append("::getMessageString(msg->getEvtId()));");
+ _builder.append("::getMessageString(msg->getEvtId()).c_str());");
_builder.newLineIfNotEmpty();
}
}
@@ -841,7 +837,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append(replPortClassName, "");
_builder.append("::");
_builder.append(replPortClassName, "");
- _builder.append("(IInterfaceItemOwner* actor, const std::string& name, int localId) :");
+ _builder.append("(IInterfaceItemOwner* actor, const String& name, int localId) :");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("ReplicatedPortBase(actor, name, localId)");
@@ -863,7 +859,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("{");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {");
+ _builder.append("for (Vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("(dynamic_cast<");
@@ -891,7 +887,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("{");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- _builder.append("for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {");
+ _builder.append("for (Vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("(dynamic_cast<");
@@ -1141,15 +1137,16 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder_4.append("DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),");
_builder_4.newLine();
_builder_4.append("\t");
- _builder_4.append(portClassName, "\t");
+ _builder_4.append("\t");
+ _builder_4.append(portClassName, "\t\t");
_builder_4.append("::getMessageString(");
- _builder_4.append(portClassName, "\t");
+ _builder_4.append(portClassName, "\t\t");
_builder_4.append("::");
- _builder_4.append(dir, "\t");
+ _builder_4.append(dir, "\t\t");
_builder_4.append("_");
String _name_2 = m.getName();
- _builder_4.append(_name_2, "\t");
- _builder_4.append("));");
+ _builder_4.append(_name_2, "\t\t");
+ _builder_4.append(").c_str());");
_builder_4.newLineIfNotEmpty();
}
}
@@ -1273,7 +1270,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
String _portClassName_1 = this.roomExt.getPortClassName(pc, true);
_builder.append(_portClassName_1, "\t");
- _builder.append("(etRuntime::IRTObject* parent, const std::string& name, int localId);");
+ _builder.append("(etRuntime::IRTObject* parent, const etRuntime::String& name, int localId);");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
@@ -1366,7 +1363,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("\t");
String _portClassName_3 = this.roomExt.getPortClassName(pc, false);
_builder.append(_portClassName_3, "\t");
- _builder.append("(etRuntime::IRTObject* parent, const std::string& name, int localId);");
+ _builder.append("(etRuntime::IRTObject* parent, const etRuntime::String& name, int localId);");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
@@ -1478,7 +1475,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("::");
String _portClassName_1 = this.roomExt.getPortClassName(pc, true);
_builder.append(_portClassName_1, "");
- _builder.append("(IRTObject* parent, const std::string& name, int localId) :");
+ _builder.append("(IRTObject* parent, const String& name, int localId) :");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("DataSendPort(parent, name, localId)");
@@ -1498,7 +1495,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder.append("::");
String _portClassName_3 = this.roomExt.getPortClassName(pc, false);
_builder.append(_portClassName_3, "");
- _builder.append("(IRTObject* parent, const std::string& name, int localId) :");
+ _builder.append("(IRTObject* parent, const String& name, int localId) :");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("DataReceivePort(parent, name, localId),");
diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java
index 589160981..579716fe0 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java
@@ -58,7 +58,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) {
_builder.append("// state names");
_builder.newLine();
- _builder.append("const std::string ");
+ _builder.append("const String ");
_builder.append(clsName, "");
_builder.append("::s_stateStrings[] = {");
_builder.newLineIfNotEmpty();
@@ -106,7 +106,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation();
if (_isGenerateMSCInstrumentation) {
_builder.append("\t");
- _builder.append("DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]);");
+ _builder.append("DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state].c_str());");
_builder.newLine();
}
}
@@ -119,7 +119,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
- _builder.append("std::cout << getInstancePath() << \" -> \" << s_stateStrings[new_state] << std::endl;");
+ _builder.append("std::cout << getInstancePath().c_str() << \" -> \" << s_stateStrings[new_state].c_str() << std::endl;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
@@ -136,7 +136,7 @@ public class StateMachineGen extends GenericStateMachineGenerator {
StringConcatenation _builder_1 = new StringConcatenation();
{
if ((Main.getSettings().isGenerateMSCInstrumentation() || Main.getSettings().isGenerateWithVerboseOutput())) {
- _builder_1.append("static const std::string s_stateStrings[];");
+ _builder_1.append("static const String s_stateStrings[];");
_builder_1.newLine();
}
}

Back to the top