diff options
author | Juergen Haug | 2015-07-14 15:51:25 +0000 |
---|---|---|
committer | Juergen Haug | 2015-07-15 09:18:46 +0000 |
commit | ae0407d0703e6c4cd69e0f674cc5b8b15e85acf6 (patch) | |
tree | 7cd7880529fbf99358451bb694a4c99627e6c581 /plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen | |
parent | 6efdfd0f82ed35ad37a655fa991300d1f1a179d5 (diff) | |
download | org.eclipse.etrice-ae0407d0703e6c4cd69e0f674cc5b8b15e85acf6.tar.gz org.eclipse.etrice-ae0407d0703e6c4cd69e0f674cc5b8b15e85acf6.tar.xz org.eclipse.etrice-ae0407d0703e6c4cd69e0f674cc5b8b15e85acf6.zip |
Bug 456617 added operation inheritance + new ctor/dtor model element
Change-Id: I99ec4385acc15011f266510094298628774904ac
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen')
2 files changed, 471 insertions, 593 deletions
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 7affb93a5..9f4550dec 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 @@ -17,7 +17,6 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; import org.eclipse.etrice.core.genmodel.etricegen.Root; import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; @@ -31,7 +30,6 @@ import org.eclipse.etrice.core.room.SAP; import org.eclipse.etrice.core.room.SPP; import org.eclipse.etrice.core.room.ServiceImplementation; import org.eclipse.etrice.core.room.StandardOperation; -import org.eclipse.etrice.generator.base.AbstractGenerator; import org.eclipse.etrice.generator.cpp.Main; import org.eclipse.etrice.generator.cpp.gen.CppExtensions; import org.eclipse.etrice.generator.cpp.gen.GeneratorSettings; @@ -349,7 +347,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t\t\t"); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(ac); + EList<StandardOperation> _operations = ac.getOperations(); + String _name_6 = ac.getName(); + CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_6); _builder.append(_operationsImplementation, "\t\t\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -361,8 +361,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("//--------------------- construction"); _builder.newLine(); _builder.append("\t\t\t"); - String _name_6 = ac.getName(); - _builder.append(_name_6, "\t\t\t"); + String _name_7 = ac.getName(); + _builder.append(_name_7, "\t\t\t"); _builder.append("(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr, "); _builder.newLineIfNotEmpty(); _builder.append("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t "); @@ -377,9 +377,9 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final Port ep : _endPorts_1) { _builder.append("\t\t"); String _portClassName = this._roomExtensions.getPortClassName(ep); - String _name_7 = ep.getName(); - String _name_8 = ac.getName(); - CharSequence _terImplementation = this._procedureHelpers.getterImplementation(_portClassName, _name_7, _name_8); + String _name_8 = ep.getName(); + String _name_9 = ac.getName(); + CharSequence _terImplementation = this._procedureHelpers.getterImplementation(_portClassName, _name_8, _name_9); _builder.append(_terImplementation, "\t\t"); _builder.newLineIfNotEmpty(); } @@ -389,9 +389,9 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final SAP sap : _serviceAccessPoints_1) { _builder.append("\t\t"); String _portClassName_1 = this._roomExtensions.getPortClassName(sap); - String _name_9 = sap.getName(); - String _name_10 = ac.getName(); - CharSequence _terImplementation_1 = this._procedureHelpers.getterImplementation(_portClassName_1, _name_9, _name_10); + String _name_10 = sap.getName(); + String _name_11 = ac.getName(); + CharSequence _terImplementation_1 = this._procedureHelpers.getterImplementation(_portClassName_1, _name_10, _name_11); _builder.append(_terImplementation_1, "\t\t"); _builder.newLineIfNotEmpty(); } @@ -402,9 +402,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); String _portClassName_2 = this._roomExtensions.getPortClassName(svc); SPP _spp = svc.getSpp(); - String _name_11 = _spp.getName(); - String _name_12 = ac.getName(); - CharSequence _terImplementation_2 = this._procedureHelpers.getterImplementation(_portClassName_2, _name_11, _name_12); + String _name_12 = _spp.getName(); + String _name_13 = ac.getName(); + CharSequence _terImplementation_2 = this._procedureHelpers.getterImplementation(_portClassName_2, _name_12, _name_13); _builder.append(_terImplementation_2, "\t\t"); _builder.newLineIfNotEmpty(); } @@ -475,8 +475,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.newLine(); _builder.append("\t"); - String _name_13 = ac.getName(); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_name_13); + String _name_14 = ac.getName(); + CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_name_14); _builder.append(_generateIncludeGuardEnd, "\t"); _builder.newLineIfNotEmpty(); return _builder; @@ -602,22 +602,6 @@ public class ActorClassGen extends GenericActorClassGenerator { private CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final ActorClass ac) { CharSequence _xblockexpression = null; { - EList<StandardOperation> _operations = ac.getOperations(); - final Function1<StandardOperation, Boolean> _function = new Function1<StandardOperation, Boolean>() { - public Boolean apply(final StandardOperation op) { - return Boolean.valueOf(ActorClassGen.this._roomHelpers.isConstructor(op)); - } - }; - Iterable<StandardOperation> _filter = IterableExtensions.<StandardOperation>filter(_operations, _function); - final StandardOperation ctor = IterableExtensions.<StandardOperation>head(_filter); - EList<StandardOperation> _operations_1 = ac.getOperations(); - final Function1<StandardOperation, Boolean> _function_1 = new Function1<StandardOperation, Boolean>() { - public Boolean apply(final StandardOperation op) { - return Boolean.valueOf(op.isDestructor()); - } - }; - Iterable<StandardOperation> _filter_1 = IterableExtensions.<StandardOperation>filter(_operations_1, _function_1); - final StandardOperation dtor = IterableExtensions.<StandardOperation>head(_filter_1); ActorClass _actorClass = xpac.getActorClass(); ComponentCommunicationType _commType = _actorClass.getCommType(); final boolean async = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); @@ -709,20 +693,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); } } - { - boolean _notEquals = (!Objects.equal(ctor, null)); - if (_notEquals) { - _builder.append("\t"); - _builder.append("// user defined constructor body"); - _builder.newLine(); - _builder.append("\t"); - AbstractGenerator _instance = AbstractGenerator.getInstance(); - DetailCode _detailCode = ctor.getDetailCode(); - String _translatedCode = _instance.getTranslatedCode(_detailCode); - _builder.append(_translatedCode, "\t"); - _builder.newLineIfNotEmpty(); - } - } _builder.append("}"); _builder.newLine(); _builder.newLine(); @@ -765,31 +735,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } _builder.newLine(); - _builder.append("void "); - String _name_7 = ac.getName(); - _builder.append(_name_7, ""); - _builder.append("::destroy(){"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals_1 = (!Objects.equal(dtor, null)); - if (_notEquals_1) { - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("// user defined destructor body"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - AbstractGenerator _instance_1 = AbstractGenerator.getInstance(); - DetailCode _detailCode_1 = dtor.getDetailCode(); - String _translatedCode_1 = _instance_1.getTranslatedCode(_detailCode_1); - _builder.append(_translatedCode_1, "\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("}"); - _builder.newLine(); _builder.newLine(); { boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac); @@ -804,8 +749,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("//--------------------- no state machine"); _builder.newLine(); _builder.append("void "); - String _name_8 = ac.getName(); - _builder.append(_name_8, ""); + String _name_7 = ac.getName(); + _builder.append(_name_7, ""); _builder.append("::receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data) {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -815,8 +760,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.newLine(); _builder.append("void "); - String _name_9 = ac.getName(); - _builder.append(_name_9, ""); + String _name_8 = ac.getName(); + _builder.append(_name_8, ""); _builder.append("::executeInitTransition(){"); _builder.newLineIfNotEmpty(); _builder.append("}"); diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java index af3743307..52ae2a728 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/DataClassGen.java @@ -36,8 +36,6 @@ import org.eclipse.etrice.generator.generic.TypeHelpers; import org.eclipse.xtend2.lib.StringConcatenation; import org.eclipse.xtext.generator.JavaIoFileSystemAccess; import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; /** * @author Peter Karlitschek @@ -109,550 +107,485 @@ public class DataClassGen { } public CharSequence generateHeaderFile(final Root root, final DataClass dc) { - CharSequence _xblockexpression = null; + StringConcatenation _builder = new StringConcatenation(); + String _path = this.roomExt.getPath(dc); + String _name = dc.getName(); + String _plus = (_path + _name); + CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(_plus); + _builder.append(_generateIncludeGuardBegin, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); { - EList<StandardOperation> _operations = dc.getOperations(); - final Function1<StandardOperation, Boolean> _function = new Function1<StandardOperation, Boolean>() { - public Boolean apply(final StandardOperation op) { - return Boolean.valueOf(DataClassGen.this._roomHelpers.isConstructor(op)); - } - }; - Iterable<StandardOperation> _filter = IterableExtensions.<StandardOperation>filter(_operations, _function); - final StandardOperation ctor = IterableExtensions.<StandardOperation>head(_filter); - EList<StandardOperation> _operations_1 = dc.getOperations(); - final Function1<StandardOperation, Boolean> _function_1 = new Function1<StandardOperation, Boolean>() { - public Boolean apply(final StandardOperation op) { - return Boolean.valueOf(op.isDestructor()); - } - }; - Iterable<StandardOperation> _filter_1 = IterableExtensions.<StandardOperation>filter(_operations_1, _function_1); - final StandardOperation dtor = IterableExtensions.<StandardOperation>head(_filter_1); - StringConcatenation _builder = new StringConcatenation(); - String _path = this.roomExt.getPath(dc); - String _name = dc.getName(); - String _plus = (_path + _name); - CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(_plus); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append("#include \""); - DataClass _base_1 = dc.getBase(); - String _path_1 = this.roomExt.getPath(_base_1); - _builder.append(_path_1, ""); - DataClass _base_2 = dc.getBase(); - String _name_1 = _base_2.getName(); - _builder.append(_name_1, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } + DataClass _base = dc.getBase(); + boolean _notEquals = (!Objects.equal(_base, null)); + if (_notEquals) { + _builder.append("#include \""); + DataClass _base_1 = dc.getBase(); + String _path_1 = this.roomExt.getPath(_base_1); + _builder.append(_path_1, ""); + DataClass _base_2 = dc.getBase(); + String _name_1 = _base_2.getName(); + _builder.append(_name_1, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); } - { - EList<DataClass> _referencedDataClasses = root.getReferencedDataClasses(dc); - for(final DataClass classes : _referencedDataClasses) { - _builder.append("#include \""); - String _path_2 = this.roomExt.getPath(classes); - _builder.append(_path_2, ""); - String _name_2 = classes.getName(); - _builder.append(_name_2, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } + } + { + EList<DataClass> _referencedDataClasses = root.getReferencedDataClasses(dc); + for(final DataClass classes : _referencedDataClasses) { + _builder.append("#include \""); + String _path_2 = this.roomExt.getPath(classes); + _builder.append(_path_2, ""); + String _name_2 = classes.getName(); + _builder.append(_name_2, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); } - EList<RoomModel> models = root.getReferencedModels(dc); - _builder.newLineIfNotEmpty(); - { - for(final RoomModel model : models) { - { - EList<DataClass> _dataClasses = model.getDataClasses(); - for(final DataClass classes_1 : _dataClasses) { - _builder.append("#include \""); - String _path_3 = this.roomExt.getPath(classes_1); - _builder.append(_path_3, ""); - String _name_3 = classes_1.getName(); - _builder.append(_name_3, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } + } + EList<RoomModel> models = root.getReferencedModels(dc); + _builder.newLineIfNotEmpty(); + { + for(final RoomModel model : models) { + { + EList<DataClass> _dataClasses = model.getDataClasses(); + for(final DataClass classes_1 : _dataClasses) { + _builder.append("#include \""); + String _path_3 = this.roomExt.getPath(classes_1); + _builder.append(_path_3, ""); + String _name_3 = classes_1.getName(); + _builder.append(_name_3, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); } } } - _builder.newLine(); - DetailCode _userCode1 = dc.getUserCode1(); - CharSequence _userCode = this.helpers.userCode(_userCode1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("class "); - String _name_4 = dc.getName(); - _builder.append(_name_4, ""); - { - DataClass _base_3 = dc.getBase(); - boolean _notEquals_1 = (!Objects.equal(_base_3, null)); - if (_notEquals_1) { - _builder.append(" : public "); - DataClass _base_4 = dc.getBase(); - String _name_5 = _base_4.getName(); - _builder.append(_name_5, ""); - } + } + _builder.newLine(); + DetailCode _userCode1 = dc.getUserCode1(); + CharSequence _userCode = this.helpers.userCode(_userCode1); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.newLine(); + _builder.append("class "); + String _name_4 = dc.getName(); + _builder.append(_name_4, ""); + { + DataClass _base_3 = dc.getBase(); + boolean _notEquals_1 = (!Objects.equal(_base_3, null)); + if (_notEquals_1) { + _builder.append(" : public "); + DataClass _base_4 = dc.getBase(); + String _name_5 = _base_4.getName(); + _builder.append(_name_5, ""); } - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t"); - DetailCode _userCode2 = dc.getUserCode2(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - EList<Attribute> _attributes = dc.getAttributes(); - CharSequence _attributes_1 = this.helpers.attributes(_attributes); - _builder.append(_attributes_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - EList<Attribute> _attributes_2 = dc.getAttributes(); - String _name_6 = dc.getName(); - CharSequence _attributeSettersGettersImplementation = this.helpers.attributeSettersGettersImplementation(_attributes_2, _name_6); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - EList<StandardOperation> _operations_2 = dc.getOperations(); - String _name_7 = dc.getName(); - CharSequence _operationsDeclaration = this.helpers.operationsDeclaration(_operations_2, _name_7); - _builder.append(_operationsDeclaration, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// default constructor, copy constructor and assignment operator"); - _builder.newLine(); - _builder.append("\t"); - String _name_8 = dc.getName(); - _builder.append(_name_8, "\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _name_9 = dc.getName(); - _builder.append(_name_9, "\t"); - _builder.append("(const "); - String _name_10 = dc.getName(); - _builder.append(_name_10, "\t"); - _builder.append("& rhs);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _name_11 = dc.getName(); - _builder.append(_name_11, "\t"); - _builder.append("& operator=(const "); - String _name_12 = dc.getName(); - _builder.append(_name_12, "\t"); - _builder.append("& rhs);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// constructor using fields"); - _builder.newLine(); - _builder.append("\t"); - String _name_13 = dc.getName(); - _builder.append(_name_13, "\t"); - _builder.append("("); - String _argList = this.argList(dc); - _builder.append(_argList, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - { - DataClass _base_5 = dc.getBase(); - boolean _notEquals_2 = (!Objects.equal(_base_5, null)); - if (_notEquals_2) { - _builder.append("\t"); - _builder.append("// constructor using base class constructor"); - _builder.newLine(); - _builder.append("\t"); - String _name_14 = dc.getName(); - _builder.append(_name_14, "\t"); - _builder.append("("); - DataClass _base_6 = dc.getBase(); - String _name_15 = _base_6.getName(); - _builder.append(_name_15, "\t"); - _builder.append(" _super, "); - EList<Attribute> _attributes_3 = dc.getAttributes(); - CharSequence _argListConstructor = this.argListConstructor(_attributes_3); - String _string = _argListConstructor.toString(); - _builder.append(_string, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } + } + _builder.append(" {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("public:"); + _builder.newLine(); + _builder.append("\t"); + DetailCode _userCode2 = dc.getUserCode2(); + CharSequence _userCode_1 = this.helpers.userCode(_userCode2); + _builder.append(_userCode_1, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + EList<Attribute> _attributes = dc.getAttributes(); + CharSequence _attributes_1 = this.helpers.attributes(_attributes); + _builder.append(_attributes_1, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + EList<Attribute> _attributes_2 = dc.getAttributes(); + String _name_6 = dc.getName(); + CharSequence _attributeSettersGettersImplementation = this.helpers.attributeSettersGettersImplementation(_attributes_2, _name_6); + _builder.append(_attributeSettersGettersImplementation, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + EList<StandardOperation> _operations = dc.getOperations(); + String _name_7 = dc.getName(); + CharSequence _operationsDeclaration = this.helpers.operationsDeclaration(_operations, _name_7); + _builder.append(_operationsDeclaration, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// default constructor, copy constructor and assignment operator"); + _builder.newLine(); + _builder.append("\t"); + String _name_8 = dc.getName(); + _builder.append(_name_8, "\t"); + _builder.append("();"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + String _name_9 = dc.getName(); + _builder.append(_name_9, "\t"); + _builder.append("(const "); + String _name_10 = dc.getName(); + _builder.append(_name_10, "\t"); + _builder.append("& rhs);"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + String _name_11 = dc.getName(); + _builder.append(_name_11, "\t"); + _builder.append("& operator=(const "); + String _name_12 = dc.getName(); + _builder.append(_name_12, "\t"); + _builder.append("& rhs);"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// constructor using fields"); + _builder.newLine(); + _builder.append("\t"); + String _name_13 = dc.getName(); + _builder.append(_name_13, "\t"); + _builder.append("("); + String _argList = this.argList(dc); + _builder.append(_argList, "\t"); + _builder.append(");"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.newLine(); + { + DataClass _base_5 = dc.getBase(); + boolean _notEquals_2 = (!Objects.equal(_base_5, null)); + if (_notEquals_2) { + _builder.append("\t"); + _builder.append("// constructor using base class constructor"); + _builder.newLine(); + _builder.append("\t"); + String _name_14 = dc.getName(); + _builder.append(_name_14, "\t"); + _builder.append("("); + DataClass _base_6 = dc.getBase(); + String _name_15 = _base_6.getName(); + _builder.append(_name_15, "\t"); + _builder.append(" _super, "); + EList<Attribute> _attributes_3 = dc.getAttributes(); + CharSequence _argListConstructor = this.argListConstructor(_attributes_3); + String _string = _argListConstructor.toString(); + _builder.append(_string, "\t"); + _builder.append(");"); + _builder.newLineIfNotEmpty(); } - _builder.append("\t"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _name_16 = dc.getName(); - CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_16); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; } - return _xblockexpression; + _builder.append("\t"); + _builder.newLine(); + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + String _name_16 = dc.getName(); + CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_16); + _builder.append(_generateIncludeGuardEnd, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + return _builder; } public CharSequence generateSourceFile(final Root root, final DataClass dc) { - CharSequence _xblockexpression = null; + StringConcatenation _builder = new StringConcatenation(); + _builder.append("/**"); + _builder.newLine(); + _builder.append(" "); + _builder.append("* @author generated by eTrice"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("* Source File of DataClass "); + String _name = dc.getName(); + _builder.append(_name, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + _builder.append("#include \""); + String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(dc); + _builder.append(_cppHeaderFileName, ""); + _builder.append("\""); + _builder.newLineIfNotEmpty(); { - EList<StandardOperation> _operations = dc.getOperations(); - final Function1<StandardOperation, Boolean> _function = new Function1<StandardOperation, Boolean>() { - public Boolean apply(final StandardOperation op) { - return Boolean.valueOf(DataClassGen.this._roomHelpers.isConstructor(op)); - } - }; - Iterable<StandardOperation> _filter = IterableExtensions.<StandardOperation>filter(_operations, _function); - final StandardOperation ctor = IterableExtensions.<StandardOperation>head(_filter); - EList<StandardOperation> _operations_1 = dc.getOperations(); - final Function1<StandardOperation, Boolean> _function_1 = new Function1<StandardOperation, Boolean>() { - public Boolean apply(final StandardOperation op) { - return Boolean.valueOf(op.isDestructor()); - } - }; - Iterable<StandardOperation> _filter_1 = IterableExtensions.<StandardOperation>filter(_operations_1, _function_1); - final StandardOperation dtor = IterableExtensions.<StandardOperation>head(_filter_1); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* @author generated by eTrice"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* Source File of DataClass "); - String _name = dc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(dc); - _builder.append(_cppHeaderFileName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - { - GeneratorSettings _settings = Main.getSettings(); - boolean _isUseEtUnit = _settings.isUseEtUnit(); - if (_isUseEtUnit) { - _builder.append("extern \"C\" {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"etUnit.h\""); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - } - } - _builder.newLine(); - DetailCode _userCode3 = dc.getUserCode3(); - CharSequence _userCode = this.helpers.userCode(_userCode3); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("// default constructor"); - _builder.newLine(); - String _name_1 = dc.getName(); - _builder.append(_name_1, ""); - _builder.append("::"); - String _name_2 = dc.getName(); - _builder.append(_name_2, ""); - _builder.append("() "); - _builder.newLineIfNotEmpty(); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append("\t"); - _builder.append(":"); - DataClass _base_1 = dc.getBase(); - String _name_3 = _base_1.getName(); - _builder.append(_name_3, "\t"); - _builder.append("()"); - _builder.newLineIfNotEmpty(); - } + GeneratorSettings _settings = Main.getSettings(); + boolean _isUseEtUnit = _settings.isUseEtUnit(); + if (_isUseEtUnit) { + _builder.append("extern \"C\" {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("#include \"etUnit.h\""); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); } - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - EList<Attribute> _attributes = dc.getAttributes(); - CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes, false); - _builder.append(_attributeInitialization, "\t"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals_1 = (!Objects.equal(ctor, null)); - if (_notEquals_1) { - _builder.append("\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("// user defined constructor body"); - _builder.newLine(); - { - DetailCode _detailCode = ctor.getDetailCode(); - EList<String> _lines = _detailCode.getLines(); - for(final String l : _lines) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append(l, "\t\t"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } + } + _builder.newLine(); + DetailCode _userCode3 = dc.getUserCode3(); + CharSequence _userCode = this.helpers.userCode(_userCode3); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.newLine(); + _builder.append("// default constructor"); + _builder.newLine(); + String _name_1 = dc.getName(); + _builder.append(_name_1, ""); + _builder.append("::"); + String _name_2 = dc.getName(); + _builder.append(_name_2, ""); + _builder.append("() "); + _builder.newLineIfNotEmpty(); + { + DataClass _base = dc.getBase(); + boolean _notEquals = (!Objects.equal(_base, null)); + if (_notEquals) { + _builder.append("\t"); + _builder.append(":"); + DataClass _base_1 = dc.getBase(); + String _name_3 = _base_1.getName(); + _builder.append(_name_3, "\t"); + _builder.append("()"); + _builder.newLineIfNotEmpty(); } - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("// copy constructor"); - _builder.newLine(); - String _name_4 = dc.getName(); - _builder.append(_name_4, ""); - _builder.append("::"); - String _name_5 = dc.getName(); - _builder.append(_name_5, ""); - _builder.append("(const "); - String _name_6 = dc.getName(); - _builder.append(_name_6, ""); - _builder.append("& rhs)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(":"); - _builder.newLine(); - { - DataClass _base_2 = dc.getBase(); - boolean _notEquals_2 = (!Objects.equal(_base_2, null)); - if (_notEquals_2) { - _builder.append("\t"); - DataClass _base_3 = dc.getBase(); - String _name_7 = _base_3.getName(); - _builder.append(_name_7, "\t"); - _builder.append("(rhs),"); - _builder.newLineIfNotEmpty(); - } + } + _builder.append("{"); + _builder.newLine(); + _builder.append("\t"); + EList<Attribute> _attributes = dc.getAttributes(); + CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes, false); + _builder.append(_attributeInitialization, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t"); + _builder.newLine(); + _builder.append("// copy constructor"); + _builder.newLine(); + String _name_4 = dc.getName(); + _builder.append(_name_4, ""); + _builder.append("::"); + String _name_5 = dc.getName(); + _builder.append(_name_5, ""); + _builder.append("(const "); + String _name_6 = dc.getName(); + _builder.append(_name_6, ""); + _builder.append("& rhs)"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append(":"); + _builder.newLine(); + { + DataClass _base_2 = dc.getBase(); + boolean _notEquals_1 = (!Objects.equal(_base_2, null)); + if (_notEquals_1) { + _builder.append("\t"); + DataClass _base_3 = dc.getBase(); + String _name_7 = _base_3.getName(); + _builder.append(_name_7, "\t"); + _builder.append("(rhs),"); + _builder.newLineIfNotEmpty(); } - { - EList<Attribute> _attributes_1 = dc.getAttributes(); - boolean _hasElements = false; - for(final Attribute a : _attributes_1) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _name_8 = a.getName(); - _builder.append(_name_8, "\t"); - _builder.append("(rhs."); - String _name_9 = a.getName(); - _builder.append(_name_9, "\t"); - _builder.append(")"); - _builder.newLineIfNotEmpty(); + } + { + EList<Attribute> _attributes_1 = dc.getAttributes(); + boolean _hasElements = false; + for(final Attribute a : _attributes_1) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(",", "\t"); } + _builder.append("\t"); + String _name_8 = a.getName(); + _builder.append(_name_8, "\t"); + _builder.append("(rhs."); + String _name_9 = a.getName(); + _builder.append(_name_9, "\t"); + _builder.append(")"); + _builder.newLineIfNotEmpty(); } - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// constructor using fields"); - _builder.newLine(); - String _name_10 = dc.getName(); - _builder.append(_name_10, ""); - _builder.append("::"); - String _name_11 = dc.getName(); - _builder.append(_name_11, ""); - _builder.append("("); - String _argList = this.argList(dc); - _builder.append(_argList, ""); - _builder.append(") "); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(":"); - _builder.newLine(); - { - DataClass _base_4 = dc.getBase(); - boolean _notEquals_3 = (!Objects.equal(_base_4, null)); - if (_notEquals_3) { - _builder.append("\t"); - DataClass _base_5 = dc.getBase(); - String _name_12 = _base_5.getName(); - _builder.append(_name_12, "\t"); - _builder.append("("); - DataClass _base_6 = dc.getBase(); - String _paramList = this.paramList(_base_6); - _builder.append(_paramList, "\t"); - _builder.append("),"); - _builder.newLineIfNotEmpty(); - } + } + _builder.append("{"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// constructor using fields"); + _builder.newLine(); + String _name_10 = dc.getName(); + _builder.append(_name_10, ""); + _builder.append("::"); + String _name_11 = dc.getName(); + _builder.append(_name_11, ""); + _builder.append("("); + String _argList = this.argList(dc); + _builder.append(_argList, ""); + _builder.append(") "); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append(":"); + _builder.newLine(); + { + DataClass _base_4 = dc.getBase(); + boolean _notEquals_2 = (!Objects.equal(_base_4, null)); + if (_notEquals_2) { + _builder.append("\t"); + DataClass _base_5 = dc.getBase(); + String _name_12 = _base_5.getName(); + _builder.append(_name_12, "\t"); + _builder.append("("); + DataClass _base_6 = dc.getBase(); + String _paramList = this.paramList(_base_6); + _builder.append(_paramList, "\t"); + _builder.append("),"); + _builder.newLineIfNotEmpty(); } - { - EList<Attribute> _attributes_2 = dc.getAttributes(); - boolean _hasElements_1 = false; - for(final Attribute a_1 : _attributes_2) { - if (!_hasElements_1) { - _hasElements_1 = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _name_13 = a_1.getName(); - _builder.append(_name_13, "\t"); - _builder.append("("); - String _name_14 = a_1.getName(); - _builder.append(_name_14, "\t"); - _builder.append("_)"); - _builder.newLineIfNotEmpty(); + } + { + EList<Attribute> _attributes_2 = dc.getAttributes(); + boolean _hasElements_1 = false; + for(final Attribute a_1 : _attributes_2) { + if (!_hasElements_1) { + _hasElements_1 = true; + } else { + _builder.appendImmediate(",", "\t"); } + _builder.append("\t"); + String _name_13 = a_1.getName(); + _builder.append(_name_13, "\t"); + _builder.append("("); + String _name_14 = a_1.getName(); + _builder.append(_name_14, "\t"); + _builder.append("_)"); + _builder.newLineIfNotEmpty(); } - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - { - DataClass _base_7 = dc.getBase(); - boolean _notEquals_4 = (!Objects.equal(_base_7, null)); - if (_notEquals_4) { - _builder.append("// constructor using base class constructor"); - _builder.newLine(); - String _name_15 = dc.getName(); - _builder.append(_name_15, ""); - _builder.append("::"); - String _name_16 = dc.getName(); - _builder.append(_name_16, ""); - _builder.append("("); - DataClass _base_8 = dc.getBase(); - String _name_17 = _base_8.getName(); - _builder.append(_name_17, ""); - _builder.append(" _super, "); - EList<Attribute> _attributes_3 = dc.getAttributes(); - CharSequence _argListConstructor = this.argListConstructor(_attributes_3); - String _string = _argListConstructor.toString(); - _builder.append(_string, ""); - _builder.append(")"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(":"); - _builder.newLine(); - _builder.append("\t"); - DataClass _base_9 = dc.getBase(); - String _name_18 = _base_9.getName(); - _builder.append(_name_18, "\t"); - _builder.append("(_super),"); - _builder.newLineIfNotEmpty(); - { - EList<Attribute> _attributes_4 = dc.getAttributes(); - boolean _hasElements_2 = false; - for(final Attribute a_2 : _attributes_4) { - if (!_hasElements_2) { - _hasElements_2 = true; - } else { - _builder.appendImmediate(",", "\t"); - } - _builder.append("\t"); - String _name_19 = a_2.getName(); - _builder.append(_name_19, "\t"); - _builder.append("("); - String _name_20 = a_2.getName(); - _builder.append(_name_20, "\t"); - _builder.append("_)"); - _builder.newLineIfNotEmpty(); + } + _builder.append("{"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + { + DataClass _base_7 = dc.getBase(); + boolean _notEquals_3 = (!Objects.equal(_base_7, null)); + if (_notEquals_3) { + _builder.append("// constructor using base class constructor"); + _builder.newLine(); + String _name_15 = dc.getName(); + _builder.append(_name_15, ""); + _builder.append("::"); + String _name_16 = dc.getName(); + _builder.append(_name_16, ""); + _builder.append("("); + DataClass _base_8 = dc.getBase(); + String _name_17 = _base_8.getName(); + _builder.append(_name_17, ""); + _builder.append(" _super, "); + EList<Attribute> _attributes_3 = dc.getAttributes(); + CharSequence _argListConstructor = this.argListConstructor(_attributes_3); + String _string = _argListConstructor.toString(); + _builder.append(_string, ""); + _builder.append(")"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append(":"); + _builder.newLine(); + _builder.append("\t"); + DataClass _base_9 = dc.getBase(); + String _name_18 = _base_9.getName(); + _builder.append(_name_18, "\t"); + _builder.append("(_super),"); + _builder.newLineIfNotEmpty(); + { + EList<Attribute> _attributes_4 = dc.getAttributes(); + boolean _hasElements_2 = false; + for(final Attribute a_2 : _attributes_4) { + if (!_hasElements_2) { + _hasElements_2 = true; + } else { + _builder.appendImmediate(",", "\t"); } + _builder.append("\t"); + String _name_19 = a_2.getName(); + _builder.append(_name_19, "\t"); + _builder.append("("); + String _name_20 = a_2.getName(); + _builder.append(_name_20, "\t"); + _builder.append("_)"); + _builder.newLineIfNotEmpty(); } - _builder.append("{"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); } + _builder.append("{"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); } - _builder.newLine(); - _builder.append("// assignment operator"); - _builder.newLine(); - String _name_21 = dc.getName(); - _builder.append(_name_21, ""); - _builder.append("& "); - String _name_22 = dc.getName(); - _builder.append(_name_22, ""); - _builder.append("::operator=(const "); - String _name_23 = dc.getName(); - _builder.append(_name_23, ""); - _builder.append("& rhs)"); - _builder.newLineIfNotEmpty(); - _builder.append("{\t\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (this == &rhs) { return *this; };"); - _builder.newLine(); - { - DataClass _base_10 = dc.getBase(); - boolean _notEquals_5 = (!Objects.equal(_base_10, null)); - if (_notEquals_5) { - _builder.append("\t"); - DataClass _base_11 = dc.getBase(); - String _name_24 = _base_11.getName(); - _builder.append(_name_24, "\t"); - _builder.append("::operator=(rhs);"); - _builder.newLineIfNotEmpty(); - } + } + _builder.newLine(); + _builder.append("// assignment operator"); + _builder.newLine(); + String _name_21 = dc.getName(); + _builder.append(_name_21, ""); + _builder.append("& "); + String _name_22 = dc.getName(); + _builder.append(_name_22, ""); + _builder.append("::operator=(const "); + String _name_23 = dc.getName(); + _builder.append(_name_23, ""); + _builder.append("& rhs)"); + _builder.newLineIfNotEmpty(); + _builder.append("{\t\t"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("if (this == &rhs) { return *this; };"); + _builder.newLine(); + { + DataClass _base_10 = dc.getBase(); + boolean _notEquals_4 = (!Objects.equal(_base_10, null)); + if (_notEquals_4) { + _builder.append("\t"); + DataClass _base_11 = dc.getBase(); + String _name_24 = _base_11.getName(); + _builder.append(_name_24, "\t"); + _builder.append("::operator=(rhs);"); + _builder.newLineIfNotEmpty(); } - { - EList<Attribute> _attributes_5 = dc.getAttributes(); - for(final Attribute a_3 : _attributes_5) { - _builder.append("\t"); - String _name_25 = a_3.getName(); - _builder.append(_name_25, "\t"); - _builder.append("= rhs."); - String _name_26 = a_3.getName(); - _builder.append(_name_26, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } + } + { + EList<Attribute> _attributes_5 = dc.getAttributes(); + for(final Attribute a_3 : _attributes_5) { + _builder.append("\t"); + String _name_25 = a_3.getName(); + _builder.append(_name_25, "\t"); + _builder.append("= rhs."); + String _name_26 = a_3.getName(); + _builder.append(_name_26, "\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); } - _builder.append("\t"); - _builder.append("return *this;"); - _builder.newLine(); - _builder.append("}\t\t\t"); - _builder.newLine(); - _builder.newLine(); - EList<StandardOperation> _operations_2 = dc.getOperations(); - String _name_27 = dc.getName(); - CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations_2, _name_27); - _builder.append(_operationsImplementation, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _xblockexpression = _builder; } - return _xblockexpression; + _builder.append("\t"); + _builder.append("return *this;"); + _builder.newLine(); + _builder.append("}\t\t\t"); + _builder.newLine(); + _builder.newLine(); + EList<StandardOperation> _operations = dc.getOperations(); + String _name_27 = dc.getName(); + CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations, _name_27); + _builder.append(_operationsImplementation, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + return _builder; } public String paramList(final DataClass _dc) { |