Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2016-12-21 05:33:52 -0500
committerJan Belle2016-12-21 05:33:52 -0500
commitf6535d3bcaf9be2039d9e4aeb98241165eb74102 (patch)
tree91a0bf87dd3bd901dd2defb234c7c74a4c2f749c
parent5dff0108d82e95f40b59da39e54246e6077a920c (diff)
downloadorg.eclipse.etrice-f6535d3bcaf9be2039d9e4aeb98241165eb74102.tar.gz
org.eclipse.etrice-f6535d3bcaf9be2039d9e4aeb98241165eb74102.tar.xz
org.eclipse.etrice-f6535d3bcaf9be2039d9e4aeb98241165eb74102.zip
[generator.cpp] Prepared cpp generator for extensions
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend18
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend5
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.java18
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.java9
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF1
5 files changed, 32 insertions, 19 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 4678467f0..cf705d93d 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
@@ -30,14 +30,14 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
- @Inject IGeneratorFileIo fileIO
- @Inject extension CppExtensions
- @Inject extension RoomExtensions
+ @Inject protected IGeneratorFileIo fileIO
+ @Inject protected extension CppExtensions
+ @Inject protected extension RoomExtensions
- @Inject extension ProcedureHelpers
- @Inject Initialization initHelper
- @Inject extension StateMachineGen
- @Inject extension FileSystemHelpers
+ @Inject protected extension ProcedureHelpers
+ @Inject protected Initialization initHelper
+ @Inject protected extension StateMachineGen
+ @Inject protected extension FileSystemHelpers
def doGenerate(Root root) {
val Map<ActorClass, WiredActorClass> ac2wired = newHashMap
@@ -53,7 +53,7 @@ class ActorClassGen extends GenericActorClassGenerator {
}
}
- def private generateHeaderFile(Root root, ExpandedActorClass xpac, WiredActorClass wired, boolean manualBehavior) {
+ def protected generateHeaderFile(Root root, ExpandedActorClass xpac, WiredActorClass wired, boolean manualBehavior) {
val ac = xpac.actorClass
val clsname = if (manualBehavior) "Abstract"+ac.name else ac.name
//val models = root.getReferencedModels(ac)
@@ -217,7 +217,7 @@ class ActorClassGen extends GenericActorClassGenerator {
}
- def private generateSourceFile(Root root, ExpandedActorClass xpac, WiredActorClass wired, boolean manualBehavior) {
+ def protected generateSourceFile(Root root, ExpandedActorClass xpac, WiredActorClass wired, boolean manualBehavior) {
val ac = xpac.actorClass
val clsname = if (manualBehavior) "Abstract"+ac.name else ac.name
//val models = root.getReferencedModels(ac)
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 39a997cf6..2f450c62e 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
@@ -380,10 +380,13 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
if (getPeerAddress().isValid()) {
««« we have to use a dynamic cast here because we have a virtual base class
Message* buffer = dynamic_cast<IMessageService*>(getPeerMsgReceiver())->getMessageBuffer(sizeof(«messageType»));
+««« // TODO JB: Handle buffer == NULL
if (buffer) {
getPeerMsgReceiver()->receive(«message»);
}
-««« // TODO JB: Handle buffer == NULL
+ else {
+ std::cout << "The message buffer is too small for the message!" << std::endl;
+ }
}
}
'''
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 16a83c080..9505a4fc0 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
@@ -58,30 +58,30 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@SuppressWarnings("all")
public class ActorClassGen extends GenericActorClassGenerator {
@Inject
- private IGeneratorFileIo fileIO;
+ protected IGeneratorFileIo fileIO;
@Inject
@Extension
- private CppExtensions _cppExtensions;
+ protected CppExtensions _cppExtensions;
@Inject
@Extension
- private RoomExtensions _roomExtensions;
+ protected RoomExtensions _roomExtensions;
@Inject
@Extension
- private ProcedureHelpers _procedureHelpers;
+ protected ProcedureHelpers _procedureHelpers;
@Inject
- private Initialization initHelper;
+ protected Initialization initHelper;
@Inject
@Extension
- private StateMachineGen _stateMachineGen;
+ protected StateMachineGen _stateMachineGen;
@Inject
@Extension
- private FileSystemHelpers _fileSystemHelpers;
+ protected FileSystemHelpers _fileSystemHelpers;
public void doGenerate(final Root root) {
final Map<ActorClass, WiredActorClass> ac2wired = CollectionLiterals.<ActorClass, WiredActorClass>newHashMap();
@@ -141,7 +141,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
}
}
- private CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) {
+ protected CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) {
CharSequence _xblockexpression = null;
{
final ActorClass ac = xpac.getActorClass();
@@ -695,7 +695,7 @@ public class ActorClassGen extends GenericActorClassGenerator {
return _xblockexpression;
}
- private CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) {
+ protected CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) {
CharSequence _xblockexpression = null;
{
final ActorClass ac = xpac.getActorClass();
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..85ed21f44 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
@@ -1172,6 +1172,15 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator {
_builder_4.append("\t\t");
_builder_4.append("}");
_builder_4.newLine();
+ _builder_4.append("\t\t");
+ _builder_4.append("else {");
+ _builder_4.newLine();
+ _builder_4.append("\t\t\t");
+ _builder_4.append("std::cout << \"The message buffer is too small for the message!\" << std::endl;");
+ _builder_4.newLine();
+ _builder_4.append("\t\t");
+ _builder_4.append("}");
+ _builder_4.newLine();
_builder_4.append("\t");
_builder_4.append("}");
_builder_4.newLine();
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
index 20253cdb5..8b3f109c7 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
@@ -21,3 +21,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.jdt.launching,
org.eclipse.ui.dialogs
Bundle-Vendor: Eclipse eTrice
+Export-Package: org.eclipse.etrice.generator.launch.cpp

Back to the top