summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2012-12-02 10:50:36 (EST)
committerJuergen Haug2012-12-02 10:50:36 (EST)
commit221cfc29f137c157786e59fcb3682dff4d5cdf89 (patch)
treede063c3a4e8a68c8e8f0916237ba839175e483f2
parent0c867067796120692fe7ac075245da5296831cd7 (diff)
downloadorg.eclipse.etrice-221cfc29f137c157786e59fcb3682dff4d5cdf89.zip
org.eclipse.etrice-221cfc29f137c157786e59fcb3682dff4d5cdf89.tar.gz
org.eclipse.etrice-221cfc29f137c157786e59fcb3682dff4d5cdf89.tar.bz2
[CQ][generator, config] fixes attribute generationrefs/changes/93/8993/1
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend17
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java55
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend8
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend16
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java20
-rw-r--r--plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java70
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend37
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java86
8 files changed, 185 insertions, 124 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
index be04a9c..14b16a1 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Initialization.xtend
@@ -23,7 +23,7 @@ import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.ExternalType
import org.eclipse.etrice.core.room.PrimitiveType
-import org.eclipse.etrice.generator.base.IDataConfiguration
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
@@ -32,7 +32,6 @@ class Initialization {
@Inject CExtensions languageExt
@Inject extension RoomExtensions
@Inject extension TypeHelpers
- @Inject IDataConfiguration dataExt
def generateAttributeInit(InstanceBase instance, List<Attribute> attributes){'''
FOR a : attributes SEPARATOR ','
@@ -85,21 +84,15 @@ class Initialization {
}
def private getPrimitiveValue(InstanceBase instance, List<Attribute> path){
- var value = switch instance {
- ActorInstance: dataExt.getAttrInstanceConfigValue(instance, path)
- InterfaceItemInstance: dataExt.getAttrInstanceConfigValue(instance, path)
- }
+ var value = path.getAttrInstanceConfigValue(instance)
if(value == null)
value = switch instance {
- ActorInstance: dataExt.getAttrClassConfigValue(instance.actorClass, path)
- InterfaceItemInstance: dataExt.getAttrClassConfigValue(instance.protocol, !instance.conjugated, path)
- }
+ ActorInstance: path.getAttrClassConfigValue(instance.actorClass, true)
+ InterfaceItemInstance: path.getAttrClassConfigValue(RoomHelpers::getPortClass(instance.interfaceItem))
+ }
if(value == null)
value = path.last.defaultValueLiteral
return if(value != null) languageExt.toValueLiteral(path.last.refType.type as PrimitiveType, value)
else languageExt.defaultValue(path.last.refType.type)
}
-
-
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
index 98fb2a4..6f42a10 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/Initialization.java
@@ -12,10 +12,11 @@ import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DataType;
import org.eclipse.etrice.core.room.ExternalType;
+import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.PrimitiveType;
-import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.generator.base.IDataConfiguration;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.generator.c.gen.CExtensions;
import org.eclipse.etrice.generator.generic.RoomExtensions;
import org.eclipse.etrice.generator.generic.TypeHelpers;
@@ -34,9 +35,6 @@ public class Initialization {
@Inject
private TypeHelpers _typeHelpers;
- @Inject
- private IDataConfiguration dataExt;
-
public CharSequence generateAttributeInit(final InstanceBase instance, final List<Attribute> attributes) {
StringConcatenation _builder = new StringConcatenation();
{
@@ -256,50 +254,31 @@ public class Initialization {
}
private String getPrimitiveValue(final InstanceBase instance, final List<Attribute> path) {
- String _switchResult = null;
- boolean _matched = false;
- if (!_matched) {
- if (instance instanceof ActorInstance) {
- final ActorInstance _actorInstance = (ActorInstance)instance;
- _matched=true;
- String _attrInstanceConfigValue = this.dataExt.getAttrInstanceConfigValue(_actorInstance, path);
- _switchResult = _attrInstanceConfigValue;
- }
- }
- if (!_matched) {
- if (instance instanceof InterfaceItemInstance) {
- final InterfaceItemInstance _interfaceItemInstance = (InterfaceItemInstance)instance;
- _matched=true;
- String _attrInstanceConfigValue = this.dataExt.getAttrInstanceConfigValue(_interfaceItemInstance, path);
- _switchResult = _attrInstanceConfigValue;
- }
- }
- String value = _switchResult;
+ String value = this._typeHelpers.getAttrInstanceConfigValue(path, instance);
boolean _equals = Objects.equal(value, null);
if (_equals) {
- String _switchResult_1 = null;
- boolean _matched_1 = false;
- if (!_matched_1) {
+ String _switchResult = null;
+ boolean _matched = false;
+ if (!_matched) {
if (instance instanceof ActorInstance) {
final ActorInstance _actorInstance = (ActorInstance)instance;
- _matched_1=true;
+ _matched=true;
ActorClass _actorClass = _actorInstance.getActorClass();
- String _attrClassConfigValue = this.dataExt.getAttrClassConfigValue(_actorClass, path);
- _switchResult_1 = _attrClassConfigValue;
+ String _attrClassConfigValue = this._typeHelpers.getAttrClassConfigValue(path, _actorClass, true);
+ _switchResult = _attrClassConfigValue;
}
}
- if (!_matched_1) {
+ if (!_matched) {
if (instance instanceof InterfaceItemInstance) {
final InterfaceItemInstance _interfaceItemInstance = (InterfaceItemInstance)instance;
- _matched_1=true;
- ProtocolClass _protocol = _interfaceItemInstance.getProtocol();
- boolean _isConjugated = this._roomExtensions.isConjugated(_interfaceItemInstance);
- boolean _not = (!_isConjugated);
- String _attrClassConfigValue = this.dataExt.getAttrClassConfigValue(_protocol, _not, path);
- _switchResult_1 = _attrClassConfigValue;
+ _matched=true;
+ InterfaceItem _interfaceItem = _interfaceItemInstance.getInterfaceItem();
+ PortClass _portClass = RoomHelpers.getPortClass(_interfaceItem);
+ String _attrClassConfigValue = this._typeHelpers.getAttrClassConfigValue(path, _portClass);
+ _switchResult = _attrClassConfigValue;
}
}
- value = _switchResult_1;
+ value = _switchResult;
}
boolean _equals_1 = Objects.equal(value, null);
if (_equals_1) {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
index 14104c1..ed83450 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.xtend
@@ -17,16 +17,15 @@ import java.util.ArrayList
import java.util.List
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance
import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase
-import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.PrimitiveType
+import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.base.IDataConfiguration
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.core.room.util.RoomHelpers
class ConfigGenAddon {
@@ -57,10 +56,7 @@ class ConfigGenAddon {
var a = path.last
var aType = a.refType.type
if(aType.primitive){
- var value = switch instance {
- ActorInstance: dataConfigExt.getAttrInstanceConfigValue(instance, path)
- InterfaceItemInstance: dataConfigExt.getAttrInstanceConfigValue(instance, path)
- }
+ var value = typeHelpers.getAttrInstanceConfigValue(path, instance)
if(value == null)
''''''
else if(a.size == 0 || aType.characterType)
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend
index a57d6a7..32a9a79 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Initialization.xtend
@@ -17,17 +17,15 @@ import com.google.inject.Singleton
import java.util.ArrayList
import java.util.List
import org.eclipse.emf.ecore.EObject
+import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.PortClass
import org.eclipse.etrice.core.room.PrimitiveType
-import org.eclipse.etrice.generator.base.IDataConfiguration
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.core.room.ActorClass
-import org.eclipse.etrice.core.room.PortClass
-import org.eclipse.etrice.core.room.ProtocolClass
@Singleton
class Initialization {
@@ -36,7 +34,6 @@ class Initialization {
@Inject extension RoomExtensions
@Inject extension ILanguageExtension languageExt
@Inject extension ProcedureHelpers procedureHelpers
- @Inject IDataConfiguration dataConfigExt
def attributeInitialization(List<Attribute> attribs, EObject roomClass, boolean useClassDefaultsOnly) {
'''
@@ -53,7 +50,7 @@ class Initialization {
if(a.refType.ref){
if(a.defaultValueLiteral != null)
attributeInit(a, a.defaultValueLiteral)
- else
+ else if(!(useClassDefaultsOnly && aType.primitive))
attributeInit(a, languageExt.nullPointer)
}
else{
@@ -111,12 +108,9 @@ class Initialization {
def private getDataConfigValue(List<Attribute> path, EObject roomClass){
return switch roomClass{
ActorClass:
- dataConfigExt.getAttrClassConfigValue(roomClass, path)
+ typeHelpers.getAttrClassConfigValue(path, roomClass, false)
PortClass:
- if(roomClass.eContainer instanceof ProtocolClass){
- var pc = roomClass.eContainer as ProtocolClass
- dataConfigExt.getAttrClassConfigValue(pc, pc.regular?.equals(roomClass), path)
- }
+ typeHelpers.getAttrClassConfigValue(path, roomClass)
DataClass: null
}
}
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
index abec49f..bb09829 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ConfigGenAddon.java
@@ -98,25 +98,7 @@ public class ConfigGenAddon {
if (_isPrimitive) {
CharSequence _xblockexpression_1 = null;
{
- String _switchResult = null;
- boolean _matched = false;
- if (!_matched) {
- if (instance instanceof ActorInstance) {
- final ActorInstance _actorInstance = (ActorInstance)instance;
- _matched=true;
- String _attrInstanceConfigValue = this.dataConfigExt.getAttrInstanceConfigValue(_actorInstance, path);
- _switchResult = _attrInstanceConfigValue;
- }
- }
- if (!_matched) {
- if (instance instanceof InterfaceItemInstance) {
- final InterfaceItemInstance _interfaceItemInstance = (InterfaceItemInstance)instance;
- _matched=true;
- String _attrInstanceConfigValue = this.dataConfigExt.getAttrInstanceConfigValue(_interfaceItemInstance, path);
- _switchResult = _attrInstanceConfigValue;
- }
- }
- String value = _switchResult;
+ String value = this.typeHelpers.getAttrInstanceConfigValue(path, instance);
CharSequence _xifexpression_1 = null;
boolean _equals = Objects.equal(value, null);
if (_equals) {
diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java
index 157792b..cd9a452 100644
--- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java
+++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/Initialization.java
@@ -12,9 +12,7 @@ import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DataType;
import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.PrimitiveType;
-import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
-import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.etrice.generator.generic.ProcedureHelpers;
import org.eclipse.etrice.generator.generic.RoomExtensions;
@@ -37,9 +35,6 @@ public class Initialization {
@Inject
private ProcedureHelpers procedureHelpers;
- @Inject
- private IDataConfiguration dataConfigExt;
-
public CharSequence attributeInitialization(final List<Attribute> attribs, final EObject roomClass, final boolean useClassDefaultsOnly) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("// initialize attributes");
@@ -83,15 +78,27 @@ public class Initialization {
CharSequence _attributeInit = this.attributeInit(a, _defaultValueLiteral_1);
_xifexpression_1 = _attributeInit;
} else {
- String _nullPointer = this.languageExt.nullPointer();
- CharSequence _attributeInit_1 = this.attributeInit(a, _nullPointer);
- _xifexpression_1 = _attributeInit_1;
+ CharSequence _xifexpression_2 = null;
+ boolean _and = false;
+ if (!useClassDefaultsOnly) {
+ _and = false;
+ } else {
+ boolean _isPrimitive = this.typeHelpers.isPrimitive(aType);
+ _and = (useClassDefaultsOnly && _isPrimitive);
+ }
+ boolean _not = (!_and);
+ if (_not) {
+ String _nullPointer = this.languageExt.nullPointer();
+ CharSequence _attributeInit_1 = this.attributeInit(a, _nullPointer);
+ _xifexpression_2 = _attributeInit_1;
+ }
+ _xifexpression_1 = _xifexpression_2;
}
_xifexpression = _xifexpression_1;
} else {
- CharSequence _xifexpression_2 = null;
- boolean _isPrimitive = this.typeHelpers.isPrimitive(aType);
- if (_isPrimitive) {
+ CharSequence _xifexpression_3 = null;
+ boolean _isPrimitive_1 = this.typeHelpers.isPrimitive(aType);
+ if (_isPrimitive_1) {
CharSequence _xblockexpression_1 = null;
{
ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
@@ -102,31 +109,31 @@ public class Initialization {
String _defaultValueLiteral_2 = a.getDefaultValueLiteral();
value = _defaultValueLiteral_2;
}
- CharSequence _xifexpression_3 = null;
+ CharSequence _xifexpression_4 = null;
boolean _notEquals_1 = (!Objects.equal(value, null));
if (_notEquals_1) {
String _valueLiteral = this.languageExt.toValueLiteral(((PrimitiveType) aType), value);
CharSequence _attributeInit_2 = this.attributeInit(a, _valueLiteral);
- _xifexpression_3 = _attributeInit_2;
+ _xifexpression_4 = _attributeInit_2;
} else {
- CharSequence _xifexpression_4 = null;
- boolean _not = (!useClassDefaultsOnly);
- if (_not) {
+ CharSequence _xifexpression_5 = null;
+ boolean _not_1 = (!useClassDefaultsOnly);
+ if (_not_1) {
String _defaultValue = this.languageExt.defaultValue(aType);
CharSequence _attributeInit_3 = this.attributeInit(a, _defaultValue);
- _xifexpression_4 = _attributeInit_3;
+ _xifexpression_5 = _attributeInit_3;
}
- _xifexpression_3 = _xifexpression_4;
+ _xifexpression_4 = _xifexpression_5;
}
- _xblockexpression_1 = (_xifexpression_3);
+ _xblockexpression_1 = (_xifexpression_4);
}
- _xifexpression_2 = _xblockexpression_1;
+ _xifexpression_3 = _xblockexpression_1;
} else {
String _defaultValue = this.languageExt.defaultValue(aType);
CharSequence _attributeInit_2 = this.attributeInit(a, _defaultValue);
- _xifexpression_2 = _attributeInit_2;
+ _xifexpression_3 = _attributeInit_2;
}
- _xifexpression = _xifexpression_2;
+ _xifexpression = _xifexpression_3;
}
_xblockexpression = (_xifexpression);
}
@@ -283,7 +290,7 @@ public class Initialization {
if (roomClass instanceof ActorClass) {
final ActorClass _actorClass = (ActorClass)roomClass;
_matched=true;
- String _attrClassConfigValue = this.dataConfigExt.getAttrClassConfigValue(_actorClass, path);
+ String _attrClassConfigValue = this.typeHelpers.getAttrClassConfigValue(path, _actorClass, false);
_switchResult = _attrClassConfigValue;
}
}
@@ -291,21 +298,8 @@ public class Initialization {
if (roomClass instanceof PortClass) {
final PortClass _portClass = (PortClass)roomClass;
_matched=true;
- String _xifexpression = null;
- EObject _eContainer = _portClass.eContainer();
- if ((_eContainer instanceof ProtocolClass)) {
- String _xblockexpression = null;
- {
- EObject _eContainer_1 = _portClass.eContainer();
- ProtocolClass pc = ((ProtocolClass) _eContainer_1);
- PortClass _regular = pc.getRegular();
- boolean _equals = _regular==null?false:_regular.equals(_portClass);
- String _attrClassConfigValue = this.dataConfigExt.getAttrClassConfigValue(pc, _equals, path);
- _xblockexpression = (_attrClassConfigValue);
- }
- _xifexpression = _xblockexpression;
- }
- _switchResult = _xifexpression;
+ String _attrClassConfigValue = this.typeHelpers.getAttrClassConfigValue(path, _portClass);
+ _switchResult = _attrClassConfigValue;
}
}
if (!_matched) {
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
index 18b646f..9e6a86f 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TypeHelpers.xtend
@@ -19,17 +19,27 @@ package org.eclipse.etrice.generator.generic
import com.google.inject.Inject
import com.google.inject.Singleton
+import java.util.List
+import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
+import org.eclipse.etrice.core.room.ActorClass
+import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.DataType
import org.eclipse.etrice.core.room.ExternalType
import org.eclipse.etrice.core.room.LiteralType
+import org.eclipse.etrice.core.room.PortClass
import org.eclipse.etrice.core.room.PrimitiveType
import org.eclipse.etrice.core.room.VarDecl
+import org.eclipse.etrice.core.room.util.RoomHelpers
+import org.eclipse.etrice.generator.base.IDataConfiguration
@Singleton
class TypeHelpers {
@Inject ILanguageExtension languageExt
+ @Inject IDataConfiguration dataConfigExt
def String typeName(DataType type) {
if (type instanceof PrimitiveType)
@@ -71,4 +81,31 @@ class TypeHelpers {
def isCharacterType(DataType type){
return type.primitive && (type as PrimitiveType).characterType
}
+
+ def String getAttrInstanceConfigValue(List<Attribute> attributePath, InstanceBase instance){
+ switch instance {
+ ActorInstance: dataConfigExt.getAttrInstanceConfigValue(instance, attributePath)
+ InterfaceItemInstance: dataConfigExt.getAttrInstanceConfigValue(instance, attributePath)
+ }
+ }
+
+ def String getAttrClassConfigValue(List<Attribute> attributePath, ActorClass actor, boolean inherite){
+ var result = dataConfigExt.getAttrClassConfigValue(actor, attributePath)
+ if(result == null && inherite){
+ var base = actor.base
+ while(base != null && result == null){
+ result = dataConfigExt.getAttrClassConfigValue(base, attributePath)
+ base = base.base
+ }
+ }
+
+ return result
+ }
+
+ def String getAttrClassConfigValue(List<Attribute> attributePath, PortClass port){
+ var pc = RoomHelpers::getProtocolClass(port)
+ if(pc == null)
+ return null
+ return dataConfigExt.getAttrClassConfigValue(pc, port.equals(pc.regular), attributePath)
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
index 419fc7e..4a03666 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/TypeHelpers.java
@@ -4,13 +4,22 @@ import com.google.common.base.Objects;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
+import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
+import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DataType;
import org.eclipse.etrice.core.room.ExternalType;
import org.eclipse.etrice.core.room.LiteralType;
+import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.PrimitiveType;
+import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.VarDecl;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.xtext.xbase.lib.Conversions;
@@ -20,6 +29,9 @@ public class TypeHelpers {
@Inject
private ILanguageExtension languageExt;
+ @Inject
+ private IDataConfiguration dataConfigExt;
+
public String typeName(final DataType type) {
if ((type instanceof PrimitiveType)) {
return ((PrimitiveType) type).getTargetName();
@@ -81,4 +93,78 @@ public class TypeHelpers {
}
return _and;
}
+
+ public String getAttrInstanceConfigValue(final List<Attribute> attributePath, final InstanceBase instance) {
+ String _switchResult = null;
+ boolean _matched = false;
+ if (!_matched) {
+ if (instance instanceof ActorInstance) {
+ final ActorInstance _actorInstance = (ActorInstance)instance;
+ _matched=true;
+ String _attrInstanceConfigValue = this.dataConfigExt.getAttrInstanceConfigValue(_actorInstance, attributePath);
+ _switchResult = _attrInstanceConfigValue;
+ }
+ }
+ if (!_matched) {
+ if (instance instanceof InterfaceItemInstance) {
+ final InterfaceItemInstance _interfaceItemInstance = (InterfaceItemInstance)instance;
+ _matched=true;
+ String _attrInstanceConfigValue = this.dataConfigExt.getAttrInstanceConfigValue(_interfaceItemInstance, attributePath);
+ _switchResult = _attrInstanceConfigValue;
+ }
+ }
+ return _switchResult;
+ }
+
+ public String getAttrClassConfigValue(final List<Attribute> attributePath, final ActorClass actor, final boolean inherite) {
+ String result = this.dataConfigExt.getAttrClassConfigValue(actor, attributePath);
+ boolean _and = false;
+ boolean _equals = Objects.equal(result, null);
+ if (!_equals) {
+ _and = false;
+ } else {
+ _and = (_equals && inherite);
+ }
+ if (_and) {
+ ActorClass base = actor.getBase();
+ boolean _and_1 = false;
+ boolean _notEquals = (!Objects.equal(base, null));
+ if (!_notEquals) {
+ _and_1 = false;
+ } else {
+ boolean _equals_1 = Objects.equal(result, null);
+ _and_1 = (_notEquals && _equals_1);
+ }
+ boolean _while = _and_1;
+ while (_while) {
+ {
+ String _attrClassConfigValue = this.dataConfigExt.getAttrClassConfigValue(base, attributePath);
+ result = _attrClassConfigValue;
+ ActorClass _base = base.getBase();
+ base = _base;
+ }
+ boolean _and_2 = false;
+ boolean _notEquals_1 = (!Objects.equal(base, null));
+ if (!_notEquals_1) {
+ _and_2 = false;
+ } else {
+ boolean _equals_2 = Objects.equal(result, null);
+ _and_2 = (_notEquals_1 && _equals_2);
+ }
+ _while = _and_2;
+ }
+ }
+ return result;
+ }
+
+ public String getAttrClassConfigValue(final List<Attribute> attributePath, final PortClass port) {
+ ProtocolClass pc = RoomHelpers.getProtocolClass(port);
+ boolean _equals = Objects.equal(pc, null);
+ if (_equals) {
+ return null;
+ }
+ PortClass _regular = pc.getRegular();
+ boolean _equals_1 = port.equals(_regular);
+ return this.dataConfigExt.getAttrClassConfigValue(pc, _equals_1, attributePath);
+ }
}