Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend13
-rw-r--r--plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java32
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend14
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java8
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java28
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend10
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java26
8 files changed, 100 insertions, 33 deletions
diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
index e7b0e7588..0981c3ef4 100644
--- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
+++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
@@ -35,6 +35,7 @@ import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.etrice.core.config.ConfigModel
import com.google.inject.Inject
import org.eclipse.xtext.scoping.impl.ImportUriResolver
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
class DataConfiguration implements IDataConfiguration {
@@ -81,12 +82,12 @@ class DataConfiguration implements IDataConfiguration {
}
override getAttrInstanceConfigValue(ActorInstance ai, List<Attribute> path) {
- var id = ai.path+"/"+path.toStringPath
+ var id = ai.subsyspath+"/"+path.toStringPath
DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
override getAttrInstanceConfigValue(ActorInstance ai, InterfaceItem port, List<Attribute> path) {
- var id = ai.path+"/"+port.name+"/"+path.toStringPath
+ var id = ai.subsyspath+"/"+port.name+"/"+path.toStringPath
DataConfigurationHelper::actorInstanceAttrMap.get(id)?.value?.toStringExpr
}
@@ -177,4 +178,12 @@ class DataConfiguration implements IDataConfiguration {
}
}
+ // TODO: this has to be replaced by a simple ai.path later
+ def subsyspath(ActorInstance ai) {
+ var parent = ai.eContainer
+ while (! (parent instanceof SubSystemInstance))
+ parent = parent.eContainer
+ ai.path.replaceFirst("/[a-zA-Z_]+/", "/"+(parent as SubSystemInstance).subSystemClass.name+"/")
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
index 45e8f6405..be5d41bf6 100644
--- a/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
+++ b/plugins/org.eclipse.etrice.generator.config/xtend-gen/org/eclipse/etrice/generator/config/DataConfiguration.java
@@ -24,6 +24,7 @@ import org.eclipse.etrice.core.config.StringLiteral;
import org.eclipse.etrice.core.config.SubSystemConfig;
import org.eclipse.etrice.core.genmodel.base.ILogger;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.InterfaceItem;
@@ -139,8 +140,8 @@ public class DataConfiguration implements IDataConfiguration {
public String getAttrInstanceConfigValue(final ActorInstance ai, final List<Attribute> path) {
String _xblockexpression = null;
{
- String _path = ai.getPath();
- String _plus = (_path + "/");
+ String _subsyspath = this.subsyspath(ai);
+ String _plus = (_subsyspath + "/");
String _stringPath = this.toStringPath(path);
String id = (_plus + _stringPath);
AttrInstanceConfig _get = DataConfigurationHelper.actorInstanceAttrMap.get(id);
@@ -154,8 +155,8 @@ public class DataConfiguration implements IDataConfiguration {
public String getAttrInstanceConfigValue(final ActorInstance ai, final InterfaceItem port, final List<Attribute> path) {
String _xblockexpression = null;
{
- String _path = ai.getPath();
- String _plus = (_path + "/");
+ String _subsyspath = this.subsyspath(ai);
+ String _plus = (_subsyspath + "/");
String _name = port.getName();
String _plus_1 = (_plus + _name);
String _plus_2 = (_plus_1 + "/");
@@ -369,4 +370,27 @@ public class DataConfiguration implements IDataConfiguration {
}
}
}
+
+ public String subsyspath(final ActorInstance ai) {
+ String _xblockexpression = null;
+ {
+ EObject parent = ai.eContainer();
+ boolean _not = (!(parent instanceof SubSystemInstance));
+ boolean _while = _not;
+ while (_while) {
+ EObject _eContainer = parent.eContainer();
+ parent = _eContainer;
+ boolean _not_1 = (!(parent instanceof SubSystemInstance));
+ _while = _not_1;
+ }
+ String _path = ai.getPath();
+ SubSystemClass _subSystemClass = ((SubSystemInstance) parent).getSubSystemClass();
+ String _name = _subSystemClass.getName();
+ String _plus = ("/" + _name);
+ String _plus_1 = (_plus + "/");
+ String _replaceFirst = _path.replaceFirst("/[a-zA-Z_]+/", _plus_1);
+ _xblockexpression = (_replaceFirst);
+ }
+ return _xblockexpression;
+ }
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend
index c4dbabbf2..498b1f3c7 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.xtend
@@ -168,7 +168,7 @@ class SubSystemClassGen {
«ENDIF»
«ENDFOR»
}
- «IF !dataConfigExt.getDynConfigWriteAttributes(ai.path).empty»
+ «IF !dataConfigExt.getDynConfigWriteAttributes(ai.subsyspath).empty»
, variableService
«ENDIF»
);
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
index 0377ef4e2..12be3060a 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
@@ -56,7 +56,7 @@ class VariableServiceGen {
def private generate(Root root, SubSystemInstance comp) {
val cc = comp.subSystemClass
val aisAttrMap = new HashMap<ActorInstance, List<Attribute>>
- comp.allContainedInstances.forEach(ai | if(!configExt.getDynConfigReadAttributes(ai.path).empty)aisAttrMap.put(ai, configExt.getDynConfigReadAttributes(ai.path)))
+ comp.allContainedInstances.forEach(ai | if(!configExt.getDynConfigReadAttributes(ai.subsyspath).empty)aisAttrMap.put(ai, configExt.getDynConfigReadAttributes(ai.subsyspath)))
'''
package «cc.getPackage()»;
@@ -173,7 +173,7 @@ class VariableServiceGen {
def private getDynConfigDataClasses(Iterable<ActorInstance> ais){
val result = new HashSet<DataClass>
- ais.forEach(ai | configExt.getDynConfigReadAttributes(ai.path).
+ ais.forEach(ai | configExt.getDynConfigReadAttributes(ai.subsyspath).
forEach(a | if(a.refType.type.dataClass)result.add(a.refType.type as DataClass)
))
return result
@@ -202,13 +202,13 @@ class VariableServiceGen {
}
def private getVarName(ActorInstance ai){
- '''«FOR p : ai.path.split('/').drop(2) SEPARATOR '_'»«p»«ENDFOR»'''
+ '''«FOR p : ai.subsyspath.split('/').drop(2) SEPARATOR '_'»«p»«ENDFOR»'''
}
def private genGetAttributeValues(List<Attribute> path, ActorInstance ai){
var a = path.last
if(a.refType.type.primitive){'''
- values.put("«ai.path»«path.toAbsolutePath('/')»", «IF a.size>0»toObjectArray(«ENDIF»«ai.varName».«path.invokeGetters(null)»«IF a.size>0»)«ENDIF»);
+ values.put("«ai.subsyspath»«path.toAbsolutePath('/')»", «IF a.size>0»toObjectArray(«ENDIF»«ai.varName».«path.invokeGetters(null)»«IF a.size>0»)«ENDIF»);
'''
} else if(a.refType.type.dataClass){
var dataClass = (a.refType.type as DataClass)
@@ -224,7 +224,7 @@ class VariableServiceGen {
var a = path.last
var aVarName = path.toAbsolutePath("_")
if(a.refType.type.primitive){'''
- id = "«ai.path»«path.toAbsolutePath("/")»";
+ id = "«ai.subsyspath»«path.toAbsolutePath("/")»";
«IF a.size==0»«a.refType.type.typeName.toWrapper»«ELSE»«a.refType.type.typeName»[]«ENDIF» «aVarName» = null;
object = values.get(id);
if(object != null){
@@ -253,7 +253,7 @@ class VariableServiceGen {
'''
if(«aVarName» != null){
«ai.varName».«getters»«invokeSetter(a.name, null, aVarName)»;
- getDiffMap().put("«ai.path»«path.toAbsolutePath("/")»", «aVarName»);
+ getDiffMap().put("«ai.subsyspath»«path.toAbsolutePath("/")»", «aVarName»);
}
'''
} else if(a.refType.type.dataClass){
@@ -265,6 +265,4 @@ class VariableServiceGen {
'''
}
}
-
-
}
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java
index 2e6666ded..e524b6e86 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/SubSystemClassGen.java
@@ -571,8 +571,8 @@ public class SubSystemClassGen {
_builder.append("}");
_builder.newLine();
{
- String _path_10 = ai_2.getPath();
- List<Attribute> _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(_path_10);
+ String _subsyspath = this._roomExtensions.subsyspath(ai_2);
+ List<Attribute> _dynConfigWriteAttributes = this.dataConfigExt.getDynConfigWriteAttributes(_subsyspath);
boolean _isEmpty_5 = _dynConfigWriteAttributes.isEmpty();
boolean _not_2 = (!_isEmpty_5);
if (_not_2) {
@@ -684,8 +684,8 @@ public class SubSystemClassGen {
}
_builder.append("\t\t\t\t\t");
_builder.append("addr_item_");
- String _path_11 = ai_5.getPath();
- String _pathName_8 = this._roomExtensions.getPathName(_path_11);
+ String _path_10 = ai_5.getPath();
+ String _pathName_8 = this._roomExtensions.getPathName(_path_10);
_builder.append(_pathName_8, " ");
_builder.newLineIfNotEmpty();
}
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
index ca85ccda1..c46e0a43b 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/VariableServiceGen.java
@@ -88,13 +88,13 @@ public class VariableServiceGen {
EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances();
final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() {
public void apply(final ActorInstance ai) {
- String _path = ai.getPath();
- List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_path);
+ String _subsyspath = VariableServiceGen.this.roomExt.subsyspath(ai);
+ List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_subsyspath);
boolean _isEmpty = _dynConfigReadAttributes.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
- String _path_1 = ai.getPath();
- List<Attribute> _dynConfigReadAttributes_1 = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_path_1);
+ String _subsyspath_1 = VariableServiceGen.this.roomExt.subsyspath(ai);
+ List<Attribute> _dynConfigReadAttributes_1 = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_subsyspath_1);
aisAttrMap.put(ai, _dynConfigReadAttributes_1);
}
}
@@ -537,8 +537,8 @@ public class VariableServiceGen {
final HashSet<DataClass> result = _hashSet;
final Procedure1<ActorInstance> _function = new Procedure1<ActorInstance>() {
public void apply(final ActorInstance ai) {
- String _path = ai.getPath();
- List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_path);
+ String _subsyspath = VariableServiceGen.this.roomExt.subsyspath(ai);
+ List<Attribute> _dynConfigReadAttributes = VariableServiceGen.this.configExt.getDynConfigReadAttributes(_subsyspath);
final Procedure1<Attribute> _function = new Procedure1<Attribute>() {
public void apply(final Attribute a) {
RefableType _refType = a.getRefType();
@@ -623,8 +623,8 @@ public class VariableServiceGen {
private CharSequence getVarName(final ActorInstance ai) {
StringConcatenation _builder = new StringConcatenation();
{
- String _path = ai.getPath();
- String[] _split = _path.split("/");
+ String _subsyspath = this.roomExt.subsyspath(ai);
+ String[] _split = _subsyspath.split("/");
Iterable<String> _drop = IterableExtensions.<String>drop(((Iterable<String>)Conversions.doWrapArray(_split)), 2);
boolean _hasElements = false;
for(final String p : _drop) {
@@ -650,8 +650,8 @@ public class VariableServiceGen {
if (_isPrimitive) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("values.put(\"");
- String _path = ai.getPath();
- _builder.append(_path, "");
+ String _subsyspath = this.roomExt.subsyspath(ai);
+ _builder.append(_subsyspath, "");
String _absolutePath = this.toAbsolutePath(path, "/");
_builder.append(_absolutePath, "");
_builder.append("\", ");
@@ -721,8 +721,8 @@ public class VariableServiceGen {
if (_isPrimitive) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("id = \"");
- String _path = ai.getPath();
- _builder.append(_path, "");
+ String _subsyspath = this.roomExt.subsyspath(ai);
+ _builder.append(_subsyspath, "");
String _absolutePath = this.toAbsolutePath(path, "/");
_builder.append(_absolutePath, "");
_builder.append("\";");
@@ -902,8 +902,8 @@ public class VariableServiceGen {
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("getDiffMap().put(\"");
- String _path = ai.getPath();
- _builder.append(_path, " ");
+ String _subsyspath = this.roomExt.subsyspath(ai);
+ _builder.append(_subsyspath, " ");
String _absolutePath = this.toAbsolutePath(path, "/");
_builder.append(_absolutePath, " ");
_builder.append("\", ");
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
index 3ca6b8f36..773a6b842 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
@@ -55,6 +55,8 @@ import org.eclipse.etrice.core.room.Trigger
import static org.eclipse.etrice.generator.base.CodegenHelpers.*
import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
+import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
@Singleton
class RoomExtensions {
@@ -594,4 +596,12 @@ class RoomExtensions {
return result;
}
+ // TODO: this has to be replaced by a simple ai.path later
+ def subsyspath(ActorInstance ai) {
+ var parent = ai.eContainer
+ while (! (parent instanceof SubSystemInstance))
+ parent = parent.eContainer
+ ai.path.replaceFirst("/[a-zA-Z_]+/", "/"+(parent as SubSystemInstance).subSystemClass.name+"/")
+ }
+
}
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
index 9c1dd65dd..64010b7e1 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
@@ -12,12 +12,14 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
+import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedRefinedState;
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.PortInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SAPInstance;
import org.eclipse.etrice.core.genmodel.etricegen.ServiceImplInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.TransitionChain;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
@@ -42,6 +44,7 @@ import org.eclipse.etrice.core.room.SimpleState;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.TransitionPoint;
@@ -960,6 +963,29 @@ public class RoomExtensions {
return result;
}
+ public String subsyspath(final ActorInstance ai) {
+ String _xblockexpression = null;
+ {
+ EObject parent = ai.eContainer();
+ boolean _not = (!(parent instanceof SubSystemInstance));
+ boolean _while = _not;
+ while (_while) {
+ EObject _eContainer = parent.eContainer();
+ parent = _eContainer;
+ boolean _not_1 = (!(parent instanceof SubSystemInstance));
+ _while = _not_1;
+ }
+ String _path = ai.getPath();
+ SubSystemClass _subSystemClass = ((SubSystemInstance) parent).getSubSystemClass();
+ String _name = _subSystemClass.getName();
+ String _plus = ("/" + _name);
+ String _plus_1 = (_plus + "/");
+ String _replaceFirst = _path.replaceFirst("/[a-zA-Z_]+/", _plus_1);
+ _xblockexpression = (_replaceFirst);
+ }
+ return _xblockexpression;
+ }
+
public String getPortClassName(final EObject p) {
if (p instanceof Port) {
return _getPortClassName((Port)p);

Back to the top