diff options
author | Juergen Haug | 2015-12-23 11:35:03 +0000 |
---|---|---|
committer | Juergen Haug | 2016-02-28 17:01:11 +0000 |
commit | 81750c5e633ad14e7ab25b016564af20fec0a1cc (patch) | |
tree | 951ca972625f09ffee924496591e97d927a74f0d | |
parent | dc98de4bb145d8d3789909e32c11765596165fbb (diff) | |
download | org.eclipse.etrice-81750c5e633ad14e7ab25b016564af20fec0a1cc.tar.gz org.eclipse.etrice-81750c5e633ad14e7ab25b016564af20fec0a1cc.tar.xz org.eclipse.etrice-81750c5e633ad14e7ab25b016564af20fec0a1cc.zip |
[generators] added cpp generator draft
Change-Id: I4466d25800a35a869a2911485d36494f86089121
266 files changed, 13478 insertions, 10244 deletions
diff --git a/examples/org.eclipse.etrice.examples.c/.cproject b/examples/org.eclipse.etrice.examples.c/.cproject index 5feed9a76..35ea66756 100644 --- a/examples/org.eclipse.etrice.examples.c/.cproject +++ b/examples/org.eclipse.etrice.examples.c/.cproject @@ -47,6 +47,7 @@ <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.c.compiler.option.dialect.std.580541371" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c99" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.556343319" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.385830627" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"> @@ -140,6 +141,7 @@ <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.c.compiler.option.dialect.std.1592888080" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c99" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1429441529" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.981845646" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"> diff --git a/examples/org.eclipse.etrice.template.c/.cproject b/examples/org.eclipse.etrice.template.c/.cproject index f0fd808e9..9bc2ec820 100644 --- a/examples/org.eclipse.etrice.template.c/.cproject +++ b/examples/org.eclipse.etrice.template.c/.cproject @@ -48,6 +48,7 @@ <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.c.compiler.option.dialect.std.1920747048" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1011975041" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1647711876" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"> @@ -142,6 +143,7 @@ <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.c.compiler.option.dialect.std.985330533" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1539026479" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.524816999" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"> diff --git a/examples/org.eclipse.etrice.template.cpp/.cproject b/examples/org.eclipse.etrice.template.cpp/.cproject new file mode 100644 index 000000000..6b918b783 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/.cproject @@ -0,0 +1,378 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372" moduleId="org.eclipse.cdt.core.settings" name="WindowsMinGW"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.418522507" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug"> + <targetPlatform binaryParser="org.eclipse.cdt.core.PE;org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.1394894600" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.template.cpp}/WindowsMinGW" id="cdt.managedbuild.tool.gnu.builder.mingw.base.966111836" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.1106927259" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug"> + <option id="gnu.both.asm.option.include.paths.1947689275" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1024603493" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1499945448" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.724131833" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug"> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.1780976094" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1664887698" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.836599006" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + </option> + <option id="gnu.cpp.compiler.option.dialect.std.930835239" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.1931311750" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" value="false" valueType="boolean"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.46783824" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1071304858" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.1653609723" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.2060996838" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.792248644" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths"/> + <option id="gnu.c.compiler.option.dialect.std.1702962683" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c90" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1116416627" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1616927644" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.716010295" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"> + <option id="gnu.cpp.link.option.paths.11130594" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/WindowsMinGW}""/> + </option> + <option id="gnu.cpp.link.option.libs.491428449" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.modellib.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1779793303" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.modellib.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.modellib.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309" moduleId="org.eclipse.cdt.core.settings" name="ExternalMakefile"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309" name="ExternalMakefile" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.88658143" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug"> + <targetPlatform binaryParser="org.eclipse.cdt.core.PE;org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.2103573969" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/> + <builder arguments="-f ${workspace_loc:org.eclipse.etrice.runtime.cpp}/buildTools/Makefile" cleanBuildTarget="clean_build" command="make" id="cdt.managedbuild.target.gnu.builder.base.1427935129" incrementalBuildTarget="build" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="false" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.279658872" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug"> + <option id="gnu.both.asm.option.include.paths.866765549" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.760997608" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1436020519" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1486478189" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug"> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.1723240029" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.271123914" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.1967618567" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1241078740" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1849062664" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.225989001" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1428552349" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.3716756" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.311967814" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1987098668" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.1554422721" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"> + <option id="gnu.cpp.link.option.paths.113953250" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/ExternalMakefile}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/ExternalMakefile}""/> + </option> + <option id="gnu.cpp.link.option.libs.1547842592" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.modellib.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1170077261" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/ExternalMakefile"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.modellib.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/ExternalMakefile"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675" moduleId="org.eclipse.cdt.core.settings" name="LinuxPosix"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675" name="LinuxPosix" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.base.1209374409" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base"> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.PE;org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1949788205" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.template.cpp}/LinuxPosix" id="cdt.managedbuild.target.gnu.builder.base.890389796" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.archiver.base.1946903351" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.924367323" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"> + <option id="gnu.cpp.compiler.option.include.paths.1022838042" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + </option> + <option id="gnu.cpp.compiler.option.optimization.level.90770693" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.debugging.level.1040355827" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.235973880" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1331416696" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.487847866" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/> + <option id="gnu.c.compiler.option.debugging.level.164525895" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.770176081" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2003313590" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.base.1678871535" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.222066514" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"> + <option id="gnu.cpp.link.option.libs.1882186128" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.modellib.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="pthread"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="rt"/> + </option> + <option id="gnu.cpp.link.option.paths.1451265412" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/LinuxPosix}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/LinuxPosix}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/LinuxPosix}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.616137082" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + <tool id="cdt.managedbuild.tool.gnu.assembler.base.1684552365" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"> + <option id="gnu.both.asm.option.include.paths.1113457472" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.723404626" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.294295052" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.modellib.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.modellib.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="org.eclipse.etrice.template.cpp.cdt.managedbuild.target.gnu.mingw.exe.1864681474" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> + <storageModule moduleId="refreshScope" versionNumber="2"> + <configuration configurationName="ExternalMakefile"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.template.cpp"/> + </configuration> + <configuration configurationName="WindowsMinGW"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.template.cpp"/> + </configuration> + <configuration configurationName="LinuxPosix"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.template.cpp"/> + </configuration> + </storageModule> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675;cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675.;cdt.managedbuild.tool.gnu.c.compiler.base.1331416696;cdt.managedbuild.tool.gnu.c.compiler.input.2003313590"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372;cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.724131833;cdt.managedbuild.tool.gnu.cpp.compiler.input.46783824"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372;cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1071304858;cdt.managedbuild.tool.gnu.c.compiler.input.1116416627"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675;cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675.;cdt.managedbuild.tool.gnu.cpp.compiler.base.924367323;cdt.managedbuild.tool.gnu.cpp.compiler.input.235973880"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309;cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1849062664;cdt.managedbuild.tool.gnu.c.compiler.input.311967814"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309;cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1486478189;cdt.managedbuild.tool.gnu.cpp.compiler.input.1241078740"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> +</cproject> diff --git a/examples/org.eclipse.etrice.template.cpp/.gitignore b/examples/org.eclipse.etrice.template.cpp/.gitignore new file mode 100644 index 000000000..d2a6ec005 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/.gitignore @@ -0,0 +1,8 @@ +WindowsMinGW +LinuxPosix +src-gen/* +!src-gen/readme.txt +src-gen-info/* +!src-gen-info/readme.txt +log/* +!log/readme.txt diff --git a/examples/org.eclipse.etrice.template.cpp/.project b/examples/org.eclipse.etrice.template.cpp/.project new file mode 100644 index 000000000..e984d5a42 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/.project @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.etrice.template.cpp</name> + <comment></comment> + <projects> + <project>org.eclipse.etrice.runtime.cpp</project> + <project>org.eclipse.etrice.modellib.cpp</project> + <project>org.eclipse.etrice.runtime.c</project> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + </natures> +</projectDescription> diff --git a/examples/org.eclipse.etrice.template.cpp/.settings/org.eclipse.cdt.core.prefs b/examples/org.eclipse.etrice.template.cpp/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 000000000..ba50e9cec --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,37 @@ +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/CPP_MODELLIB_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/CPP_MODELLIB_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/CPP_MODELLIB_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.modellib.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/CPP_RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/CPP_RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/CPP_RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.c} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/append=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675/appendContributed=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/CPP_MODELLIB_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/CPP_MODELLIB_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/CPP_MODELLIB_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.modellib.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/CPP_RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/CPP_RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/CPP_RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/ECLIPSE_MODE/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/ECLIPSE_MODE/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/ECLIPSE_MODE/value=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.c} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/append=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1674764309/appendContributed=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPP_MODELLIB_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPP_MODELLIB_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPP_MODELLIB_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.modellib.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPP_RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPP_RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPP_RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.c} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/append=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/appendContributed=true diff --git a/examples/org.eclipse.etrice.template.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/examples/org.eclipse.etrice.template.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 000000000..99e96a40b --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372/appendContributed=true diff --git a/examples/org.eclipse.etrice.template.cpp/generate_Template.launch b/examples/org.eclipse.etrice.template.cpp/generate_Template.launch new file mode 100644 index 000000000..970394f6a --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/generate_Template.launch @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.etrice.generator.launch.cpp.launchConfigurationType"> +<booleanAttribute key="Debug" value="false"/> +<booleanAttribute key="GenDocumentation" value="false"/> +<booleanAttribute key="GenInstanceDiagram" value="false"/> +<stringAttribute key="GenModelPath" value=""/> +<booleanAttribute key="Lib" value="false"/> +<booleanAttribute key="MSC" value="true"/> +<booleanAttribute key="DataLogging" value="true"/> +<listAttribute key="ModelFiles"> +<listEntry value="${workspace_loc:/org.eclipse.etrice.template.cpp/model/Mapping.etmap}"/> +</listAttribute> +<booleanAttribute key="OverrideDirectories" value="false"/> +<booleanAttribute key="SaveGenModel" value="false"/> +<booleanAttribute key="UseTranslation" value="true"/> +<booleanAttribute key="Verbose" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.template.cpp/log/readme.txt b/examples/org.eclipse.etrice.template.cpp/log/readme.txt new file mode 100644 index 000000000..dadbdcfe8 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/log/readme.txt @@ -0,0 +1 @@ +This directory is an eTrice directory used for logging e.g. MSC.
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.template.cpp/model/Mapping.etmap b/examples/org.eclipse.etrice.template.cpp/model/Mapping.etmap new file mode 100644 index 000000000..a4c5d8fb0 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/model/Mapping.etmap @@ -0,0 +1,17 @@ +/* + * This model defines a mapping between a logical ROOM model and a physical model (nodes and threads). + * + * <p>Hint: Press F3 to open declaration of selected element or import</p> + */ +MappingModel TemplateMapping { + + import TemplatePhysical.* from "Physical.etphys" + import TemplateModel.* from "TemplateModel.room" + + Mapping LogSys -> TemplatePhysicalSystem { + SubSystemMapping subSystemRef -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.template.cpp/model/Physical.etphys b/examples/org.eclipse.etrice.template.cpp/model/Physical.etphys new file mode 100644 index 000000000..2bf93c456 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/model/Physical.etphys @@ -0,0 +1,43 @@ +PhysicalModel TemplatePhysical { + + PhysicalSystem TemplatePhysicalSystem { + NodeRef node : DefaultNodeClass + } + + NodeClass DefaultNodeClass { + runtime = DefaultRuntimeClass + priomin = -10 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.template.cpp/model/TemplateModel.room b/examples/org.eclipse.etrice.template.cpp/model/TemplateModel.room new file mode 100644 index 000000000..289121e99 --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/model/TemplateModel.room @@ -0,0 +1,76 @@ +/* + * Shortkeys: + * Ctrl+Space - content assist + * F3 - open declaration of selected element + * Alt+S - open structure diagram + * Alt+B - open behavior diagram + * Alt+M - open textual editor (in diagrams) + */ +RoomModel TemplateModel { + + import room.basic.types.* from "../../org.eclipse.etrice.modellib.cpp/model/Types.room" + import room.basic.service.timing.* from "../../org.eclipse.etrice.modellib.cpp/model/TimingService.room" + + LogicalSystem LogSys { + SubSystemRef subSystemRef: SubSysClass + } + + SubSystemClass SubSysClass { + ActorRef topActor: TopActor + ActorRef timingService: ATimingService + LayerConnection ref topActor satisfied_by timingService.timer + LogicalThread defaultThread + } + + // - build your application from here + ActorClass TopActor { + Structure { + + } + Behavior { + StateMachine { + Transition init: initial -> helloState + State helloState { + entry { + "printf(\"### Hello World! ###\\n\");" + } + } + } + } + } + + // - PingPong building kit + + ProtocolClass PingPongProtocol { + incoming { + Message ping() + } + outgoing { + Message pong() + } + } + + ActorClass Sender { + Interface { + conjugated Port sendPort: PingPongProtocol + } + Structure { + external Port sendPort + } + Behavior { + } + } + + ActorClass Receiver { + Interface { + Port recvPort: PingPongProtocol + } + Structure { + external Port recvPort + SAP timingService: PTimer + } + Behavior { + } + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.template.cpp/model/diagrams/TemplateModel.Receiver.structure b/examples/org.eclipse.etrice.template.cpp/model/diagrams/TemplateModel.Receiver.structure new file mode 100644 index 000000000..29a5d648c --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/model/diagrams/TemplateModel.Receiver.structure @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of Receiver" pictogramLinks="//@link //@children.0/@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../TemplateModel.room#ActorClass:Receiver"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="cls"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" lineVisible="false" transparency="0.5" width="800" height="500" x="40" y="40"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TemplateModel.room#ActorClass:Receiver"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value=""/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="400"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.2" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="40" height="40" x="20" y="20"/> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.1" lineWidth="2" transparency="0.0" width="20" height="20" x="30" y="30"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TemplateModel.room#Port:Receiver$recvPort"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" font="//@fonts.0" value="recvPort"/> + </children> + </children> + </children> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <fonts name="Arial" size="8"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.template.cpp/model/diagrams/TemplateModel.Sender.structure b/examples/org.eclipse.etrice.template.cpp/model/diagrams/TemplateModel.Sender.structure new file mode 100644 index 000000000..d952f1e7e --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/model/diagrams/TemplateModel.Sender.structure @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of Sender" pictogramLinks="//@link //@children.0/@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../TemplateModel.room#ActorClass:Sender"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="cls"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" lineVisible="false" transparency="0.5" width="800" height="500" x="40" y="40"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TemplateModel.room#ActorClass:Sender"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value="C"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="396" y="500"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="40" height="40" x="20" y="20"/> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.2" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="30" y="30"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TemplateModel.room#Port:Sender$sendPort"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" y="60" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="sendPort"/> + </children> + </children> + </children> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <fonts name="Arial" size="8"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.template.cpp/run_Template_Linux_.launch b/examples/org.eclipse.etrice.template.cpp/run_Template_Linux_.launch new file mode 100644 index 000000000..1e3baa52b --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/run_Template_Linux_.launch @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/> +<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> +<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> +<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> +<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="LinuxPosix/org.eclipse.etrice.template.cpp.exe"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="org.eclipse.etrice.template.cpp"/> +<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372.1242072675"/> +<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.etrice.template.cpp"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/> +<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.template.cpp/run_Template_Windows_.launch b/examples/org.eclipse.etrice.template.cpp/run_Template_Windows_.launch new file mode 100644 index 000000000..bd84dcf3a --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/run_Template_Windows_.launch @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/> +<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> +<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> +<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> +<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="WindowsMinGW\org.eclipse.etrice.template.cpp.exe"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="org.eclipse.etrice.template.cpp"/> +<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.mingw.exe.debug.1749013372"/> +<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.etrice.template.cpp"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/> +<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.template.cpp/src-gen-info/readme.txt b/examples/org.eclipse.etrice.template.cpp/src-gen-info/readme.txt new file mode 100644 index 000000000..1dc2b35ab --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/src-gen-info/readme.txt @@ -0,0 +1,4 @@ +This directory is an eTrice code generation target. +It will be erased every time the generator is executed. + +DO NOT PLACE OTHER FILES HERE! diff --git a/examples/org.eclipse.etrice.template.cpp/src-gen/readme.txt b/examples/org.eclipse.etrice.template.cpp/src-gen/readme.txt new file mode 100644 index 000000000..1dc2b35ab --- /dev/null +++ b/examples/org.eclipse.etrice.template.cpp/src-gen/readme.txt @@ -0,0 +1,4 @@ +This directory is an eTrice code generation target. +It will be erased every time the generator is executed. + +DO NOT PLACE OTHER FILES HERE! diff --git a/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/HelloWorld.room b/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/HelloWorld.room index cad07ec56..174187b08 100644 --- a/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/HelloWorld.room +++ b/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/HelloWorld.room @@ -1,4 +1,4 @@ -/* +/* * Shortkeys: * Ctrl+Space - content assist * F3 - open declaration of selected element @@ -25,7 +25,7 @@ RoomModel HelloWorldModel { // - build your application from here ActorClass TopActor { Structure { - + } Behavior { StateMachine { diff --git a/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Mapping.etmap b/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Mapping.etmap index d474a7983..2c9c9bdc5 100644 --- a/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Mapping.etmap +++ b/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Mapping.etmap @@ -1,14 +1,14 @@ /* * This model defines a mapping between a logical ROOM model and a physical model (nodes and threads). - * + * * <p>Hint: Press F3 to open declaration of selected element or import</p> */ MappingModel TemplateMapping { - - import room.generic.physical.* from "../../../org.eclipse.etrice.modellib.c/model/GenericPhysical.etphys" + + import TemplatePhysical.* from "Physical.etphys" import HelloWorldModel.* from "HelloWorld.room" - Mapping LogSys -> GenericPhysicalSystem { + Mapping LogSys -> TemplatePhysicalSystem { SubSystemMapping subSystemRef -> node { ThreadMapping defaultThread -> DefaultPhysicalThread } diff --git a/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Physical.etphys b/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Physical.etphys new file mode 100644 index 000000000..2bf93c456 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.c/model/HelloWorld/Physical.etphys @@ -0,0 +1,43 @@ +PhysicalModel TemplatePhysical { + + PhysicalSystem TemplatePhysicalSystem { + NodeRef node : DefaultNodeClass + } + + NodeClass DefaultNodeClass { + runtime = DefaultRuntimeClass + priomin = -10 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Mapping.etmap b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Mapping.etmap index 2ff1cc88e..f49796b29 100644 --- a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Mapping.etmap +++ b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Mapping.etmap @@ -1,14 +1,14 @@ /* * This model defines a mapping between a logical ROOM model and a physical model (nodes and threads). - * + * * <p>Hint: Press F3 to open declaration of selected element or import</p> */ MappingModel TemplateMapping { - - import room.generic.physical.* from "../../../org.eclipse.etrice.modellib.c/model/GenericPhysical.etphys" + + import TemplatePhysical.* from "Physical.etphys" import PingPongModel.* from "PingPong.room" - Mapping LogSys -> GenericPhysicalSystem { + Mapping LogSys -> TemplatePhysicalSystem { SubSystemMapping subSystemRef -> node { ThreadMapping defaultThread -> DefaultPhysicalThread } diff --git a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Physical.etphys b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Physical.etphys new file mode 100644 index 000000000..2bf93c456 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/Physical.etphys @@ -0,0 +1,43 @@ +PhysicalModel TemplatePhysical { + + PhysicalSystem TemplatePhysicalSystem { + NodeRef node : DefaultNodeClass + } + + NodeClass DefaultNodeClass { + runtime = DefaultRuntimeClass + priomin = -10 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/PingPong.room b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/PingPong.room index 3e298afd5..77e36f75f 100644 --- a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/PingPong.room +++ b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/PingPong.room @@ -1,4 +1,4 @@ -/* +/* * Shortkeys: * Ctrl+Space - content assist * F3 - open declaration of selected element @@ -30,10 +30,10 @@ RoomModel PingPongModel { Binding sender.sendPort and receiver.recvPort } Behavior { - + } } - + // - PingPong building kit ActorClass Sender { diff --git a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/diagrams/PingPongModel.SubSysClass.structure b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/diagrams/PingPongModel.SubSysClass.structure index 7a0edd751..c96cab3df 100644 --- a/examples/org.eclipse.etrice.tutorials.c/model/PingPong/diagrams/PingPongModel.SubSysClass.structure +++ b/examples/org.eclipse.etrice.tutorials.c/model/PingPong/diagrams/PingPongModel.SubSysClass.structure @@ -16,7 +16,7 @@ <children xsi:type="pi:ContainerShape" visible="true" active="true"> <properties key="obj-type" value="ref"/> <properties key="actorref_version" value="2"/> - <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="240" y="40"> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="210" y="40"> <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="180" height="80" x="33" y="27"> <properties key="actorref_graphic_element" value="replborder"/> </graphicsAlgorithmChildren> @@ -136,7 +136,7 @@ <children xsi:type="pi:ContainerShape" visible="true" active="true"> <properties key="obj-type" value="ref"/> <properties key="actorref_version" value="2"/> - <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="254" y="281"> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="276" y="282"> <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="180" height="80" x="33" y="27"> <properties key="actorref_graphic_element" value="replborder"/> </graphicsAlgorithmChildren> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/.cproject b/examples/org.eclipse.etrice.tutorials.cpp/.cproject new file mode 100644 index 000000000..a2bcff2ba --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/.cproject @@ -0,0 +1,292 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733" moduleId="org.eclipse.cdt.core.settings" name="WindowsMinGW"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.69420596" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug"> + <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.976387164" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.tutorials.cpp}/Debug" id="cdt.managedbuild.tool.gnu.builder.mingw.base.731154742" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.909731650" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug"> + <option id="gnu.both.asm.option.include.paths.901817972" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.643291852" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1632615240" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.2100048552" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug"> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.655209945" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1460798176" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.dialect.std.1317258943" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.226070795" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="gnu.cpp.compiler.option.include.paths.942109534" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1294463514" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1373358885" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.1465707096" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1494540699" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.1559751690" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1734922408" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.144770136" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.1380030344" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"> + <option id="gnu.cpp.link.option.paths.119583934" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/WindowsMinGW}""/> + </option> + <option id="gnu.cpp.link.option.libs.746051639" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.modellib.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1261226396" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.modellib.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.modellib.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329" moduleId="org.eclipse.cdt.core.settings" name="LinuxPosix"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329" name="LinuxPosix" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.base.1362883699" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base"> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.base.735750578" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.tutorials.cpp}/LinuxPosix" id="cdt.managedbuild.target.gnu.builder.base.573969466" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.archiver.base.1482613308" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2134443291" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"> + <option id="gnu.cpp.compiler.option.include.paths.1263573154" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + </option> + <option id="gnu.cpp.compiler.option.optimization.level.401439173" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.debugging.level.1048371522" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1432324036" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.2117376630" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"> + <option id="gnu.c.compiler.option.include.paths.567943289" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"/> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.920319210" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.option.debugging.level.2118090648" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1453951142" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.base.1690819981" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.945150042" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"> + <option id="gnu.cpp.link.option.libs.756838940" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.modellib.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="pthread"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="rt"/> + </option> + <option id="gnu.cpp.link.option.paths.1991551719" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/LinuxPosix}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/LinuxPosix}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/LinuxPosix}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1724866444" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + <tool id="cdt.managedbuild.tool.gnu.assembler.base.1297836620" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"> + <option id="gnu.both.asm.option.include.paths.1731441660" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1042810554" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.294295052" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.modellib.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.modellib.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="org.eclipse.etrice.tutorials.cpp.cdt.managedbuild.target.gnu.mingw.exe.998447895" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> + <storageModule moduleId="refreshScope" versionNumber="2"> + <configuration configurationName="Release"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.tutorials.cpp"/> + </configuration> + <configuration configurationName="WindowsMinGW"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.tutorials.cpp"/> + </configuration> + <configuration configurationName="Debug"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.tutorials.cpp"/> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329;cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329.;cdt.managedbuild.tool.gnu.c.compiler.base.2117376630;cdt.managedbuild.tool.gnu.c.compiler.input.1453951142"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329;cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329.;cdt.managedbuild.tool.gnu.cpp.compiler.base.2134443291;cdt.managedbuild.tool.gnu.cpp.compiler.input.1432324036"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.1661058126;cdt.managedbuild.config.gnu.mingw.exe.release.1661058126.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.1813252183;cdt.managedbuild.tool.gnu.cpp.compiler.input.1940053336"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.1661058126;cdt.managedbuild.config.gnu.mingw.exe.release.1661058126.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1248435059;cdt.managedbuild.tool.gnu.c.compiler.input.1097403450"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329;cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.516972569;cdt.managedbuild.tool.gnu.cpp.compiler.input.2038569775"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733;cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1373358885;cdt.managedbuild.tool.gnu.c.compiler.input.1734922408"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329;cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.2011759281;cdt.managedbuild.tool.gnu.c.compiler.input.1382639861"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733;cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.2100048552;cdt.managedbuild.tool.gnu.cpp.compiler.input.1294463514"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + </storageModule> +</cproject> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/.gitignore b/examples/org.eclipse.etrice.tutorials.cpp/.gitignore new file mode 100644 index 000000000..d2a6ec005 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/.gitignore @@ -0,0 +1,8 @@ +WindowsMinGW +LinuxPosix +src-gen/* +!src-gen/readme.txt +src-gen-info/* +!src-gen-info/readme.txt +log/* +!log/readme.txt diff --git a/examples/org.eclipse.etrice.tutorials.cpp/.project b/examples/org.eclipse.etrice.tutorials.cpp/.project new file mode 100644 index 000000000..ce9f5da7d --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/.project @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.etrice.tutorials.cpp</name> + <comment></comment> + <projects> + <project>org.eclipse.etrice.runtime.cpp</project> + <project>org.eclipse.etrice.runtime.c</project> + <project>org.eclipse.etrice.modellib.cpp</project> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + </natures> +</projectDescription> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/examples/org.eclipse.etrice.tutorials.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 000000000..88f0f6f8c --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733/appendContributed=true diff --git a/examples/org.eclipse.etrice.tutorials.cpp/log/readme.txt b/examples/org.eclipse.etrice.tutorials.cpp/log/readme.txt new file mode 100644 index 000000000..dadbdcfe8 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/log/readme.txt @@ -0,0 +1 @@ +This directory is an eTrice directory used for logging e.g. MSC.
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/HelloWorld.room b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/HelloWorld.room new file mode 100644 index 000000000..c76ce1334 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/HelloWorld.room @@ -0,0 +1,42 @@ +/* + * Shortkeys: + * Ctrl+Space - content assist + * F3 - open declaration of selected element + * Alt+S - open structure diagram + * Alt+B - open behavior diagram + * Alt+M - open textual editor (in diagrams) + */ +RoomModel HelloWorldModel { + + import room.basic.types.* from "../../../org.eclipse.etrice.modellib.cpp/model/Types.room" + import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib.cpp/model/TimingService.room" + + LogicalSystem LogSys { + SubSystemRef subSystemRef: SubSysClass + } + + SubSystemClass SubSysClass { + ActorRef topActor: TopActor + ActorRef timingService: ATimingService + LayerConnection ref topActor satisfied_by timingService.timer + LogicalThread defaultThread + } + + // - build your application from here + ActorClass TopActor { + Structure { + + } + Behavior { + StateMachine { + Transition init: initial -> helloState + State helloState { + entry { + "printf(\"### Hello World! ###\\n\");" + } + } + } + } + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Mapping.etmap b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Mapping.etmap new file mode 100644 index 000000000..2c9c9bdc5 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Mapping.etmap @@ -0,0 +1,17 @@ +/* + * This model defines a mapping between a logical ROOM model and a physical model (nodes and threads). + * + * <p>Hint: Press F3 to open declaration of selected element or import</p> + */ +MappingModel TemplateMapping { + + import TemplatePhysical.* from "Physical.etphys" + import HelloWorldModel.* from "HelloWorld.room" + + Mapping LogSys -> TemplatePhysicalSystem { + SubSystemMapping subSystemRef -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Physical.etphys b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Physical.etphys new file mode 100644 index 000000000..2bf93c456 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Physical.etphys @@ -0,0 +1,43 @@ +PhysicalModel TemplatePhysical { + + PhysicalSystem TemplatePhysicalSystem { + NodeRef node : DefaultNodeClass + } + + NodeClass DefaultNodeClass { + runtime = DefaultRuntimeClass + priomin = -10 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/generate_HelloWorldCpp.launch b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/generate_HelloWorldCpp.launch new file mode 100644 index 000000000..fbb1ccdb4 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/generate_HelloWorldCpp.launch @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.etrice.generator.launch.cpp.launchConfigurationType"> +<booleanAttribute key="Debug" value="false"/> +<booleanAttribute key="GenDocumentation" value="false"/> +<booleanAttribute key="GenInstanceDiagram" value="false"/> +<stringAttribute key="GenModelPath" value=""/> +<booleanAttribute key="Lib" value="false"/> +<booleanAttribute key="MSC" value="true"/> +<booleanAttribute key="DataLogging" value="true"/> +<listAttribute key="ModelFiles"> +<listEntry value="${workspace_loc:/org.eclipse.etrice.tutorials.cpp/model/HelloWorld/Mapping.etmap}"/> +</listAttribute> +<booleanAttribute key="SaveGenModel" value="false"/> +<booleanAttribute key="Verbose" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/Mapping.etmap b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/Mapping.etmap new file mode 100644 index 000000000..f49796b29 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/Mapping.etmap @@ -0,0 +1,17 @@ +/* + * This model defines a mapping between a logical ROOM model and a physical model (nodes and threads). + * + * <p>Hint: Press F3 to open declaration of selected element or import</p> + */ +MappingModel TemplateMapping { + + import TemplatePhysical.* from "Physical.etphys" + import PingPongModel.* from "PingPong.room" + + Mapping LogSys -> TemplatePhysicalSystem { + SubSystemMapping subSystemRef -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/Physical.etphys b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/Physical.etphys new file mode 100644 index 000000000..2bf93c456 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/Physical.etphys @@ -0,0 +1,43 @@ +PhysicalModel TemplatePhysical { + + PhysicalSystem TemplatePhysicalSystem { + NodeRef node : DefaultNodeClass + } + + NodeClass DefaultNodeClass { + runtime = DefaultRuntimeClass + priomin = -10 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/PingPong.room b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/PingPong.room new file mode 100644 index 000000000..08c941d8f --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/PingPong.room @@ -0,0 +1,109 @@ +/* + * Shortkeys: + * Ctrl+Space - content assist + * F3 - open declaration of selected element + * Alt+S - open structure diagram + * Alt+B - open behavior diagram + * Alt+M - open textual editor (in diagrams) + */ +RoomModel PingPongModel { + + import room.basic.types.* from "../../../org.eclipse.etrice.modellib.cpp/model/Types.room" + import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib.cpp/model/TimingService.room" + + LogicalSystem LogSys { + SubSystemRef subSystemRef: SubSysClass + } + + SubSystemClass SubSysClass { + ActorRef topActor: TopActor + ActorRef timingService: ATimingService + LayerConnection ref topActor satisfied_by timingService.timer + LogicalThread defaultThread + } + + // - build your application from here + ActorClass TopActor { + Structure { + ActorRef sender : Sender + ActorRef receiver : Receiver + Binding sender.sendPort and receiver.recvPort + } + Behavior { + + } + } + + // - PingPong building kit + + ActorClass Sender { + Interface { + conjugated Port sendPort: PingPongProtocol + } + Structure { + external Port sendPort + } + Behavior { + StateMachine { + Transition init: initial -> sendingPing + Transition tr0: sendingPing -> receivedPong { + triggers { + <pong: sendPort> + } + } + State sendingPing { + entry { + "sendPort.ping();" + } + } + State receivedPong + } + } + } + + ActorClass Receiver { + Interface { + Port recvPort: PingPongProtocol + } + Structure { + external Port recvPort + SAP timingService: PTimer + } + Behavior { + StateMachine { + Transition init: initial -> waitingForPing + Transition tr0: waitingForPing -> receivedPing { + triggers { + <ping: recvPort> + } + } + Transition tr1: receivedPing -> sentPong { + triggers { + <timeout: timingService> + } + } + State waitingForPing + State receivedPing { + entry { + "timingService.startTimeout(500);" + } + } + State sentPong { + entry { + "recvPort.pong();" + } + } + } + } + } + + ProtocolClass PingPongProtocol { + incoming { + Message ping() + } + outgoing { + Message pong() + } + } + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Receiver.behavior b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Receiver.behavior new file mode 100644 index 000000000..ae2938c64 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Receiver.behavior @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of Receiver" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@children.0/@children.3/@link //@children.0/@children.4/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../PingPong.room#ActorClass:Receiver"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="sg"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#StateGraph:Receiver$sg"/> + </link> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="800" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="100" y="100"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="10" y="10"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#StateGraph:Receiver$sg"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="40" height="20" y="10" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="I"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="141" height="90" x="206" y="134"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="81" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="56" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="40" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="40" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="40" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#SimpleState:Receiver$waitingForPing"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1" incomingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="81" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="waitingForPing"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="132" height="90" x="512" y="134"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="72" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="47" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" x="36" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="36" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="36" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#SimpleState:Receiver$receivedPing"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.2" incomingConnections="//@connections.1" referencedGraphicsAlgorithm="//@children.0/@children.3/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="72" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="receivedPing"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="120" height="90" x="518" y="277"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="35" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" x="30" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#SimpleState:Receiver$sentPong"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.2" referencedGraphicsAlgorithm="//@children.0/@children.4/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="60" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="sentPong"/> + </children> + </children> + </children> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.1/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#InitialTransition:Receiver$initial"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="init"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#TriggeredTransition:Receiver$tr0"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="-45" y="1" font="//@fonts.0" value="tr0: <ping:recvPort>"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.3/@anchors.0" end="//@children.0/@children.4/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#TriggeredTransition:Receiver$tr1"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr1: <timeout:timing..."/> + </connectionDecorators> + </connections> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <colors red="200" green="200" blue="200"/> + <fonts name="Arial" size="8"/> + <fonts name="Arial" size="9" bold="true"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Receiver.structure b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Receiver.structure new file mode 100644 index 000000000..c65ba4f1b --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Receiver.structure @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of Receiver" pictogramLinks="//@link //@children.0/@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../PingPong.room#ActorClass:Receiver"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="cls"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" lineVisible="false" transparency="0.5" width="800" height="500" x="40" y="40"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorClass:Receiver"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value=""/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="400"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.2" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="40" height="40" x="20" y="20"/> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.1" lineWidth="2" transparency="0.0" width="20" height="20" x="30" y="30"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#Port:Receiver$recvPort"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" font="//@fonts.0" value="recvPort"/> + </children> + </children> + </children> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <fonts name="Arial" size="8"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Sender.behavior b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Sender.behavior new file mode 100644 index 000000000..10884d9d0 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Sender.behavior @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of Sender" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@children.0/@children.3/@link //@connections.0/@link //@connections.1/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../PingPong.room#ActorClass:Sender"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="sg"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#StateGraph:Sender$sg"/> + </link> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="800" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="100" y="100"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="10" y="10"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#StateGraph:Sender$sg"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="40" height="20" y="10" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="I"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="128" height="90" x="202" y="120"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="68" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="43" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" x="34" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="34" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="34" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#SimpleState:Sender$sendingPing"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1" incomingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="68" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="sendingPing"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="136" height="90" x="464" y="120"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="76" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="51" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="38" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="38" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="38" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#SimpleState:Sender$receivedPong"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.1" referencedGraphicsAlgorithm="//@children.0/@children.3/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="76" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="receivedPong"/> + </children> + </children> + </children> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.1/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#InitialTransition:Sender$initial"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="init"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#TriggeredTransition:Sender$tr0"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="-48" y="1" font="//@fonts.0" value="tr0: <pong:sendPort>"/> + </connectionDecorators> + </connections> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <colors red="200" green="200" blue="200"/> + <fonts name="Arial" size="8"/> + <fonts name="Arial" size="9" bold="true"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Sender.structure b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Sender.structure new file mode 100644 index 000000000..7e4fdfcd4 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.Sender.structure @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of Sender" pictogramLinks="//@link //@children.0/@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../PingPong.room#ActorClass:Sender"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="cls"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" lineVisible="false" transparency="0.5" width="800" height="500" x="40" y="40"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorClass:Sender"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value="C"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="403" y="500"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="40" height="40" x="20" y="20"/> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.2" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="30" y="30"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#Port:Sender$sendPort"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" y="60" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="sendPort"/> + </children> + </children> + </children> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <fonts name="Arial" size="8"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.SubSysClass.structure b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.SubSysClass.structure new file mode 100644 index 000000000..c6fda1207 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.SubSysClass.structure @@ -0,0 +1,291 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of SubSysClass" pictogramLinks="//@link //@children.0/@link //@children.0/@children.0/@link //@children.0/@children.1/@link //@children.0/@children.1/@children.2/@link //@connections.0/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../PingPong.room#SubSystemClass:SubSysClass"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="cls"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" lineVisible="false" transparency="0.5" width="800" height="500" x="40" y="40"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#SubSystemClass:SubSysClass"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="ref"/> + <properties key="actorref_version" value="2"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="240" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="180" height="80" x="33" y="27"> + <properties key="actorref_graphic_element" value="replborder"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="180" height="80" x="30" y="30"> + <properties key="actorref_graphic_element" value="mainborder"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" width="20" height="10" x="150" y="50"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" width="20" height="10" x="145" y="65"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="15"/> + <points x="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="30"/> + <points x="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="45"/> + <points x="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="60"/> + <points x="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="75"/> + <points x="75"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="10" y="80"/> + <points x="90"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="25" y="80"/> + <points x="105"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="40" y="80"/> + <points x="120"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="55" y="80"/> + <points x="135"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="70" y="80"/> + <points x="150"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="85" y="80"/> + <points x="165"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="100" y="80"/> + <points x="180"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="115" y="80"/> + <points x="180" y="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="130" y="80"/> + <points x="180" y="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="145" y="80"/> + <points x="180" y="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="160" y="80"/> + <points x="180" y="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="175" y="80"/> + <points x="180" y="75"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="25" height="25" x="185" y="30"> + <properties key="actorref_graphic_element" value="sizeframe"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorRef:SubSysClass$topActor"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.1"> + <properties key="actorref_graphic_element" value="layerconn_anchor"/> + </anchors> + <children visible="true"> + <properties key="actorref_graphic_element" value="name_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="180" height="80" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="topActor
(TopActor)"/> + </children> + <children> + <properties key="actorref_graphic_element" value="size_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="25" height="25" x="185" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="1"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="ref"/> + <properties key="actorref_version" value="2"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="254" y="281"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="180" height="80" x="33" y="27"> + <properties key="actorref_graphic_element" value="replborder"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="180" height="80" x="30" y="30"> + <properties key="actorref_graphic_element" value="mainborder"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="20" height="10" x="150" y="50"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="20" height="10" x="145" y="65"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="15"/> + <points x="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="30"/> + <points x="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="45"/> + <points x="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="60"/> + <points x="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="75"/> + <points x="75"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="10" y="80"/> + <points x="90"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="25" y="80"/> + <points x="105"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="40" y="80"/> + <points x="120"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="55" y="80"/> + <points x="135"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="70" y="80"/> + <points x="150"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="85" y="80"/> + <points x="165"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="100" y="80"/> + <points x="180"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="115" y="80"/> + <points x="180" y="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="130" y="80"/> + <points x="180" y="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="145" y="80"/> + <points x="180" y="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="160" y="80"/> + <points x="180" y="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="175" y="80"/> + <points x="180" y="75"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="25" height="25" x="185" y="30"> + <properties key="actorref_graphic_element" value="sizeframe"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorRef:SubSysClass$timingService"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.1"> + <properties key="actorref_graphic_element" value="layerconn_anchor"/> + </anchors> + <children visible="true"> + <properties key="actorref_graphic_element" value="name_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="180" height="80" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="timingService
(ATimingService)"/> + </children> + <children> + <properties key="actorref_graphic_element" value="size_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="25" height="25" x="185" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="1"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value=""/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="60" height="60" x="89"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="18" height="18" x="21" y="21"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../../../../org.eclipse.etrice.modellib.cpp/model/TimingService.room#SPP:ATimingService$timer"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="60" height="15" y="6" font="//@fonts.0" value="timer"/> + </children> + </children> + </children> + </children> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.0/@anchors.0" end="//@children.0/@children.1/@children.2/@anchors.0"> + <properties key="obj-type" value="conn"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="2" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#LayerConnection:SubSysClass$topActor-timingService!timer"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="2" filled="false" transparency="0.0"> + <points x="-15" y="10"/> + <points/> + <points x="-15" y="-10"/> + </graphicsAlgorithm> + </connectionDecorators> + </connections> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <colors red="200" green="200" blue="200"/> + <fonts name="Arial" size="8"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.TopActor.structure b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.TopActor.structure new file mode 100644 index 000000000..75c499a78 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/diagrams/PingPongModel.TopActor.structure @@ -0,0 +1,299 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of TopActor" pictogramLinks="//@link //@children.0/@link //@children.0/@children.0/@link //@children.0/@children.1/@link //@children.0/@children.0/@children.2/@link //@children.0/@children.1/@children.2/@link //@connections.0/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../PingPong.room#ActorClass:TopActor"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="cls"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" lineVisible="false" transparency="0.5" width="800" height="500" x="40" y="40"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorClass:TopActor"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="ref"/> + <properties key="actorref_version" value="2"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="174" y="90"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="180" height="80" x="33" y="27"> + <properties key="actorref_graphic_element" value="replborder"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="180" height="80" x="30" y="30"> + <properties key="actorref_graphic_element" value="mainborder"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="20" height="10" x="150" y="50"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="20" height="10" x="145" y="65"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="15"/> + <points x="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="30"/> + <points x="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="45"/> + <points x="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="60"/> + <points x="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="75"/> + <points x="75"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="10" y="80"/> + <points x="90"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="25" y="80"/> + <points x="105"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="40" y="80"/> + <points x="120"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="55" y="80"/> + <points x="135"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="70" y="80"/> + <points x="150"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="85" y="80"/> + <points x="165"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="100" y="80"/> + <points x="180"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="115" y="80"/> + <points x="180" y="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="130" y="80"/> + <points x="180" y="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="145" y="80"/> + <points x="180" y="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="160" y="80"/> + <points x="180" y="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="175" y="80"/> + <points x="180" y="75"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="25" height="25" x="185" y="30"> + <properties key="actorref_graphic_element" value="sizeframe"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorRef:TopActor$sender"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.1"> + <properties key="actorref_graphic_element" value="layerconn_anchor"/> + </anchors> + <children visible="true"> + <properties key="actorref_graphic_element" value="name_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="180" height="80" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="sender
(Sender)"/> + </children> + <children> + <properties key="actorref_graphic_element" value="size_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="25" height="25" x="185" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="1"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value="C"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="60" height="60" x="88" y="80"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="18" height="18" x="21" y="21"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#Port:Sender$sendPort"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="60" height="15" y="39" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="sendPort"/> + </children> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="ref"/> + <properties key="actorref_version" value="2"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="240" height="140" x="309" y="308"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="180" height="80" x="33" y="27"> + <properties key="actorref_graphic_element" value="replborder"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="180" height="80" x="30" y="30"> + <properties key="actorref_graphic_element" value="mainborder"/> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="20" height="10" x="150" y="50"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="20" height="10" x="145" y="65"> + <properties key="actorref_graphic_element" value="substructure"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="15"/> + <points x="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="30"/> + <points x="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="45"/> + <points x="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="60"/> + <points x="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points y="75"/> + <points x="75"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="10" y="80"/> + <points x="90"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="25" y="80"/> + <points x="105"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="40" y="80"/> + <points x="120"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="55" y="80"/> + <points x="135"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="70" y="80"/> + <points x="150"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="85" y="80"/> + <points x="165"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="100" y="80"/> + <points x="180"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="115" y="80"/> + <points x="180" y="15"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="130" y="80"/> + <points x="180" y="30"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="145" y="80"/> + <points x="180" y="45"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="160" y="80"/> + <points x="180" y="60"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineStyle="UNSPECIFIED" lineVisible="false" transparency="0.4"> + <properties key="actorref_graphic_element" value="hatched_line"/> + <points x="175" y="80"/> + <points x="180" y="75"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="25" height="25" x="185" y="30"> + <properties key="actorref_graphic_element" value="sizeframe"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#ActorRef:TopActor$receiver"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.1"> + <properties key="actorref_graphic_element" value="layerconn_anchor"/> + </anchors> + <children visible="true"> + <properties key="actorref_graphic_element" value="name_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="180" height="80" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="receiver
(Receiver)"/> + </children> + <children> + <properties key="actorref_graphic_element" value="size_shape"/> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.3" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="25" height="25" x="185" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="1"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> + <properties key="item-kind" value=""/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="60" height="60" x="89"> + <graphicsAlgorithmChildren xsi:type="al:Rectangle" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="18" height="18" x="21" y="21"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../PingPong.room#Port:Receiver$recvPort"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="60" height="15" y="6" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="recvPort"/> + </children> + </children> + </children> + </children> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.0/@children.2/@anchors.0" end="//@children.0/@children.1/@children.2/@anchors.0"> + <properties key="obj-type" value="bind"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../PingPong.room#Binding:TopActor$sendPort!sender-recvPort!receiver"/> + </link> + </connections> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <colors red="200" green="200" blue="200"/> + <fonts name="Arial" size="8"/> +</pi:Diagram> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/generate_PingPongCpp.launch b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/generate_PingPongCpp.launch new file mode 100644 index 000000000..702765a93 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/model/PingPong/generate_PingPongCpp.launch @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.etrice.generator.launch.cpp.launchConfigurationType"> +<booleanAttribute key="Debug" value="false"/> +<booleanAttribute key="GenDocumentation" value="false"/> +<booleanAttribute key="GenInstanceDiagram" value="false"/> +<stringAttribute key="GenModelPath" value=""/> +<booleanAttribute key="Lib" value="false"/> +<booleanAttribute key="MSC" value="true"/> +<booleanAttribute key="DataLogging" value="true"/> +<listAttribute key="ModelFiles"> +<listEntry value="${workspace_loc:/org.eclipse.etrice.tutorials.cpp/model/PingPong/Mapping.etmap}"/> +</listAttribute> +<booleanAttribute key="SaveGenModel" value="false"/> +<booleanAttribute key="Verbose" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/run_Readme b/examples/org.eclipse.etrice.tutorials.cpp/run_Readme new file mode 100644 index 000000000..7a19fc356 --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/run_Readme @@ -0,0 +1,4 @@ +Perform a clean of the project whenever you run another generated model. (Menu: Project -> Clean) + +Switching from HelloWorld to PingPong application requires a complete clean before run. +Otherwise there might be more than one main function in the binary folder.
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials.cpp/run_Template_Linux_.launch b/examples/org.eclipse.etrice.tutorials.cpp/run_Template_Linux_.launch new file mode 100644 index 000000000..e91ee2ebc --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/run_Template_Linux_.launch @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/> +<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> +<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> +<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> +<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="LinuxPosix/org.eclipse.etrice.tutorials.cpp.exe"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="org.eclipse.etrice.tutorials.cpp"/> +<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733.766587329"/> +<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.etrice.tutorials.cpp"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/> +<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/run_Template_Windows_.launch b/examples/org.eclipse.etrice.tutorials.cpp/run_Template_Windows_.launch new file mode 100644 index 000000000..1f9d56d7a --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/run_Template_Windows_.launch @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/> +<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/> +<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/> +<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/> +<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> +<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> +<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> +<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> +<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="WindowsMinGW\org.eclipse.etrice.tutorials.cpp.exe"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="org.eclipse.etrice.tutorials.cpp"/> +<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> +<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.mingw.exe.debug.1129952733"/> +<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.etrice.tutorials.cpp"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="4"/> +</listAttribute> +<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/> +<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/> +</launchConfiguration> diff --git a/examples/org.eclipse.etrice.tutorials.cpp/src-gen-info/readme.txt b/examples/org.eclipse.etrice.tutorials.cpp/src-gen-info/readme.txt new file mode 100644 index 000000000..1dc2b35ab --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/src-gen-info/readme.txt @@ -0,0 +1,4 @@ +This directory is an eTrice code generation target. +It will be erased every time the generator is executed. + +DO NOT PLACE OTHER FILES HERE! diff --git a/examples/org.eclipse.etrice.tutorials.cpp/src-gen/readme.txt b/examples/org.eclipse.etrice.tutorials.cpp/src-gen/readme.txt new file mode 100644 index 000000000..1dc2b35ab --- /dev/null +++ b/examples/org.eclipse.etrice.tutorials.cpp/src-gen/readme.txt @@ -0,0 +1,4 @@ +This directory is an eTrice code generation target. +It will be erased every time the generator is executed. + +DO NOT PLACE OTHER FILES HERE! diff --git a/plugins/org.eclipse.etrice.doc/featuremodel/etrice.codegenerators.featurizer b/plugins/org.eclipse.etrice.doc/featuremodel/etrice.codegenerators.featurizer index a23df9bec..20aff0226 100644 --- a/plugins/org.eclipse.etrice.doc/featuremodel/etrice.codegenerators.featurizer +++ b/plugins/org.eclipse.etrice.doc/featuremodel/etrice.codegenerators.featurizer @@ -6,30 +6,51 @@ Package CodeGenerators description '''''' contains CCodeGenerator contains JavaCodeGenerator + contains CPPCodeGenerator ; Feature CCodeGenerator shortName '''C Code Generator''' description '''''' - + contains GenerationOptions contains MSCLogging contains DataLogging - + stable ; Feature JavaCodeGenerator shortName '''Java Code Generator''' description '''''' - + contains GenerationOptions contains MSCLogging - + stable ; Feature CPPCodeGenerator shortName '''C++ Code Generator''' - description '''''' + description ''' + Missing Features: + + - memory management of messages (pool + free memory) + + - Inheritance + - Enums, non-primtive datatypes e.g. string, DataClass ... + - Wait on 'quit' in cmd (atm wait 30sec) + - getter/setter attributes + + TODO: + - fix free memory on exit (delete of instance tree in runner) + - remove streams + - find compiler flags for deactivating exceptions, streams ... + - includes to generated files + + Optimization: + - for C11 use unordered map + - reduce use of dynamic_cast and rtti + + ''' prototype ; @@ -38,7 +59,7 @@ Feature GenerationOptions text ''' Options for generation are configured in the launch configuration or in case of standalone generation via command line. A list of available options: - + - generate as library - generate documentation - generate instrumentation for MSC generation @@ -53,10 +74,10 @@ Feature MSCLogging description '''Runtime logger for event-driven Messages, represented as a Message Sequence Chart.''' text ''' The MSCLogging is activated by default, but can be set manually in the [GenerationOptions][]. The output file is created upon regular termination of the application. The resulting file can be found in the logging directory and has the name *msc.seq*, which can be open with the free open source tool [Trace2UML](http://trace2uml.stage.tigris.org/). - + ![MSCLogging](images/300-MSCLogging.png) ''' - + uses GenerationOptions stable ; @@ -68,25 +89,25 @@ Feature DataLogging ```room @DataLogging(pathlist = "/portInstancePath,/portInstancePath,..") - ``` - + ``` + Where `pathlist` is a string specifying a list of port instances which should be instrumented for data logging: - + - the path of a port instance starts with the name of the [LogicalSystem][] and thus consists of at least 4 following segments - `/portInstancePath` = `/LogicalSystem/SubSystemRef/ActorRef/Port` + `/portInstancePath` = `/LogicalSystem/SubSystemRef/ActorRef/Port` - multiple paths are separated through comma (`,`), but avoid any whitespace - the [Port][] must be conjugated and it´s [ProtocolClass][] has to be data-driven - only the first Message having primitive or enum typed data is considered - + The logging status can be verified in the generation console. It will output an overview of all accepted ports. In the [GenerationOptions][] is possible to (de)activate the data logging and thus ignoring the presence of the annotation. - - At runtime the data values will then be logged - + + At runtime the data values will then be logged + - into a file *log/SubSystemRef.data.csv* - it contains one column for each port instance - and a new row for every polling cycle, containing all readout data values - the first column is used to number the cycles - + Multi-Threading is not supported, the system must have not more than one polled/async physical thread. @@ -102,11 +123,11 @@ Feature DataLogging example ''' ```room import room.basic.annotations.* from "../../org.eclipse.etrice.modellib.c/model/Annotations.room" - + LogicalSystem Logging { SubSystemRef main: MainSubSystem } - + SubSystemClass MainSubSystem { @DataLogging(pathlist = "/Logging/main/actorRef1/port1") @Gnuplot(format="pngcairo", outputfile="main.data.png", width=1800, height=600, fontsize=10) @@ -127,11 +148,11 @@ Feature DataLogging 5, 0.389418 ,0.500000 [...] ``` - - Resulting graph created from generated gnuplot script: + + Resulting graph created from generated gnuplot script: ![Gnuplot example](images/300-Gnuplot.png) ''' - + uses Annotation prototype ; diff --git a/plugins/org.eclipse.etrice.doc/online-doc/static/css/custom.css b/plugins/org.eclipse.etrice.doc/online-doc/static/css/custom.css index bd6ab8e4a..3e32f8661 100644 --- a/plugins/org.eclipse.etrice.doc/online-doc/static/css/custom.css +++ b/plugins/org.eclipse.etrice.doc/online-doc/static/css/custom.css @@ -2,10 +2,6 @@ color: #888; } -.pull-right { - float: right; -} - /* bootstrap nestd list fix */ ol ol, ol ul, ul ol, ul ul { margin-bottom: 10px; diff --git a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF index 0f8f12b24..d72474055 100644 --- a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF @@ -5,15 +5,14 @@ Bundle-Vendor: Eclipse eTrice (Incubation) Bundle-Version: 0.5.0.qualifier Bundle-SymbolicName: org.eclipse.etrice.generator.c;singleton:=true Bundle-ActivationPolicy: lazy -Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.5.0", - org.eclipse.etrice.core.genmodel;bundle-version="0.5.0", +Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="0.5.0", + org.eclipse.etrice.core.etphys;bundle-version="0.5.0", + org.eclipse.etrice.core.etmap;bundle-version="0.5.0", org.eclipse.etrice.generator.fsm;bundle-version="0.5.0", org.eclipse.etrice.generator;bundle-version="0.5.0", - org.eclipse.etrice.generator.doc;bundle-version="0.5.0", org.eclipse.etrice.generator.config;bundle-version="0.5.0", + org.eclipse.etrice.generator.doc;bundle-version="0.5.0", org.eclipse.etrice.generator.gnuplot;bundle-version="0.5.0", - org.eclipse.etrice.core.etmap;bundle-version="0.5.0", - org.eclipse.etrice.core.etphys;bundle-version="0.5.0", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.ui;bundle-version="3.7.0", @@ -23,4 +22,6 @@ Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.5.0", org.eclipse.xtext.util;bundle-version="2.6.0" Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: org.eclipse.etrice.generator.c +Export-Package: org.eclipse.etrice.generator.c, + org.eclipse.etrice.generator.c.gen, + org.eclipse.etrice.generator.c.setup diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend index 03c557429..c4d14fa5e 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend @@ -4,11 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) * Thomas Schuetz (changed for C code generator) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.c.gen @@ -19,7 +19,6 @@ import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType 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 -import org.eclipse.etrice.core.room.ActorClass import org.eclipse.etrice.core.room.CommunicationType import org.eclipse.etrice.core.room.Operation import org.eclipse.etrice.core.room.ProtocolClass @@ -33,7 +32,7 @@ import org.eclipse.etrice.generator.generic.RoomExtensions @Singleton class ActorClassGen extends GenericActorClassGenerator { - + @Inject protected extension RoomExtensions @Inject extension CExtensions @Inject extension ProcedureHelpers @@ -42,16 +41,16 @@ class ActorClassGen extends GenericActorClassGenerator { @Inject protected ILanguageExtension langExt @Inject IGeneratorFileIo fileIO @Inject ILogger logger - + def doGenerate(Root root) { for (xpac: root.xpActorClasses) { val path = xpac.actorClass.generationTargetPath+xpac.actorClass.getPath val infopath = xpac.actorClass.generationInfoPath+xpac.actorClass.getPath var file = xpac.actorClass.getCHeaderFileName - + // header file fileIO.generateFile("generating ActorClass header", path, infopath, file, root.generateHeaderFile(xpac)) - + // utils file file = xpac.actorClass.getCUtilsFileName fileIO.generateFile("generating ActorClass utils", path, infopath, file, root.generateUtilsFile(xpac)) @@ -66,7 +65,7 @@ class ActorClassGen extends GenericActorClassGenerator { } } } - + def private generateHeaderFile(Root root, ExpandedActorClass xpac) { val ac = xpac.actorClass val eventPorts = ac.allEndPorts.filter(p|(p.protocol as ProtocolClass).commType==CommunicationType::EVENT_DRIVEN) @@ -77,20 +76,20 @@ class ActorClassGen extends GenericActorClassGenerator { val hasConstData = !(eventPorts.empty && recvPorts.empty && ac.allSAPs.empty && ac.allServiceImplementations.empty) || Main::settings.generateMSCInstrumentation val hasVarData = !(sendPorts.empty && ac.allAttributes.empty && xpac.stateMachine.empty && !hasConstData) - + ''' /** * @author generated by eTrice * * Header File of ActorClass «ac.name» - * + * */ - + «generateIncludeGuardBegin(ac)» - + #include "etDatatypes.h" #include "messaging/etMessage.h" - + «FOR dataClass : root.getReferencedDataClasses(ac)» #include «dataClass.includePath» «ENDFOR» @@ -100,17 +99,17 @@ class ActorClassGen extends GenericActorClassGenerator { «FOR pc : root.getReferencedProtocolClasses(ac)» #include «pc.includePath» «ENDFOR» - + «ac.userCode(1, true)» - + typedef struct «ac.name» «ac.name»; - + /* const part of ActorClass (ROM) */ «IF hasConstData» typedef struct «ac.name»_const { «IF Main::settings.generateMSCInstrumentation» const char* instName; - + «ENDIF» /* simple ports */ «FOR ep : eventPorts» @@ -118,7 +117,7 @@ class ActorClassGen extends GenericActorClassGenerator { const «ep.getPortClassName()» «ep.name»; «ENDIF» «ENDFOR» - + /* data receive ports */ «FOR ep : recvPorts» «IF ep.multiplicity==1» @@ -130,14 +129,14 @@ class ActorClassGen extends GenericActorClassGenerator { «FOR sap: ac.allSAPs» const «sap.getPortClassName()» «sap.name»; «ENDFOR» - + /* replicated ports */ «FOR ep : ac.allEndPorts» «IF ep.multiplicity!=1» const etReplPort «ep.name»; «ENDIF» «ENDFOR» - + /* services */ «FOR svc : ac.allServiceImplementations» const etReplPort «svc.spp.name»; @@ -146,18 +145,18 @@ class ActorClassGen extends GenericActorClassGenerator { «ELSE» /* this actor class has no ports and thus no constant data */ «ENDIF» - + «IF !xpac.stateMachine.empty» - + «xpac.genHeaderConstants» «ENDIF» - + /* variable part of ActorClass (RAM) */ «IF hasVarData» struct «ac.name» { «IF hasConstData» const «ac.name»_const* const constData; - + «ENDIF» /* data send ports */ «FOR ep : sendPorts» @@ -165,11 +164,11 @@ class ActorClassGen extends GenericActorClassGenerator { «ep.getPortClassName()» «ep.name»; «ENDIF» «ENDFOR» - + «ac.allAttributes.attributes» - + «IF !xpac.stateMachine.empty» - + «xpac.genDataMembers» «ENDIF» }; @@ -186,23 +185,22 @@ class ActorClassGen extends GenericActorClassGenerator { void «ac.name»_init(«ac.name»* self); void «ac.name»_receiveMessage(void* self, const void* ifitem, const etMessage* msg); - + «IF dataDriven || async» void «ac.name»_execute(«ac.name»* self); «ENDIF» - - «IF ac.allStructors.exists[isConstructor]»«getConstructorSignature(ac.name)»;«ENDIF» - «IF ac.allStructors.exists[!isConstructor]»«getDestructorSignature(ac.name)»;«ENDIF» - + + «ac.userStructorsDeclaration» + «ac.latestOperations.operationsDeclaration(ac.name)» - + «ac.userCode(2, true)» - + «generateIncludeGuardEnd(ac)» - + ''' } - + def private generateUtilsFile(Root root, ExpandedActorClass xpac) { val ac = xpac.actorClass val eventPorts = ac.allEndPorts.filter(p|(p.protocol as ProtocolClass).commType==CommunicationType::EVENT_DRIVEN) @@ -211,23 +209,23 @@ class ActorClassGen extends GenericActorClassGenerator { val recvPorts = ac.allEndPorts.filter(p|(p.protocol as ProtocolClass).commType==CommunicationType::DATA_DRIVEN && !p.conjugated && p.multiplicity==1) val portsWithOperations = ac.allInterfaceItems.filter(p|p.portClass!=null && p.portClass.operations.size>0) val filename = (ac.eContainer as RoomModel).name.replaceAll("\\.","_")+"_"+ac.name+"_Utils" - + ''' /** * @author generated by eTrice * * Utils File of ActorClass «ac.name» - * + * */ - + «generateIncludeGuardBegin(filename)» - + #include «ac.includePath» - + /* * access macros for ports, operations and attributes */ - + /* simple event ports */ «FOR ep : eventPorts.filter[multiplicity==1]» «FOR msg : ep.outgoing» @@ -236,14 +234,14 @@ class ActorClassGen extends GenericActorClassGenerator { #define «ep.name»_«msg.name»(«data1») «ep.portClassName»_«msg.name»(&self->constData->«ep.name»«data2») «ENDFOR» «ENDFOR» - + /* data receive ports */ «FOR ep : recvPorts» «FOR msg : ep.incoming» #define «ep.name»_«msg.name» «ep.portClassName»_«msg.name»_get(&self->constData->«ep.name») «ENDFOR» «ENDFOR» - + /* data send ports */ «FOR ep : sendPorts» «FOR msg : ep.outgoing» @@ -261,7 +259,7 @@ class ActorClassGen extends GenericActorClassGenerator { #define «sap.name»_«msg.name»(«data1») «sap.portClassName»_«msg.name»(&self->constData->«sap.name»«data2») «ENDFOR» «ENDFOR» - + /* replicated event ports */ «IF !replEventPorts.empty» #define ifitem_index (((etReplSubPort*)ifitem)->index) @@ -274,7 +272,7 @@ class ActorClassGen extends GenericActorClassGenerator { #define «ep.name»_«msg.name»(idx«data2») «ep.portClassName»_«msg.name»(&self->constData->«ep.name», idx«data2») «ENDFOR» «ENDFOR» - + /* services */ «FOR svc : ac.allServiceImplementations» «FOR msg : svc.spp.outgoing» @@ -284,18 +282,18 @@ class ActorClassGen extends GenericActorClassGenerator { #define «svc.spp.name»_«msg.name»(idx«data2») «svc.spp.portClassName»_«msg.name»(&self->constData->«svc.spp.name», idx«data2») «ENDFOR» «ENDFOR» - + /* operations */ «FOR op : ac.latestOperations» «val args = op.argList» #define «op.name»(«args») «ac.name»_«op.name»(self«IF !op.arguments.empty», «args»«ENDIF») «ENDFOR» - + /* attributes */ «FOR a : ac.allAttributes» #define «a.name» (self->«a.name») «ENDFOR» - + /* port operations */ «FOR p : portsWithOperations» «FOR op : p.portClass.operations» @@ -303,33 +301,33 @@ class ActorClassGen extends GenericActorClassGenerator { #define «p.name»_«op.name»(«args») «p.portClassName»_«op.name»((«p.portClassName»*)&self->constData->«p.name»«IF !op.arguments.empty», «args»«ENDIF») «ENDFOR» «ENDFOR» - + «generateIncludeGuardEnd(filename)» - + ''' } - + private def argList(Operation op) { '''«FOR a : op.arguments SEPARATOR ", "»«a.name»«ENDFOR»''' } - + def private generateSourceFile(Root root, ExpandedActorClass xpac) { val ac = xpac.actorClass val async = ac.commType==ComponentCommunicationType::ASYNCHRONOUS val eventDriven = ac.commType==ComponentCommunicationType::EVENT_DRIVEN val dataDriven = ac.commType==ComponentCommunicationType::DATA_DRIVEN val handleEvents = async || eventDriven - + ''' /** * @author generated by eTrice * * Source File of ActorClass «ac.name» - * + * */ #include "«ac.getCHeaderFileName»" - + #include "modelbase/etActor.h" #include "debugging/etLogger.h" #include "debugging/etMSCLogger.h" @@ -339,9 +337,9 @@ class ActorClassGen extends GenericActorClassGenerator { «FOR pc : root.getReferencedProtocolClasses(ac)» #include «pc.includePath» «ENDFOR» - + #include "«ac.getCUtilsFileName»" - + «ac.userCode(3, true)» /* interface item IDs */ @@ -350,7 +348,7 @@ class ActorClassGen extends GenericActorClassGenerator { «IF !xpac.stateMachine.empty» «xpac.genStateMachine()» «ENDIF» - + void «ac.name»_init(«ac.name»* self){ ET_MSC_LOGGER_SYNC_ENTRY("«ac.name»", "init") «IF !xpac.stateMachine.empty» @@ -358,8 +356,8 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDIF» ET_MSC_LOGGER_SYNC_EXIT } - - + + void «ac.name»_receiveMessage(void* self, const void* ifitem, const etMessage* msg){ ET_MSC_LOGGER_SYNC_ENTRY("«ac.name»", "_receiveMessage") «IF !xpac.stateMachine.empty» @@ -369,47 +367,30 @@ class ActorClassGen extends GenericActorClassGenerator { «langExt.operationScope(ac.name, false)»receiveEventInternal(self); «ENDIF» «ENDIF» - + ET_MSC_LOGGER_SYNC_EXIT } - + «IF dataDriven || async» void «ac.name»_execute(«ac.name»* self) { ET_MSC_LOGGER_SYNC_ENTRY("«ac.name»", "_execute") «IF !xpac.stateMachine.empty» - + «IF handleEvents» «langExt.operationScope(ac.name, false)»receiveEvent(self, NULL, 0, NULL); «ELSE» «langExt.operationScope(ac.name, false)»receiveEventInternal(self); «ENDIF» «ENDIF» - + ET_MSC_LOGGER_SYNC_EXIT } «ENDIF» - - «classStructors(ac)» - + + «ac.userStructorsImplementation» + «operationsImplementation(ac.latestOperations, ac.name)» - - ''' - } - - def protected classStructors(ActorClass ac){ - val ctors = ac.allStructors.filter[isConstructor] - val dtors = ac.allStructors.filter[!isConstructor] - ''' - «IF !ctors.isEmpty» - «getConstructorSignature(ac.name)»{ - «ctors.map[translator.getTranslatedCode(detailCode).asBlock].join» - } - «ENDIF» - «IF !dtors.isEmpty» - «getDestructorSignature(ac.name)»{ - «dtors.map[translator.getTranslatedCode(detailCode).asBlock].join» - } - «ENDIF» + ''' } } diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend index fcb2d9da7..6ecaca306 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend @@ -4,11 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) * Thomas Schuetz (changed for C code generator) - * + * *******************************************************************************/ /* @@ -61,7 +61,7 @@ class CExtensions implements ILanguageExtension { override String accessLevelPrivate(){"static "} override String accessLevelProtected(){"static "} override String accessLevelPublic(){""} - + override String memberAccess(){"self->"} override String selfPointer(String classname, boolean hasArgs){ classname+ @@ -70,7 +70,7 @@ class CExtensions implements ILanguageExtension { else "* self" } - + override String selfPointer(boolean hasArgs) { if (hasArgs) "self, " else "self" } override String operationScope(String classname, boolean isDeclaration){classname+"_"} @@ -78,14 +78,14 @@ class CExtensions implements ILanguageExtension { override String memberInDeclaration(String namespace, String member) { return namespace+"_"+member } - + override String memberInUse(String namespace, String member) { return namespace+"_"+member } //**** C-Specific - /* TODO: move specific code elsewhere */ + /* TODO: move specific code elsewhere */ // used def String getCHeaderFileName(RoomClass rc) { return rc.name+".h"; @@ -108,7 +108,7 @@ class CExtensions implements ILanguageExtension { def String getDispSourceFileName(RoomClass rc) { return rc.name+"_Disp.h"; } - + // used def String getCHeaderFileName(NodeRef nr, SubSystemInstance ssi) { return nr.name+"_"+ssi.name+".h"; @@ -152,19 +152,19 @@ class CExtensions implements ILanguageExtension { #endif /* «filename.getIncludeGuardString» */ ''' } - + override boolean usesInheritance() { return false } - + override boolean usesPointers() { return true } - + override String genEnumeration(String name, List<Pair<String, String>> entries) { if (entries.empty) return "/* empty enum not generated */" - + ''' enum «name» { «FOR entry: entries SEPARATOR ","» @@ -177,32 +177,16 @@ class CExtensions implements ILanguageExtension { override String booleanConstant(boolean b) { if (b) "ET_TRUE" else "ET_FALSE" } - + override String pointerLiteral() { "*" } override String nullPointer() { "NULL" } override String voidPointer() { "void*" } - - override String arrayDeclaration(String type, int size, String name, boolean isRef) { - if (isRef){ - type+"* "+name+"["+size+"]"; - }else { - type+" "+name+"["+size+"]"; - } - } - - override String constructorName(String cls) { - "ctor" - } - override String destructorName(String cls) { - "dtor" - } - override String constructorReturnType() { - "void" - } - override String destructorReturnType() { - "void" - } - + override String typeArrayModifier() { pointerLiteral } + + override String arrayDeclaration(String type, int size, String name, boolean isRef)''' + «type»«IF isRef»*«ENDIF» «name»[«size»] + ''' + override String superCall(String baseClassName, String method, String args) { "" } @@ -220,10 +204,10 @@ class CExtensions implements ILanguageExtension { case "boolean": if (value.equals("true")) "ET_TRUE" else "ET_FALSE" default: - value + value } } - + override toEnumLiteral(EnumerationType type, String value) { if(value.contains(',') || value.contains('{')){ var singleValues = value.replace('{', '').replace('}', '').trim.split(',') @@ -231,7 +215,7 @@ class CExtensions implements ILanguageExtension { } else convertStringEnumLiteral(type, value) } - + def private convertStringEnumLiteral(EnumerationType type, String value){ var v = value if (v.startsWith(type.name)) @@ -253,7 +237,7 @@ class CExtensions implements ILanguageExtension { diagnostician.error("external type "+dt.name + "has no default initialization", dt.eContainer, dt.eContainingFeature) "" } - DataClass: + DataClass: ''' { «FOR att : dt.allAttributes SEPARATOR ","» @@ -263,14 +247,14 @@ class CExtensions implements ILanguageExtension { ''' } } - + def String getDefaultValue(EnumerationType type) { if (type.getLiterals().isEmpty()) "" else getCastedValue(type.getLiterals().get(0)) } - + override initializationWithDefaultValues(DataType dt, int size) { val dv = dt.defaultValue dv.initializer(size) @@ -291,7 +275,7 @@ class CExtensions implements ILanguageExtension { else dv } - + def initializationWithDefaultValues(Attribute att) { val dv = att.defaultValueLiteral if (dv!=null) { @@ -306,15 +290,15 @@ class CExtensions implements ILanguageExtension { else att.type.type.initializationWithDefaultValues(att.size) } - + override generateArglistAndTypedData(EObject d) { if (d==null || !(d instanceof VarDecl)) return newArrayList("", "", "") - + val data = d as VarDecl if (data==null) return newArrayList("", "", "") - + var typeName = if (data.getRefType().getType() instanceof PrimitiveType) (data.getRefType().getType() as PrimitiveType).targetName else if (data.getRefType().getType() instanceof EnumerationType) @@ -323,7 +307,7 @@ class CExtensions implements ILanguageExtension { (data.getRefType().getType() as ExternalType).targetName else data.getRefType().getType().getName() - + var castTypeName = if (data.getRefType().getType() instanceof PrimitiveType) { val ct = (data.getRefType().getType() as PrimitiveType).getCastName() if (ct!=null && !ct.isEmpty()) @@ -338,7 +322,7 @@ class CExtensions implements ILanguageExtension { typeName castTypeName = castTypeName+"*" var deRef = "*" - + val isRef = data.getRefType().isRef() val isPrim = (data.getRefType().getType() instanceof PrimitiveType || data.getRefType().getType() instanceof EnumerationType) if (isRef) { @@ -351,41 +335,41 @@ class CExtensions implements ILanguageExtension { deRef = "" } } - + val typedData = typeName+" "+data.getName() + " = "+deRef+"(("+castTypeName+") generic_data__et);\n" val dataArg = ", "+data.getName() val typedArgList = ", "+typeName+" "+data.getName() - + return newArrayList(dataArg, typedData, typedArgList); } - + def getIncludePath(RoomClass rc) { "\""+(rc.eContainer as RoomModel).name.replaceAll("\\.","/")+"/"+rc.getCHeaderFileName+"\"" } - + override getTargetType(EnumerationType type) { if (type.getPrimitiveType()!=null) type.getPrimitiveType().getTargetName() else type.getName() } - + override getCastedValue(EnumLiteral literal) { val type = literal.eContainer() as EnumerationType val cast = type.targetType - + if (type.primitiveType==null) Long.toString(literal.getLiteralValue()) else "(("+cast+")"+Long.toString(literal.getLiteralValue())+")" } - + override getCastType(EnumerationType type) { if (type.getPrimitiveType()!=null) type.getPrimitiveType().getCastName() else type.getName() } - + } diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend index 34c27b984..1e849d8c2 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend @@ -4,11 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) * Thomas Schuetz (changed for C code generator) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.c.gen @@ -50,19 +50,19 @@ import org.eclipse.etrice.generator.generic.TypeHelpers @Singleton class NodeGen { - + @Inject extension RoomHelpers @Inject extension CExtensions @Inject extension RoomExtensions @Inject extension TypeHelpers @Inject extension ProcedureHelpers helpers - + @Inject IGeneratorFileIo fileIO @Inject Initialization attrInitGenAddon @Inject ILanguageExtension languageExt @Inject IDiagnostician diagnostician @Inject ILogger logger; - + def doGenerate(Root root) { for (nr : ETMapUtil::getNodeRefs()) { for (instpath : ETMapUtil::getSubSystemInstancePaths(nr)) { @@ -71,19 +71,19 @@ class NodeGen { val filepath = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath val infopath = ssi.subSystemClass.generationInfoPath+ssi.subSystemClass.getPath var file = nr.getCHeaderFileName(ssi) - + checkDataPorts(ssi) - + val usedThreads = ETMapUtil::getUsedThreads(nr, ssi) - + fileIO.generateFile("generating Node declaration", filepath, infopath, file, root.generateHeaderFile(ssi)) - + file = nr.getCSourceFileName(ssi) fileIO.generateFile("generating Node implementation", filepath, infopath, file, root.generateSourceFile(ssi, usedThreads)) - + file = nr.getInstSourceFileName(ssi) fileIO.generateFile("generating Node instance file", filepath, infopath, file, root.generateInstanceFile(ssi, usedThreads)) - + file = nr.getDispSourceFileName(ssi) fileIO.generateFile("generating Node dispatcher file", filepath, infopath, file, root.generateDispatcherFile(ssi, usedThreads)) } @@ -100,40 +100,40 @@ class NodeGen { * @author generated by eTrice * * Header File of Node «nr.name» with SubSystem «ssi.name» - * + * */ - + «generateIncludeGuardBegin(clsname)» - + #include "etDatatypes.h" ««« TODOCGENPHYS: user code? «helpers.userCode(ssc.userCode1)» - - + + /* lifecycle functions * init -> start -> run (loop) -> stop -> destroy */ - + void «clsname»_init(void); /* lifecycle init */ void «clsname»_start(void); /* lifecycle start */ - + void «clsname»_run(etBool runAsTest); /* lifecycle run */ - + void «clsname»_stop(void); /* lifecycle stop */ void «clsname»_destroy(void); /* lifecycle destroy */ - + void «clsname»_shutdown(void); /* shutdown the dispatcher loop */ - + ««« TODOCGENPHYS: user code? «helpers.userCode(ssc.userCode2)» - + «generateIncludeGuardEnd(clsname)» - - + + ''' } - + def private generateSourceFile(Root root, SubSystemInstance ssi, Collection<PhysicalThread> usedThreads) { val nr = ETMapUtil::getNodeRef(ssi) val ssc = ssi.subSystemClass @@ -145,13 +145,13 @@ class NodeGen { * @author generated by eTrice * * Source File of Node «nr.name» with SubSystem «ssi.name» - * + * */ - + #include <stdio.h> #include <string.h> - - + + #include "«nr.getCHeaderFileName(ssi)»" #include "debugging/etLogger.h" @@ -165,18 +165,18 @@ class NodeGen { ««« TODOCGENPHYS: user code? «helpers.userCode(ssc.userCode3)» - + /* data for Node «nr.name» with SubSystem «ssi.name» */ typedef struct «clsname» { char *name; volatile int shutdownRequest; } «clsname»; - + static «clsname» «clsname»Inst = {"«clsname»", 0}; - + static void «clsname»_initActorInstances(void); static void «clsname»_constructActorInstances(void); - + /* include instances for all classes */ #include "«nr.getInstSourceFileName(ssi)»" #include "«nr.getDispSourceFileName(ssi)»" @@ -185,7 +185,7 @@ class NodeGen { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "initMessageServices") { etTime interval; - + /* initialization of all message services */ «FOR thread: threads» «IF thread.execmode==ExecMode::POLLED || thread.execmode==ExecMode::MIXED» @@ -202,56 +202,56 @@ class NodeGen { interval, MsgDispatcher_«thread.name»_receiveMessage, EXECMODE_«thread.execmode.toString.toUpperCase»); - + «ENDFOR» } - + ET_MSC_LOGGER_SYNC_EXIT } static void «clsname»_startMessageServices(void) { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "startMessageServices") - + «FOR thread: threads.sortBy[getPrio].reverse» etMessageService_start(&msgService_«thread.name»); «ENDFOR» - + ET_MSC_LOGGER_SYNC_EXIT } static void «clsname»_stopMessageServices(void) { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "stopMessageServices") - + «FOR thread: threads» etMessageService_stop(&msgService_«thread.name»); «ENDFOR» - + ET_MSC_LOGGER_SYNC_EXIT } static void «clsname»_destroyMessageServices(void) { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "destroyMessageServices") - + «FOR thread: threads» etMessageService_destroy(&msgService_«thread.name»); «ENDFOR» - + ET_MSC_LOGGER_SYNC_EXIT } - + void «clsname»_init(void) { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "init") etLogger_logInfoF("%s_init", «clsname»Inst.name); - + /* construct all actors */ «clsname»_constructActorInstances(); - + /* initialization of all message services */ «clsname»_initMessageServices(); - + /* init all actors */ «clsname»_initActorInstances(); - + «IF logData» «FOR thread: threads» MsgDispatcher_«thread.name»_logDataHeaders(); @@ -260,21 +260,21 @@ class NodeGen { MsgDispatcher_«thread.name»_logData(); «ENDFOR» «ENDIF» - + ET_MSC_LOGGER_SYNC_EXIT } - + void «clsname»_start(void) { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "start") etLogger_logInfoF("%s_start", «clsname»Inst.name); «clsname»_startMessageServices(); ET_MSC_LOGGER_SYNC_EXIT } - + void «clsname»_run(etBool runAsTest) { - #ifdef ET_RUNNER_ACTIVATE + #ifdef ET_RUNNER_ACTIVATE ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "run") - + if (runAsTest) { etSema_waitForWakeup(etRuntime_getTerminateSemaphore()); } @@ -283,70 +283,67 @@ class NodeGen { fflush(stdout); while (ET_TRUE) { char line[64]; - + if (fgets(line, 64, stdin) != NULL) { if (strncmp(line, "quit", 4)==0) break; } } } - + ET_MSC_LOGGER_SYNC_EXIT - #endif + #endif } - + void «clsname»_stop(void){ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "stop") etLogger_logInfoF("%s_stop", «clsname»Inst.name); - + «clsname»_stopMessageServices(); - + ET_MSC_LOGGER_SYNC_EXIT } - + void «clsname»_destroy(void){ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "destroy") etLogger_logInfoF("%s_destroy", «clsname»Inst.name); - «FOR ai : ssi.allContainedInstances.reverseView» - «IF ai.actorClass.allStructors.exists[!isConstructor]» - «languageExt.memberInUse(ai.actorClass.name, languageExt.destructorName(ai.actorClass.name))»(&«ai.path.getPathName()»); - «ENDIF» + + «FOR ai : ssi.allContainedInstances» + «invokeUserStructor(ai.actorClass, '&'+ai.path.getPathName(), false)» «ENDFOR» - + «clsname»_destroyMessageServices(); - + ET_MSC_LOGGER_SYNC_EXIT } void «clsname»_shutdown(void){ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "shutdown") etLogger_logInfoF("%s_shutdown", «clsname»Inst.name); - + «clsname»Inst.shutdownRequest = 1; - + ET_MSC_LOGGER_SYNC_EXIT } static void «clsname»_constructActorInstances(void){ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "constructActorInstances") - + «FOR ai : ssi.allContainedInstances» - «IF ai.actorClass.allStructors.exists[isConstructor]» - «languageExt.memberInUse(ai.actorClass.name, languageExt.constructorName(ai.actorClass.name))»(&«ai.path.getPathName()»); - «ENDIF» + «invokeUserStructor(ai.actorClass, '&'+ai.path.getPathName(), true)» «ENDFOR» - + ET_MSC_LOGGER_SYNC_EXIT } static void «clsname»_initActorInstances(void){ ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "initActorInstances") - + «FOR ai : ssi.allContainedInstances» «ai.actorClass.name»_init(&«ai.path.getPathName()»); «ENDFOR» - + ET_MSC_LOGGER_SYNC_EXIT } ''' @@ -374,23 +371,23 @@ class NodeGen { «FOR protocolClass : root.getReferencedProtocolClasses(ssi.subSystemClass)» #include «protocolClass.includePath» «ENDFOR» - + /* instantiation of message services and message buffers */ «FOR thread: nr.type.threads.filter(t|usedThreads.contains(t))» /* «thread.name» */ #define «thread.name.toUpperCase»_POOL_SIZE «thread.msgpoolsize» #define «thread.name.toUpperCase»_BLOCK_SIZE «thread.msgblocksize» - static uint8 msgBuffer_«thread.name»[«thread.name.toUpperCase»_POOL_SIZE * «thread.name.toUpperCase»_BLOCK_SIZE]; + static uint8 msgBuffer_«thread.name»[«thread.name.toUpperCase»_POOL_SIZE * «thread.name.toUpperCase»_BLOCK_SIZE]; static etMessageService msgService_«thread.name»; «ENDFOR» - + /* declarations of all ActorClass instances (const and variable structs) */ /* forward declaration of variable actor structs */ «FOR ai : ssi.allContainedInstances» static «ai.actorClass.name» «ai.path.getPathName()»; «ENDFOR» - + /* forward declaration of variable port structs */ «FOR ai: ssi.allContainedInstances» «IF ai.orderedIfItemInstances.empty» @@ -402,13 +399,13 @@ class NodeGen { «FOR Integer i:1.. if(pi.peers.size==0)1 else pi.peers.size SEPARATOR ', '» «attrInitGenAddon.generateAttributeInit(pi, pi.interfaceItem.portClass.attributes)» «ENDFOR»}; - «ENDIF» + «ENDIF» «ENDFOR» - «ENDIF» + «ENDIF» «ENDFOR» - + «FOR ai : ssi.allContainedInstances» - + /* instance «ai.path.getPathName()» */ «IF !Main::settings.generateMSCInstrumentation && ai.orderedIfItemInstances.empty» /* no ports/saps/services - nothing to initialize statically */ @@ -416,47 +413,47 @@ class NodeGen { «genActorInstanceInitializer(root, ai)» «ENDIF» «ENDFOR» - + ''' } - + def private genActorInstanceInitializer(Root root, ActorInstance ai) { val instName = ai.path.pathName - + // list of replicated interface items (all are event driven ports) val replEventItems = new ArrayList<InterfaceItemInstance>() replEventItems.addAll(ai.orderedIfItemInstances.filter(e|e.replicated)) val haveReplSubItems = replEventItems.findFirst(e|!e.peers.empty)!=null val replEventPorts = replEventItems.filter(i|i.interfaceItem instanceof Port) val replEventSPPs = replEventItems.filter(i|i.interfaceItem instanceof SPP) - + val simplePorts = ai.orderedIfItemInstances.filter(e|e.simple) - + // list of simple event interface items val simpleEventItems = new ArrayList<InterfaceItemInstance>() simpleEventItems.addAll(simplePorts.filter(p|p.protocol.commType==CommunicationType::EVENT_DRIVEN)) - + // lists of event driven ports and saps val simpleEventPorts = simpleEventItems.filter(i|i.interfaceItem instanceof Port) val simpleEventSAPs = simpleEventItems.filter(i|i.interfaceItem instanceof SAP) - + val dataPorts = simplePorts.filter(p|p.protocol.commType==CommunicationType::DATA_DRIVEN) val recvPorts = dataPorts.filter(p|p instanceof PortInstance && !(p as PortInstance).port.conjugated) val sendPorts = dataPorts.filter(p|p instanceof PortInstance && (p as PortInstance).port.conjugated) - - // compute replicated port offsets + + // compute replicated port offsets val offsets = new HashMap<InterfaceItemInstance, Integer>() var offset = 0 for (p: replEventItems) { offsets.put(p, offset) offset = offset + p.peers.size } - + var replSubPortsArray = if (haveReplSubItems) instName+"_repl_sub_ports" else "NULL" val haveConstData = !simpleEventItems.empty || !recvPorts.empty || !replEventItems.empty || Main::settings.generateMSCInstrumentation val sep = new IntelligentSeparator(","); - + val const = if (Main::settings.generateMSCInstrumentation) "/*const*/" else "const" ''' «IF Main::settings.generateMSCInstrumentation» @@ -474,29 +471,29 @@ class NodeGen { static «const» «ai.actorClass.name»_const «instName»_const = { «IF Main::settings.generateMSCInstrumentation» «sep»"«ai.path»" - + «ENDIF» /* Ports: {varData, msgService, peerAddress, localId} */ /* simple ports */ «FOR pi : simpleEventPorts» «sep»«genPortInitializer(root, ai, pi)» «ENDFOR» - + /* data receive ports */ «FOR pi : recvPorts» «sep»«genRecvPortInitializer(root, ai, pi)» «ENDFOR» - + /* saps */ «FOR pi : simpleEventSAPs» «sep»«genPortInitializer(root, ai, pi)» «ENDFOR» - + /* replicated ports */ «FOR pi : replEventPorts» «sep»{«pi.peers.size», «replSubPortsArray»+«offsets.get(pi)»} «ENDFOR» - + /* services */ «FOR pi : replEventSPPs» «sep»{«pi.peers.size», «replSubPortsArray»+«offsets.get(pi)»} @@ -506,20 +503,20 @@ class NodeGen { static «ai.actorClass.name» «instName» = { «IF haveConstData» &«instName»_const, - - «ENDIF» + + «ENDIF» /* data send ports */ «FOR pi : sendPorts» «pi.genSendPortInitializer», «ENDFOR» - + /* attributes */ «attrInitGenAddon.generateAttributeInit(ai, ai.actorClass.allAttributes)» - + /* state and history are initialized in init function */ }; '''} - + private def genPeerPortArrays(Root root, ActorInstance ai) { val simplePorts = ai.orderedIfItemInstances.filter(e|e.simple && e instanceof PortInstance).map(inst|inst as PortInstance) val sendPorts = simplePorts.filter(p|p.port.conjugated && p.protocol.commType==CommunicationType::DATA_DRIVEN) @@ -539,7 +536,7 @@ class NodeGen { «ENDIF» ''' } - + def private String genPortInitializer(Root root, ActorInstance ai, InterfaceItemInstance pi) { val objId = if (pi.peers.empty) 0 else pi.peers.get(0).objId val idx = if (pi.peers.empty) 0 else pi.peers.get(0).peers.indexOf(pi) @@ -551,8 +548,8 @@ class NodeGen { peerInst = if (!pi.peers.empty) "\""+(pi.peers.get(0).eContainer as ActorInstance).path+"\"\n#endif\n" else "\n#endif\n" } - - "{"+getInterfaceItemInstanceData(pi)+", " + + "{"+getInterfaceItemInstanceData(pi)+", " +msgSvc+", " +(objId+idx)+"+BASE_ADDRESS, " +(root.getExpandedActorClass(ai).getInterfaceItemLocalId(pi.interfaceItem)+1) @@ -560,7 +557,7 @@ class NodeGen { +peerInst +"} /* Port "+pi.name+" */" } - + def private genSendPortInitializer(InterfaceItemInstance pi) { val pc = (pi as PortInstance).port.protocol as ProtocolClass var messages = pc.allIncomingMessages.filter(m|m.data!=null) @@ -568,7 +565,7 @@ class NodeGen { val boolMsgs = messages.filter(m|m.data.refType.type.isBoolean) val usesMSC = Main::settings.generateMSCInstrumentation && !(enumMsgs.empty && boolMsgs.empty) val instName = (pi.eContainer as ActorInstance).path - + ''' { «FOR m : pc.incomingMessages SEPARATOR ","» @@ -583,7 +580,7 @@ class NodeGen { } /* send port «pi.name» */ ''' } - + def private getInterfaceItemInstanceData(InterfaceItemInstance pi){ if (pi.protocol.getPortClass(pi.conjugated)== null) return "NULL" if (pi.protocol.getPortClass(pi.conjugated).attributes.empty){ @@ -592,8 +589,8 @@ class NodeGen { return "&"+pi.path.pathName+"_var" } } - - + + def private String genRecvPortInitializer(Root root, ActorInstance ai, InterfaceItemInstance pi) { var sentMsgs = pi.interfaceItem.incoming.filter(m|m.data!=null) val enumMsgs = sentMsgs.filter(m|m.data.refType.type.isEnumeration) @@ -610,22 +607,22 @@ class NodeGen { } enumVal = "\n#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE"+enumVal+"\n#endif\n" } - + if (pi.peers.empty) return "{NULL"+enumVal+"}" var peer = pi.peers.get(0) var peerInst = pi.peers.get(0).eContainer() as ActorInstance var instName = peerInst.path.pathName - + "{&"+instName+"."+peer.name+enumVal+"}" } - + def private String genReplSubPortInitializers(Root root, ActorInstance ai, InterfaceItemInstance pi) { var result = "" val myInst = if (Main::settings.generateMSCInstrumentation) "\n#ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE\n,\""+(pi.eContainer as ActorInstance).path+"\"\n" else "" - + for (p: pi.peers) { val idx = pi.peers.indexOf(p) val comma = if (idx<pi.peers.size-1) "," else "" @@ -635,7 +632,7 @@ class NodeGen { else "" iiiD = if (iiiD.equals("NULL")) iiiD+"," else iiiD+"["+idx+"]," result = result + - "{{"+iiiD + "{{"+iiiD +"&msgService_"+thread+", " +p.objId+"+BASE_ADDRESS, " +(root.getExpandedActorClass(ai).getInterfaceItemLocalId(pi.interfaceItem)+1) @@ -645,15 +642,15 @@ class NodeGen { +idx +"}"+comma+" /* Repl Sub Port "+pi.name+" idx +"+idx+"*/\n" } - + return result } - + def private generateDispatcherFile(Root root, SubSystemInstance ssi, Collection<PhysicalThread> usedThreads) { val nr = ETMapUtil::getNodeRef(ssi) val logData = Main::settings.generateDataInstrumentation && ssi.subSystemClass.annotations.isAnnotationPresent("DataLogging") val loggedPorts = if(logData) ssi.loggedPorts else newArrayList - + ''' /** * @author generated by eTrice @@ -661,16 +658,16 @@ class NodeGen { * Dispatcher File of Node «nr.name» with SubSystem «ssi.name» * contains a generated message dispatcher (receiveMessage) for each MessageService (Thread) */ - + #include "messaging/etMessageReceiver.h" #include "debugging/etLogger.h" #include "debugging/etMSCLogger.h" - + «FOR thread: nr.type.threads.filter(t|usedThreads.contains(t)) SEPARATOR "\n"» «val instancesOnThread = ssi.allContainedInstances.filter(ai|ETMapUtil::getMappedThread(ai).thread==thread)» «val dispatchedInstances = instancesOnThread.filter(ai|ai.actorClass.commType == ComponentCommunicationType::EVENT_DRIVEN || ai.actorClass.commType == ComponentCommunicationType::ASYNCHRONOUS)» «val executedInstances = instancesOnThread.filter(ai|ai.actorClass.commType == ComponentCommunicationType::DATA_DRIVEN || ai.actorClass.commType == ComponentCommunicationType::ASYNCHRONOUS)» - + «IF executedInstances.size > 0» /** * generated execute function for all cyclic execute calls for the async or datadriven actor instances of thread "«thread.name»" @@ -696,14 +693,14 @@ class NodeGen { } «ENDIF» «ENDIF» - + /** * generated dispatch function for all messages for the thread "«thread.name»" */ static etBool MsgDispatcher_«thread.name»_receiveMessage(const etMessage* msg){ ET_MSC_LOGGER_SYNC_ENTRY("MsgDispatcher_«thread.name»", "receiveMessage") switch(msg->address){ - + case MESSAGESERVICE_ADDRESS: «IF !executedInstances.empty» if (msg->evtID == etSystemProtocol_IN_poll) { @@ -718,7 +715,7 @@ class NodeGen { return ET_FALSE; break; «FOR ai : dispatchedInstances» - + /* interface items of «ai.path» */ «FOR pi : ai. orderedIfItemInstances.filter(p|p.protocol.commType==CommunicationType::EVENT_DRIVEN)» «IF pi.replicated» @@ -733,7 +730,7 @@ class NodeGen { «ENDFOR» default: «ai.actorClass.name»_receiveMessage((void*)&«ai.path.pathName»,(etPort*)&«ai.path.pathName»_const.«pi.name».ports[«pi.peers.indexOf(peer)»], msg); break; - } + } «ELSE» «IF Main::settings.generateMSCInstrumentation» ET_MSC_LOGGER_ASYNC_IN( @@ -748,7 +745,7 @@ class NodeGen { «ENDFOR» «ELSE» case «pi.objId»+BASE_ADDRESS: - «IF (pi.protocol.handlesReceive(pi.isConjugated()))» + «IF (pi.protocol.handlesReceive(pi.isConjugated()))» switch (msg->evtID){ «FOR h:getReceiveHandlers(pi.protocol,pi.isConjugated())» case «pi.protocol.name»_«h.msg.codeName»: @@ -772,7 +769,7 @@ class NodeGen { «ENDIF» «ENDFOR» «ENDFOR» - + default: etLogger_logErrorF("MessageService_«thread.name»_receiveMessage: address %d does not exist ", msg->address); break; @@ -783,14 +780,14 @@ class NodeGen { «ENDFOR» ''' } - + def private createLoggerCall(PortInstance pi) { val msg = pi.protocol.incomingMessages.filter(m|m.data!=null && m.data.refType.type.enumerationOrPrimitive).get(0) val ai = pi.eContainer as ActorInstance val data = ai.path.pathName+"."+pi.name+"."+msg.name val type = if (msg.data.refType.type instanceof EnumerationType) LiteralType.INT else (msg.data.refType.type as PrimitiveType).type - + switch (type) { case LiteralType.BOOL: "ET_DATA_LOGGER_LOG_BOOL((int)"+data+")" case LiteralType.CHAR: "ET_DATA_LOGGER_LOG_INT((int)"+data+")" @@ -799,21 +796,21 @@ class NodeGen { default: "internal error: unknown primitive type" } } - + def private loggedPorts(SubSystemInstance ssi) { val ArrayList<PortInstance> result = newArrayList - + if (ssi.subSystemClass.annotations.isAnnotationPresent("DataLogging")) { logger.logInfo("Data Logging is configured by annotation"); - + val filters = ssi.subSystemClass.annotations.getAttribute("DataLogging", "pathlist") val filterList = filters.split(",") for (filter: filterList) { logger.logInfo(" filter: "+filter); } - + val ArrayList<String> notLogged = newArrayList - + logger.logInfo(" logged ports:"); var iter = ssi.eAllContents while (iter.hasNext) { @@ -854,16 +851,16 @@ class NodeGen { } } } - + logger.logInfo(" NOT logged ports:"); for (nl: notLogged) { logger.logInfo(nl); } } - + return result } - + def private checkDataPorts(SubSystemInstance comp) { val found = new HashSet<String>() for (ai: comp.allContainedInstances) { @@ -888,5 +885,5 @@ class NodeGen { } } } - } + } } diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend index d2787cffd..4d1fcc834 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.c.gen @@ -22,9 +22,9 @@ import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent @Singleton class StateMachineGen extends GenericStateMachineGenerator { - + @Inject extension RoomExtensions - + def genHeaderConstants(ExpandedActorClass xpac) { val ac = xpac.actorClass /* TODO: can save one entry if NO_STATE=-1 but influences Java */ @@ -34,7 +34,7 @@ class StateMachineGen extends GenericStateMachineGenerator { #define «ac.name.toUpperCase»_HISTORY_SIZE «historySize» ''' } - + def genDataMembers(ExpandedActorClass xpac) { val ac = xpac.actorClass ''' @@ -43,7 +43,7 @@ class StateMachineGen extends GenericStateMachineGenerator { etInt16 history[«ac.name.toUpperCase»_HISTORY_SIZE]; ''' } - + def genInitialization(ExpandedActorClass xpac) { val ac = xpac.actorClass ''' @@ -56,8 +56,11 @@ class StateMachineGen extends GenericStateMachineGenerator { «langExt.operationScope(ac.name, false)»executeInitTransition(self); ''' } - - override public genExtra(ExpandedModelComponent xpmc) { + + /** + * @param generateImplementation NOT used + */ + override public genExtra(ExpandedModelComponent xpmc, boolean generateImplementation) { val mc = xpmc.modelComponent val states = xpmc.stateMachine.baseStateList.getLeafStatesLast ''' @@ -66,28 +69,28 @@ class StateMachineGen extends GenericStateMachineGenerator { static char* stateStrings[] = {"<no state>","<top>",«FOR state : states SEPARATOR ","»"«state.genStatePathName»" «ENDFOR»}; «ENDIF» - + «langExt.accessLevelPrivate»void setState(«mc.componentName»* self, «stateType» new_state) { self->state = new_state; «IF Main::settings.generateMSCInstrumentation» ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state]) «ENDIF» } - + «langExt.accessLevelPrivate»«stateType» getState(«mc.componentName»* self) { return self->state; } ''' } - + override public stateType() { "etInt16" } - + override boolType() { "etBool" } - + override markVariableUsed(String varname) { ''' ((void)trigger__et); /* avoids unused warning */ @@ -96,5 +99,5 @@ class StateMachineGen extends GenericStateMachineGenerator { override public unreachableReturn() { "/* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */" } - + } diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java index f6a9ec701..8bee75795 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.c.setup; @@ -17,9 +17,13 @@ import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule; import org.eclipse.etrice.generator.base.IDataConfiguration; import org.eclipse.etrice.generator.base.ITranslationProvider; import org.eclipse.etrice.generator.c.Main; +import org.eclipse.etrice.generator.c.gen.ActorClassGen; import org.eclipse.etrice.generator.c.gen.CExtensions; import org.eclipse.etrice.generator.c.gen.CTranslationProvider; +import org.eclipse.etrice.generator.c.gen.ProtocolClassGen; import org.eclipse.etrice.generator.config.DataConfiguration; +import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; +import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator; import org.eclipse.etrice.generator.generic.ILanguageExtension; import com.google.inject.Binder; @@ -29,8 +33,10 @@ public class GeneratorModule extends AbstractGeneratorBaseModule { // @Override public void configure(Binder binder) { super.configure(binder); - + binder.bind(AbstractGenerator.class).to(Main.class); + binder.bind(GenericProtocolClassGenerator.class).to(ProtocolClassGen.class); + binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class); } @Override diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java index 8d9e857dc..b5cb0284e 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java @@ -18,14 +18,12 @@ import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; import org.eclipse.etrice.core.fsm.fSM.StateGraph; 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; import org.eclipse.etrice.core.room.ActorClass; import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ClassStructor; import org.eclipse.etrice.core.room.CommunicationType; import org.eclipse.etrice.core.room.DataClass; import org.eclipse.etrice.core.room.EnumerationType; @@ -252,7 +250,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_name, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -324,7 +322,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("const char* instName;"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); } } @@ -350,7 +347,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* data receive ports */"); @@ -392,7 +388,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* replicated ports */"); @@ -414,7 +409,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* services */"); @@ -471,7 +465,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_name_11, "\t"); _builder.append("_const* const constData;"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); } } @@ -496,21 +489,18 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); List<Attribute> _allAttributes_1 = this._roomHelpers.getAllAttributes(ac); CharSequence _attributes = this._procedureHelpers.attributes(_allAttributes_1); _builder.append(_attributes, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { StateGraph _stateMachine_2 = xpac.getStateMachine(); boolean _isEmpty_8 = this._roomHelpers.isEmpty(_stateMachine_2); boolean _not_2 = (!_isEmpty_8); if (_not_2) { - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); CharSequence _genDataMembers = this._stateMachineGen.genDataMembers(xpac); @@ -580,43 +570,13 @@ public class ActorClassGen extends GenericActorClassGenerator { } } _builder.newLine(); - { - List<ClassStructor> _allStructors = this._roomHelpers.getAllStructors(ac); - final Function1<ClassStructor, Boolean> _function_3 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - return Boolean.valueOf(it.isConstructor()); - } - }; - boolean _exists = IterableExtensions.<ClassStructor>exists(_allStructors, _function_3); - if (_exists) { - String _name_19 = ac.getName(); - CharSequence _constructorSignature = this._procedureHelpers.getConstructorSignature(_name_19); - _builder.append(_constructorSignature, ""); - _builder.append(";"); - } - } - _builder.newLineIfNotEmpty(); - { - List<ClassStructor> _allStructors_1 = this._roomHelpers.getAllStructors(ac); - final Function1<ClassStructor, Boolean> _function_4 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((!_isConstructor)); - } - }; - boolean _exists_1 = IterableExtensions.<ClassStructor>exists(_allStructors_1, _function_4); - if (_exists_1) { - String _name_20 = ac.getName(); - CharSequence _destructorSignature = this._procedureHelpers.getDestructorSignature(_name_20); - _builder.append(_destructorSignature, ""); - _builder.append(";"); - } - } + String _userStructorsDeclaration = this._procedureHelpers.userStructorsDeclaration(ac); + _builder.append(_userStructorsDeclaration, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); List<StandardOperation> _latestOperations = this._roomHelpers.getLatestOperations(ac); - String _name_21 = ac.getName(); - CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_latestOperations, _name_21); + String _name_19 = ac.getName(); + CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_latestOperations, _name_19); _builder.append(_operationsDeclaration, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); @@ -745,7 +705,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_name_2, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -1277,7 +1237,7 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_name, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -1404,7 +1364,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -1439,7 +1398,6 @@ public class ActorClassGen extends GenericActorClassGenerator { boolean _isEmpty_3 = this._roomHelpers.isEmpty(_stateMachine_3); boolean _not_3 = (!_isEmpty_3); if (_not_3) { - _builder.append("\t"); _builder.newLine(); { if (handleEvents) { @@ -1460,7 +1418,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -1470,8 +1427,8 @@ public class ActorClassGen extends GenericActorClassGenerator { } } _builder.newLine(); - CharSequence _classStructors = this.classStructors(ac); - _builder.append(_classStructors, ""); + String _userStructorsImplementation = this._procedureHelpers.userStructorsImplementation(ac); + _builder.append(_userStructorsImplementation, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); List<StandardOperation> _latestOperations = this._roomHelpers.getLatestOperations(ac); @@ -1484,78 +1441,4 @@ public class ActorClassGen extends GenericActorClassGenerator { } return _xblockexpression; } - - protected CharSequence classStructors(final ActorClass ac) { - CharSequence _xblockexpression = null; - { - List<ClassStructor> _allStructors = this._roomHelpers.getAllStructors(ac); - final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - return Boolean.valueOf(it.isConstructor()); - } - }; - final Iterable<ClassStructor> ctors = IterableExtensions.<ClassStructor>filter(_allStructors, _function); - List<ClassStructor> _allStructors_1 = this._roomHelpers.getAllStructors(ac); - final Function1<ClassStructor, Boolean> _function_1 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((!_isConstructor)); - } - }; - final Iterable<ClassStructor> dtors = IterableExtensions.<ClassStructor>filter(_allStructors_1, _function_1); - StringConcatenation _builder = new StringConcatenation(); - { - boolean _isEmpty = IterableExtensions.isEmpty(ctors); - boolean _not = (!_isEmpty); - if (_not) { - String _name = ac.getName(); - CharSequence _constructorSignature = this._procedureHelpers.getConstructorSignature(_name); - _builder.append(_constructorSignature, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - final Function1<ClassStructor, CharSequence> _function_2 = new Function1<ClassStructor, CharSequence>() { - public CharSequence apply(final ClassStructor it) { - DetailCode _detailCode = it.getDetailCode(); - String _translatedCode = ActorClassGen.this._stateMachineGen.translator.getTranslatedCode(_detailCode); - return ActorClassGen.this._procedureHelpers.asBlock(_translatedCode); - } - }; - Iterable<CharSequence> _map = IterableExtensions.<ClassStructor, CharSequence>map(ctors, _function_2); - String _join = IterableExtensions.join(_map); - _builder.append(_join, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - { - boolean _isEmpty_1 = IterableExtensions.isEmpty(dtors); - boolean _not_1 = (!_isEmpty_1); - if (_not_1) { - String _name_1 = ac.getName(); - CharSequence _destructorSignature = this._procedureHelpers.getDestructorSignature(_name_1); - _builder.append(_destructorSignature, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - final Function1<ClassStructor, CharSequence> _function_3 = new Function1<ClassStructor, CharSequence>() { - public CharSequence apply(final ClassStructor it) { - DetailCode _detailCode = it.getDetailCode(); - String _translatedCode = ActorClassGen.this._stateMachineGen.translator.getTranslatedCode(_detailCode); - return ActorClassGen.this._procedureHelpers.asBlock(_translatedCode); - } - }; - Iterable<CharSequence> _map_1 = IterableExtensions.<ClassStructor, CharSequence>map(dtors, _function_3); - String _join_1 = IterableExtensions.join(_map_1); - _builder.append(_join_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - _xblockexpression = _builder; - } - return _xblockexpression; - } } diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java index 2c11ecbf9..f4f5b48f4 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/CExtensions.java @@ -298,30 +298,25 @@ public class CExtensions implements ILanguageExtension { return "void*"; } - public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) { - String _xifexpression = null; - if (isRef) { - _xifexpression = (((((type + "* ") + name) + "[") + Integer.valueOf(size)) + "]"); - } else { - _xifexpression = (((((type + " ") + name) + "[") + Integer.valueOf(size)) + "]"); - } - return _xifexpression; - } - - public String constructorName(final String cls) { - return "ctor"; - } - - public String destructorName(final String cls) { - return "dtor"; - } - - public String constructorReturnType() { - return "void"; + public String typeArrayModifier() { + return this.pointerLiteral(); } - public String destructorReturnType() { - return "void"; + public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(type, ""); + { + if (isRef) { + _builder.append("*"); + } + } + _builder.append(" "); + _builder.append(name, ""); + _builder.append("["); + _builder.append(size, ""); + _builder.append("]"); + _builder.newLineIfNotEmpty(); + return _builder.toString(); } public String superCall(final String baseClassName, final String method, final String args) { diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java index 0ba79145c..d9975ff81 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java @@ -46,7 +46,6 @@ import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; import org.eclipse.etrice.core.room.ActorClass; import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ClassStructor; import org.eclipse.etrice.core.room.CommunicationType; import org.eclipse.etrice.core.room.DataType; import org.eclipse.etrice.core.room.EnumerationType; @@ -191,7 +190,7 @@ public class NodeGen { _builder.append(_name_3, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -308,7 +307,7 @@ public class NodeGen { _builder.append(_name_3, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -417,7 +416,6 @@ public class NodeGen { _builder.append("\t\t"); _builder.append("etTime interval;"); _builder.newLine(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("/* initialization of all message services */"); @@ -515,15 +513,12 @@ public class NodeGen { _builder.append(_upperCase_2, "\t\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("\t"); _builder.newLine(); } } _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -540,7 +535,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("\", \"startMessageServices\")"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { final Function1<PhysicalThread, Integer> _function_1 = new Function1<PhysicalThread, Integer>() { @@ -559,7 +553,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -576,7 +569,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("\", \"stopMessageServices\")"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { for(final PhysicalThread thread_2 : threads) { @@ -588,7 +580,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -605,7 +596,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("\", \"destroyMessageServices\")"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { for(final PhysicalThread thread_3 : threads) { @@ -617,7 +607,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -639,7 +628,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("Inst.name);"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* construct all actors */"); @@ -648,7 +636,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("_constructActorInstances();"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* initialization of all message services */"); @@ -657,7 +644,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("_initMessageServices();"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* init all actors */"); @@ -666,7 +652,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("_initActorInstances();"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { if (logData) { @@ -692,7 +677,6 @@ public class NodeGen { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -728,14 +712,13 @@ public class NodeGen { _builder.append(clsname, ""); _builder.append("_run(etBool runAsTest) {"); _builder.newLineIfNotEmpty(); - _builder.append("#ifdef ET_RUNNER_ACTIVATE "); + _builder.append("#ifdef ET_RUNNER_ACTIVATE"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_ENTRY(\""); _builder.append(clsname, "\t"); _builder.append("\", \"run\")"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("if (runAsTest) {"); @@ -780,12 +763,11 @@ public class NodeGen { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); _builder.newLine(); - _builder.append("#endif\t"); + _builder.append("#endif"); _builder.newLine(); _builder.append("}"); _builder.newLine(); @@ -809,7 +791,6 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("_stopMessageServices();"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -831,46 +812,25 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("Inst.name);"); _builder.newLineIfNotEmpty(); + _builder.newLine(); { EList<ActorInstance> _allContainedInstances = ssi.getAllContainedInstances(); - List<ActorInstance> _reverseView = ListExtensions.<ActorInstance>reverseView(_allContainedInstances); - for(final ActorInstance ai : _reverseView) { - { - ActorClass _actorClass = ai.getActorClass(); - List<ClassStructor> _allStructors = this._roomHelpers.getAllStructors(_actorClass); - final Function1<ClassStructor, Boolean> _function_2 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((!_isConstructor)); - } - }; - boolean _exists = IterableExtensions.<ClassStructor>exists(_allStructors, _function_2); - if (_exists) { - _builder.append("\t"); - ActorClass _actorClass_1 = ai.getActorClass(); - String _name_16 = _actorClass_1.getName(); - ActorClass _actorClass_2 = ai.getActorClass(); - String _name_17 = _actorClass_2.getName(); - String _destructorName = this.languageExt.destructorName(_name_17); - String _memberInUse = this.languageExt.memberInUse(_name_16, _destructorName); - _builder.append(_memberInUse, "\t"); - _builder.append("(&"); - String _path = ai.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } + for(final ActorInstance ai : _allContainedInstances) { + _builder.append("\t"); + ActorClass _actorClass = ai.getActorClass(); + String _path = ai.getPath(); + String _pathName = this._roomExtensions.getPathName(_path); + String _plus_1 = ("&" + _pathName); + String _invokeUserStructor = this.helpers.invokeUserStructor(_actorClass, _plus_1, false); + _builder.append(_invokeUserStructor, "\t"); + _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append(clsname, "\t"); _builder.append("_destroyMessageServices();"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -892,13 +852,11 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("Inst.name);"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append(clsname, "\t"); _builder.append("Inst.shutdownRequest = 1;"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -916,40 +874,20 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("\", \"constructActorInstances\")"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { EList<ActorInstance> _allContainedInstances_1 = ssi.getAllContainedInstances(); for(final ActorInstance ai_1 : _allContainedInstances_1) { - { - ActorClass _actorClass_3 = ai_1.getActorClass(); - List<ClassStructor> _allStructors_1 = this._roomHelpers.getAllStructors(_actorClass_3); - final Function1<ClassStructor, Boolean> _function_3 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - return Boolean.valueOf(it.isConstructor()); - } - }; - boolean _exists_1 = IterableExtensions.<ClassStructor>exists(_allStructors_1, _function_3); - if (_exists_1) { - _builder.append("\t"); - ActorClass _actorClass_4 = ai_1.getActorClass(); - String _name_18 = _actorClass_4.getName(); - ActorClass _actorClass_5 = ai_1.getActorClass(); - String _name_19 = _actorClass_5.getName(); - String _constructorName = this.languageExt.constructorName(_name_19); - String _memberInUse_1 = this.languageExt.memberInUse(_name_18, _constructorName); - _builder.append(_memberInUse_1, "\t"); - _builder.append("(&"); - String _path_1 = ai_1.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_1); - _builder.append(_pathName_1, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } + _builder.append("\t"); + ActorClass _actorClass_1 = ai_1.getActorClass(); + String _path_1 = ai_1.getPath(); + String _pathName_1 = this._roomExtensions.getPathName(_path_1); + String _plus_2 = ("&" + _pathName_1); + String _invokeUserStructor_1 = this.helpers.invokeUserStructor(_actorClass_1, _plus_2, true); + _builder.append(_invokeUserStructor_1, "\t"); + _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -966,15 +904,14 @@ public class NodeGen { _builder.append(clsname, "\t"); _builder.append("\", \"initActorInstances\")"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { EList<ActorInstance> _allContainedInstances_2 = ssi.getAllContainedInstances(); for(final ActorInstance ai_2 : _allContainedInstances_2) { _builder.append("\t"); - ActorClass _actorClass_6 = ai_2.getActorClass(); - String _name_20 = _actorClass_6.getName(); - _builder.append(_name_20, "\t"); + ActorClass _actorClass_2 = ai_2.getActorClass(); + String _name_16 = _actorClass_2.getName(); + _builder.append(_name_16, "\t"); _builder.append("_init(&"); String _path_2 = ai_2.getPath(); String _pathName_2 = this._roomExtensions.getPathName(_path_2); @@ -983,7 +920,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("ET_MSC_LOGGER_SYNC_EXIT"); @@ -1099,7 +1035,7 @@ public class NodeGen { String _name_7 = thread.getName(); String _upperCase_3 = _name_7.toUpperCase(); _builder.append(_upperCase_3, ""); - _builder.append("_BLOCK_SIZE]; "); + _builder.append("_BLOCK_SIZE];"); _builder.newLineIfNotEmpty(); _builder.append("static etMessageService msgService_"); String _name_8 = thread.getName(); @@ -1490,7 +1426,6 @@ public class NodeGen { _builder.append(_path_1, "\t"); _builder.append("\""); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); } } @@ -1509,7 +1444,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* data receive ports */"); @@ -1523,7 +1457,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* saps */"); @@ -1537,7 +1470,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* replicated ports */"); @@ -1559,7 +1491,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* services */"); @@ -1600,7 +1531,6 @@ public class NodeGen { _builder.append(instName, "\t"); _builder.append("_const,"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); } } @@ -1616,7 +1546,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* attributes */"); @@ -1627,7 +1556,6 @@ public class NodeGen { CharSequence _generateAttributeInit = this.attrInitGenAddon.generateAttributeInit(ai, _allAttributes); _builder.append(_generateAttributeInit, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("/* state and history are initialized in init function */"); @@ -2380,7 +2308,6 @@ public class NodeGen { _builder.append("\t"); _builder.append("switch(msg->address){"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("case MESSAGESERVICE_ADDRESS:"); @@ -2429,7 +2356,6 @@ public class NodeGen { _builder.newLine(); { for(final ActorInstance ai_1 : dispatchedInstances) { - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("/* interface items of "); @@ -2562,7 +2488,7 @@ public class NodeGen { _builder.append("\t\t"); _builder.append("\t"); _builder.append("\t"); - _builder.append("}\t\t\t\t\t\t\t\t\t\t"); + _builder.append("}"); _builder.newLine(); } else { { @@ -2825,7 +2751,6 @@ public class NodeGen { } } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("default:"); diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java index bb1ee4fef..4facd625d 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java @@ -114,7 +114,10 @@ public class StateMachineGen extends GenericStateMachineGenerator { return _xblockexpression; } - public CharSequence genExtra(final ExpandedModelComponent xpmc) { + /** + * @param generateImplementation NOT used + */ + public CharSequence genExtra(final ExpandedModelComponent xpmc, final boolean generateImplementation) { CharSequence _xblockexpression = null; { final ModelComponent mc = xpmc.getModelComponent(); diff --git a/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF index fdeed9308..83b73742f 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF @@ -1,26 +1,26 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: C++ Generator -Bundle-SymbolicName: org.eclipse.etrice.generator.cpp -Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.5.0", +Bundle-Name: eTrice C++ Generator +Bundle-Vendor: Eclipse eTrice (Incubation) +Bundle-Version: 0.5.0.qualifier +Bundle-SymbolicName: org.eclipse.etrice.generator.cpp;singleton:=true +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="0.5.0", + org.eclipse.etrice.core.etphys;bundle-version="0.5.0", + org.eclipse.etrice.core.etmap;bundle-version="0.5.0", + org.eclipse.etrice.generator.fsm;bundle-version="0.5.0", org.eclipse.etrice.generator;bundle-version="0.5.0", - org.eclipse.etrice.core.config;bundle-version="0.5.0", + org.eclipse.etrice.generator.config;bundle-version="0.5.0", org.eclipse.etrice.generator.doc;bundle-version="0.5.0", - org.eclipse.etrice.generator.fsm;bundle-version="0.5.0", - org.eclipse.etrice.core.genmodel;bundle-version="0.5.0", org.eclipse.core.resources;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.ui;bundle-version="3.7.0", org.eclipse.ui.ide;bundle-version="3.7.0", - org.eclipse.xtext;bundle-version="2.6.0", org.eclipse.xtend.lib;bundle-version="2.6.0", - com.google.guava, - org.eclipse.xtext.xbase.lib;bundle-version="2.6.0", - org.eclipse.etrice.core.etmap, - org.eclipse.etrice.core.etphys, - org.eclipse.etrice.generator.config -Bundle-Version: 0.5.0.qualifier -Bundle-Vendor: Eclipse eTrice (Incubation) + org.eclipse.xtext.generator;bundle-version="2.6.0", + org.eclipse.xtext.util;bundle-version="2.6.0" +Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Export-Package: org.eclipse.etrice.generator.cpp - +Export-Package: org.eclipse.etrice.generator.cpp, + org.eclipse.etrice.generator.cpp.gen, + org.eclipse.etrice.generator.cpp.setup diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java index 64ae7b997..117bd9536 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java @@ -4,33 +4,31 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp; -import java.util.Iterator; - +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.etrice.core.etmap.ETMapStandaloneSetup; import org.eclipse.etrice.core.etmap.util.ETMapUtil; +import org.eclipse.etrice.core.etphys.ETPhysStandaloneSetup; import org.eclipse.etrice.core.genmodel.etricegen.Root; import org.eclipse.etrice.generator.base.AbstractGenerator; +import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.cpp.gen.GeneratorSettings; import org.eclipse.etrice.generator.cpp.gen.MainGen; import org.eclipse.etrice.generator.cpp.gen.Validator; import org.eclipse.etrice.generator.cpp.setup.GeneratorModule; import org.eclipse.etrice.generator.doc.gen.GlobalSettings; -import org.eclipse.xtext.scoping.impl.ImportUriResolver; import com.google.inject.Inject; public class Main extends AbstractGenerator { - public static final String OPTION_ETUNIT = "-etunit"; - /** * print usage message to output/console */ @@ -50,75 +48,78 @@ public class Main extends AbstractGenerator { private MainGen mainGenerator; @Inject - protected org.eclipse.etrice.generator.doc.gen.MainGen mainDocGenerator; - + protected org.eclipse.etrice.generator.doc.gen.MainGen mainDocGenerator; + @Inject private Validator validator; - + @Inject protected IDataConfiguration dataConfig; - - @Inject - protected ImportUriResolver uriResolver; /** * @return the unique {@link GlobalSettings} */ - public static GeneratorSettings getSettings() { - return (GeneratorSettings) getInstance().getGeneratorSettings(); + public static GlobalGeneratorSettings getSettings() { + return (GlobalGeneratorSettings) getInstance().getGeneratorSettings(); } - - /* (non-Javadoc) - * @see org.eclipse.etrice.generator.base.AbstractGenerator#parseOption(java.lang.String, java.util.Iterator) + + /** + * setup the eTrice mapping model plug-in */ - @Override - protected boolean parseOption(String arg, Iterator<String> it) { - if (arg.equals(OPTION_ETUNIT)) { - getSettings().setUseEtUnit(true); - return true; + protected void setupMappingModel() { + if (!EMFPlugin.IS_ECLIPSE_RUNNING) { + ETMapStandaloneSetup.doSetup(); } - - return super.parseOption(arg, it); } - + + /** + * setup the eTrice mapping model plug-in + */ + protected void setupPhysicalModel() { + if (!EMFPlugin.IS_ECLIPSE_RUNNING) + ETPhysStandaloneSetup.doSetup(); + } + protected int runGenerator() { setupRoomModel(); dataConfig.doSetup(); - + setupMappingModel(); + setupPhysicalModel(); + try { activateModelLocator(); - + if (!loadModels(getSettings().getInputModelURIs())) { logger.logInfo("loading of models failed"); logger.logError("-- terminating", null); return GENERATOR_ERROR; } - + if (!validateModels()) { logger.logInfo("validation failed"); logger.logError("-- terminating", null); return GENERATOR_ERROR; } - + if (!dataConfig.setResources(getResourceSet(), logger)) { logger.logInfo("configuration errors"); logger.logError("-- terminating", null); return GENERATOR_ERROR; } - + Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath()); if (diagnostician.isFailed() || genModel==null) { logger.logInfo("errors during build of generator model"); logger.logError("-- terminating", null); return GENERATOR_ERROR; } - + if (!validator.validate(genModel)) { logger.logInfo("validation failed during build of generator model"); logger.logError("-- terminating", null); return GENERATOR_ERROR; } - + ETMapUtil.processModels(genModel, getResourceSet(), diagnostician); if (getSettings().isDebugMode()) { logger.logInfo("-- begin dump of mappings"); @@ -130,14 +131,14 @@ public class Main extends AbstractGenerator { logger.logError("-- terminating", null); return GENERATOR_ERROR; } - + logger.logInfo("-- starting code generation"); mainGenerator.doGenerate(genModel.eResource()); - + if (getSettings().isGenerateDocumentation()) { mainDocGenerator.doGenerate(genModel.eResource()); } - + if (diagnostician.isFailed()) { logger.logInfo("errors during code generation"); logger.logError("-- terminating", null); @@ -148,7 +149,7 @@ public class Main extends AbstractGenerator { finally { deactivateModelLocator(); } - + return GENERATOR_OK; } } 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 89823b7fe..e6dec581e 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 @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Peter Karlitschek (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.gen @@ -15,61 +15,65 @@ package org.eclipse.etrice.generator.cpp.gen import com.google.inject.Inject import com.google.inject.Singleton import java.util.ArrayList +import java.util.Map import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType +import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants 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 +import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass import org.eclipse.etrice.core.room.ActorClass import org.eclipse.etrice.generator.cpp.Main +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo import org.eclipse.etrice.generator.generic.GenericActorClassGenerator import org.eclipse.etrice.generator.generic.ProcedureHelpers import org.eclipse.etrice.generator.generic.RoomExtensions -import org.eclipse.xtext.generator.JavaIoFileSystemAccess +import org.eclipse.etrice.generator.generic.TypeHelpers -/** - * @author Peter Karlitschek - * - */ @Singleton class ActorClassGen extends GenericActorClassGenerator { - - @Inject JavaIoFileSystemAccess fileAccess + + @Inject IGeneratorFileIo fileIO @Inject extension CppExtensions @Inject extension RoomExtensions - @Inject extension Initialization + @Inject extension ProcedureHelpers + @Inject extension Initialization @Inject extension StateMachineGen - @Inject ILogger logger - - def doGenerate(Root root) { - for (xpac: root.xpActorClasses) { - var path = xpac.actorClass.generationTargetPath+xpac.actorClass.getPath + @Inject extension TypeHelpers + @Inject extension FileSystemHelpers - logger.logInfo("generating ActorClass header '"+xpac.actorClass.getCppHeaderFileName+"' in '"+path+"'") - fileAccess.setOutputPath(path) - fileAccess.generateFile(xpac.actorClass.getCppHeaderFileName, root.generateHeaderFile(xpac, xpac.actorClass)) - - logger.logInfo("generating ActorClass source '"+xpac.actorClass.getCppSourceFileName+"' in '"+path+"'") - fileAccess.setOutputPath(path) - fileAccess.generateFile(xpac.actorClass.getCppSourceFileName, root.generateSourceFile(xpac, xpac.actorClass)) + def doGenerate(Root root) { + val Map<ActorClass, WiredActorClass> ac2wired = newHashMap + root.wiredInstances.filter(typeof(WiredActorClass)).forEach[ac2wired.put(actorClass, it)] + for (xpac: root.xpActorClasses.filter(cl|cl.actorClass.isValidGenerationLocation)) { + val wired = ac2wired.get(xpac.actorClass) + val manualBehavior = xpac.actorClass.isBehaviorAnnotationPresent("BehaviorManual") + val path = xpac.actorClass.generationTargetPath+xpac.actorClass.getPath + val infopath = xpac.actorClass.generationInfoPath+xpac.actorClass.getPath + var file = if (manualBehavior) 'Abstract' else '' + fileIO.generateFile("generating ActorClass declaration", path, infopath, file + xpac.actorClass.getCppHeaderFileName, root.generateHeaderFile(xpac, wired, manualBehavior)) + fileIO.generateFile("generating ActorClass implementation", path, infopath, file + xpac.actorClass.getCppSourceFileName, root.generateSourceFile(xpac, wired, manualBehavior)) } } - - def private generateHeaderFile(Root root, ExpandedActorClass xpac, ActorClass ac) { -// val ctor = ac.operations.filter(op|op.constructor).head -// val dtor = ac.operations.filter(op|op.destructor).head - + + def private 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) + val rtBaseClassName = ac.actorBase?.name ?: 'etRuntime::ActorClassBase' + ''' /** * @author generated by eTrice * - * Header File of ActorClass «ac.name» - * + * Header File of ActorClass «clsname» + * */ - «generateIncludeGuardBegin(ac.name)» - - #include "platforms/generic/etDatatypes.h" + «generateIncludeGuardBegin(clsname)» + + #include "etDatatypes.h" #include "common/messaging/IRTObject.h" #include "common/modelbase/PortBase.h" #include "common/modelbase/InterfaceItemBase.h" @@ -78,18 +82,9 @@ class ActorClassGen extends GenericActorClassGenerator { #include "common/messaging/Address.h" #include "common/messaging/IMessageReceiver.h" #include "common/debugging/DebuggingService.h" - «IF Main::settings.isUseEtUnit» - extern "C" { - #include "etUnit.h" - } - «ENDIF» #include <string> #include <vector> - - «FOR model : root.getReferencedModels(ac)» -««« #include "«model.name».h" - «ENDFOR» - + «FOR pc : root.getReferencedProtocolClasses(ac)» #include "«pc.path»«pc.name».h" «ENDFOR» @@ -97,177 +92,211 @@ class ActorClassGen extends GenericActorClassGenerator { #include "«dc.path»«dc.name».h" «ENDFOR» - + using namespace etRuntime; //TODO JH remove + «ac.userCode(1, true)» - - - class «ac.name» : public «IF ac.actorBase!=null»«ac.actorBase.name»«ELSE»etRuntime::ActorClassBase«ENDIF» { - - + + class «clsname» : public «rtBaseClassName» { + + protected: //--------------------- ports - «ac.endPorts.map(port | '''«port.portClassName» «port.name»;''').join("\n")» + «FOR ep : ac.getEndPorts» + «ep.getPortClassName» «ep.name»; + «ENDFOR» + //--------------------- saps - «ac.serviceAccessPoints.map(sap | '''«sap.portClassName» «sap.name»;''').join("\n")» + «FOR sap : ac.serviceAccessPoints» + «sap.getPortClassName» «sap.name»; + «ENDFOR» + //--------------------- services - «ac.serviceImplementations.map(svc | '''«svc.portClassName» «svc.spp.name»;''').join("\n")» - + «FOR svc : ac.serviceImplementations» + «svc.getPortClassName» «svc.spp.name»; + «ENDFOR» + //--------------------- interface item IDs «xpac.genInterfaceItemConstants» - + «ac.attributes.attributes» - «operationsImplementation(ac.operations, ac.name)» - + «operationsDeclaration(ac.operations, ac.name)» + public: //--------------------- construction - «ac.name»(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr, - const std::vector<std::vector<etRuntime::Address> >& peer_addr); + «ac.name»(etRuntime::IRTObject* parent, const std::string& name); ««« TODO: check whether attribute setters/getters are necessary at all, if yes own cpp implementation is needed for *,[],& variables ««« «attributeSettersGettersImplementation(ac.attributes, ac.name)» //--------------------- port getters - «FOR ep : ac.getEndPorts()» - «ep.portClassName.getterImplementation(ep.name, ac.name)» - «ENDFOR» - «FOR sap : ac.serviceAccessPoints» - «sap.portClassName.getterImplementation(sap.name, ac.name)» - «ENDFOR» - «FOR svc : ac.serviceImplementations» - «svc.portClassName.getterImplementation(svc.spp.name, ac.name)» - «ENDFOR» - - //--------------------- lifecycle functions - virtual void init(); - virtual void start(); - «IF !ac.overridesStop()» - virtual void stop(); - «ENDIF» - virtual void destroy(); - «IF ac.hasNonEmptyStateMachine» - «xpac.genStateMachineMethodDeclarations()» - «ELSEIF !xpac.hasStateMachine()» - public: - //--------------------- no state machine - virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data); - virtual void executeInitTransition(); - «ENDIF» + «ac.endPorts.map[getterImplementation(portClassName+'&', name, clsname)].join(NEWLINE)» + + «ac.serviceAccessPoints.map[getterImplementation(portClassName+'&', name, clsname)].join(NEWLINE)» + + «ac.serviceImplementations.map[getterImplementation(portClassName+'&', spp.name, clsname)].join(NEWLINE)» - «ac.userCode(2, false)» + //--------------------- lifecycle functions + virtual void destroy(); + + «IF ac.hasNonEmptyStateMachine» + «xpac.genStateMachineConstants» + + «xpac.genStateMachineMethods(false)» + «IF ac.commType == ComponentCommunicationType::DATA_DRIVEN» + void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* generic_data); + «ENDIF» + «IF ac.commType == ComponentCommunicationType::ASYNCHRONOUS || ac.commType == ComponentCommunicationType::DATA_DRIVEN» + virtual void receive(const etRuntime::Message* msg); + «ENDIF» + «ELSEIF xpac.stateMachine.empty» +««« no state machine in the super classes + //--------------------- no state machine + virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data); + virtual void executeInitTransition() {} + «ENDIF» + + «ac.userCode(2, false)» }; - - + + «generateIncludeGuardEnd(ac.name)» ''' } - def private generateConstructorInitalizerList(ActorClass ac) { + + def private generateConstructorInitalizerList(ActorClass ac) { var initializerList = new ArrayList<CharSequence>(); - if (ac.actorBase==null) { - initializerList.add('''ActorClassBase( parent, name, port_addr[0][0], peer_addr[0][0])''') - } - else { - initializerList.add('''«ac.actorBase.name»(*this, parent, name, port_addr, peer_addr)''') - } + initializerList.add('''«ac.actorBase?.name ?: 'ActorClassBase'»(parent, name)''') + // own ports for ( ep : ac.getEndPorts() ) { - initializerList.add('''«ep.name»(*this, this, "«ep.name»", IFITEM_«ep.name», «IF ep.multiplicity==1»0, «ENDIF»port_addr[IFITEM_«ep.name»]«IF ep.multiplicity==1»[0]«ENDIF», peer_addr[IFITEM_«ep.name»]«IF ep.multiplicity==1»[0]«ENDIF»)'''); + initializerList.add('''«ep.name»(this, "«ep.name»", IFITEM_«ep.name»)'''); } // own saps for ( sap : ac.serviceAccessPoints ) { - initializerList.add('''«sap.name»(*this, this, "«sap.name»", IFITEM_«sap.name», 0, port_addr[IFITEM_«sap.name»][0], peer_addr[IFITEM_«sap.name»][0])'''); + initializerList.add('''«sap.name»(this, "«sap.name»", IFITEM_«sap.name»)'''); } // own service implementations for (svc : ac.serviceImplementations) { - initializerList.add('''«svc.spp.name»(*this, this, "«svc.spp.name»", IFITEM_«svc.spp.name», port_addr[IFITEM_«svc.spp.name»], peer_addr[IFITEM_«svc.spp.name»])'''); + initializerList.add('''«svc.spp.name»(this, "«svc.spp.name»", IFITEM_«svc.spp.name»)'''); } for (attrib: ac.attributes) { initializerList.add(attrib.attributeInitialization(false)) } - return - ''' - «initializerList.join(',\n')» - ''' + + initializerList.join(',' + NEWLINE) } - - def private generateSourceFile(Root root, ExpandedActorClass xpac, ActorClass ac) { -// val ctor = ac.operations.filter(op|op.constructor).head -// val dtor = ac.operations.filter(op|op.destructor).head - val async = xpac.actorClass.commType==ComponentCommunicationType::ASYNCHRONOUS - + + def private 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) + val rtBaseClassName = ac.actorBase?.name ?: 'ActorClassBase' + ''' /** * @author generated by eTrice * * Source File of ActorClass «ac.name» - * + * */ #include "«ac.getCppHeaderFileName»" - #include "common/debugging/DebuggingService.h" + + #include "common/messaging/RTObject.h" + #include "common/messaging/RTServices.h" + #include "etDatatypes.h" + #include "etUnit/etUnit.h" #include <iostream> - + #include <string> + + «FOR ar : ac.actorRefs» + #include "«ar.type.path»«ar.type.name».h" + «ENDFOR» + using namespace etRuntime; - - - «ac.name»::«ac.name»(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr, - const std::vector<std::vector<etRuntime::Address> >& peer_addr) - : «ac.generateConstructorInitalizerList» + + + «clsname»::«clsname»(etRuntime::IRTObject* parent, const std::string& name) : + «ac.generateConstructorInitalizerList» { «IF ac.hasNonEmptyStateMachine» - history = new int[s_numberOfStates]; - for (int i = 0; i < s_numberOfStates; i++) { - history[i] = NO_STATE; - } + for (int i = 0; i < s_numberOfStates; i++) { + history[i] = NO_STATE; + } «ENDIF» setClassName("«ac.name»"); «ac.attributes.attributeInitialization(false)» - - «IF async» - getMsgsvc()->addAsyncActor(*this); + + // sub actors + «FOR sub : ac.actorRefs» + «IF sub.multiplicity>1» + for (int i=0; i<«sub.multiplicity»; ++i) { + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addMessageActorCreate(*this, "«sub.name»«GenmodelConstants::INDEX_SEP»"+i); + «ENDIF» + new «sub.type.name»(this, "«sub.name»«GenmodelConstants::INDEX_SEP»"+i); + } + «ELSE» + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addMessageActorCreate(*this, "«sub.name»"); + «ENDIF» + new «sub.type.name»(this, "«sub.name»"); + «ENDIF» + «ENDFOR» + + // wiring + «FOR wire: wired.wires» + «if (wire.dataDriven) "DataPortBase" else "InterfaceItemBase"»::connect(this, "«wire.path1.join('/')»", "«wire.path2.join('/')»"); + «ENDFOR» + + «IF ac.commType == ComponentCommunicationType::ASYNCHRONOUS || ac.commType == ComponentCommunicationType::DATA_DRIVEN» + // activate polling for data-driven communication + RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->addPollingMessageReceiver(*this); «ENDIF» -««« «IF ctor!=null» -««« // user defined constructor body -««« «AbstractGenerator::getInstance().getTranslatedCode(ctor.detailCode)» -««« «ENDIF» - } - - void «ac.name»::init(){ - initUser(); - } - - void «ac.name»::start(){ - startUser(); + + «ac.userStructorBody(true)» } - - «IF !ac.overridesStop()» - void «ac.name»::stop(){ - stopUser(); + + void «ac.name»::destroy(){ + «ac.userStructorBody(false)» + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addMessageActorDestroy(*this); + «ENDIF» + «IF ac.commType == ComponentCommunicationType::ASYNCHRONOUS || ac.commType == ComponentCommunicationType::DATA_DRIVEN» + RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->removePollingMessageReceiver(*this); + «ENDIF» + «rtBaseClassName»::destroy(); } - «ENDIF» - -««« void «ac.name»::destroy(){ -««« «IF dtor!=null» -««« -««« // user defined destructor body -««« «AbstractGenerator::getInstance().getTranslatedCode(dtor.detailCode)» -««« «ENDIF» -««« } - + + «operationsImplementation(ac.operations, ac.name)» + «IF ac.hasNonEmptyStateMachine» - «xpac.genStateMachine(false)» - «ELSEIF !xpac.hasStateMachine()» + «xpac.genStateMachineMethods(true)» + «IF ac.commType == ComponentCommunicationType::DATA_DRIVEN» + void «ac.name»::receiveEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) { + handleSystemEvent(ifitem, evt, generic_data); + } + «ENDIF» + «IF ac.commType == ComponentCommunicationType::ASYNCHRONOUS || ac.commType == ComponentCommunicationType::DATA_DRIVEN» + void «ac.name»::receive(const Message* msg) { + «IF ac.commType == ComponentCommunicationType::ASYNCHRONOUS» + receiveEvent(0, -1, 0); + «ELSE» + receiveEventInternal(); + «ENDIF» + } + «ENDIF» + «ELSEIF xpac.stateMachine.empty» +««« no state machine in the super classes //--------------------- no state machine - void «ac.name»::receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data) { + void «ac.name»::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data) { handleSystemEvent(ifitem, evt, data); } - - void «ac.name»::executeInitTransition(){ - } «ENDIF» ''' } - - + + } diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend index 26bce00b7..aae897625 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend @@ -4,11 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) * Peter Karlitschek - * + * *******************************************************************************/ /* @@ -21,105 +21,109 @@ package org.eclipse.etrice.generator.cpp.gen import com.google.inject.Inject import com.google.inject.Singleton import java.util.List +import org.eclipse.emf.ecore.EObject +import org.eclipse.etrice.core.etphys.eTPhys.NodeRef +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician +import org.eclipse.etrice.core.room.DataClass import org.eclipse.etrice.core.room.DataType +import org.eclipse.etrice.core.room.EnumLiteral +import org.eclipse.etrice.core.room.EnumerationType import org.eclipse.etrice.core.room.ExternalType import org.eclipse.etrice.core.room.Message import org.eclipse.etrice.core.room.PrimitiveType import org.eclipse.etrice.core.room.RoomClass import org.eclipse.etrice.core.room.VarDecl -import org.eclipse.etrice.core.room.DataClass import org.eclipse.etrice.generator.generic.ILanguageExtension import org.eclipse.etrice.generator.generic.TypeHelpers import org.eclipse.xtext.util.Pair -import org.eclipse.etrice.core.room.EnumerationType - -import org.eclipse.etrice.core.room.EnumLiteral -import org.eclipse.emf.ecore.EObject @Singleton class CppExtensions implements ILanguageExtension { @Inject IDiagnostician diagnostician @Inject extension TypeHelpers - + override String getTypedDataDefinition(EObject msg) { generateArglistAndTypedData((msg as Message).data).get(1) } + def String getCppHeaderFileName(RoomClass rc) { rc.name + ".h" } + + def String getCppSourceFileName(RoomClass rc) { rc.name + ".cpp" } + + def String getCppClassName(NodeRef nr, SubSystemInstance ssi) { + "Node_" + nr.name + "_" + ssi.name; + } + + def String getCppHeaderFileName(NodeRef nr, SubSystemInstance ssi) { + nr.getCppClassName(ssi) + ".h"; + } + + def String getCppSourceFileName(NodeRef nr, SubSystemInstance ssi) { + nr.getCppClassName(ssi) + ".cpp"; + } - def String getCppHeaderFileName(RoomClass rc) {rc.name+".h"} - def String getCppSourceFileName(RoomClass rc) {rc.name+".cpp"} - def String getInstSourceFileName(RoomClass rc) {rc.name+"_Inst.h"} - def String getDispSourceFileName(RoomClass rc) {rc.name+"_Disp.h"} - override String accessLevelPrivate() {""} override String accessLevelProtected() {""} override String accessLevelPublic() {""} - - override String memberAccess() {"this->"} + + override String memberAccess() {"this->"} override String selfPointer(String classname, boolean hasArgs) {""} override String selfPointer(boolean hasArgs) { "" } - + override String operationScope(String classname, boolean isDeclaration) { if (isDeclaration) "" else classname+"::" } - + override String memberInDeclaration(String namespace, String member) { return member } - + override String memberInUse(String namespace, String member) { return namespace+"."+member } - + override boolean usesInheritance() { return true } - + override boolean usesPointers() { return true } - - override String genEnumeration(String name, List<Pair<String, String>> entries) { + + override String genEnumeration(String name, List<Pair<String, String>> entries){ + if(entries.empty) + return '' + + ''' + typedef enum { + «FOR entry : entries SEPARATOR ','» + «entry.first» = «entry.second» + «ENDFOR» + } «name»; ''' - typedef enum { - «FOR entry: entries» - «entry.first» = «entry.second», - «ENDFOR» - } «name»;'''.toString } + override String booleanConstant(boolean b) { b.toString } - + override String pointerLiteral() { "*" } override String nullPointer() { "0" } override String voidPointer() { "void*" } + override String typeArrayModifier() { pointerLiteral } + + override String arrayDeclaration(String type, int size, String name, boolean isRef)''' + «type»«IF isRef»*«ENDIF» «name»[«size»] + ''' - override String arrayDeclaration(String type, int size, String name, boolean isRef) { - type+" "+name+"["+size+"]"; - } - - override String constructorName(String cls) { - cls - } - override String destructorName(String cls) { - cls+"_dtor" - } - override String constructorReturnType() { - "" - } - override String destructorReturnType() { - "void" - } - def getIncludeGuardString(String filename){ '''_«filename.replaceAll("\\/.", "_").toUpperCase»_H_''' } @@ -134,18 +138,18 @@ class CppExtensions implements ILanguageExtension { #endif /* «filename.getIncludeGuardString» */ ''' } - - + + override superCall(String baseClassName, String method, String arguments) { baseClassName+"::"+method+"("+arguments+");" } - + override String toValueLiteral(PrimitiveType type, String value){ throw new UnsupportedOperationException("TODO Config for Cpp"); } - + override toEnumLiteral(EnumerationType type, String value) { throw new UnsupportedOperationException("TODO Config for Cpp") } @@ -163,7 +167,7 @@ class CppExtensions implements ILanguageExtension { } else { val dc = dt as DataClass - + ''' { «FOR att : dc.attributes SEPARATOR ","» @@ -173,14 +177,14 @@ class CppExtensions implements ILanguageExtension { ''' } } - + def String getDefaultValue(EnumerationType type) { if (type.getLiterals().isEmpty()) "" else getCastedValue(type.getLiterals().get(0)) } - + override initializationWithDefaultValues(DataType dt, int size) { val dv = dt.defaultValue if (size>1) { @@ -197,20 +201,24 @@ class CppExtensions implements ILanguageExtension { else dv } - + override generateArglistAndTypedData(EObject d) { - val data = d as VarDecl - var deref = "*" + if (d==null || !(d instanceof VarDecl)) + return newArrayList("", "", "") + + val data = d as VarDecl if (data==null) return newArrayList("", "", "") - + var typeName = if (data.getRefType().getType() instanceof PrimitiveType) - (data.getRefType().getType() as PrimitiveType).getTargetName() + (data.getRefType().getType() as PrimitiveType).targetName else if (data.getRefType().getType() instanceof EnumerationType) (data.getRefType().getType() as EnumerationType).targetType + else if (data.getRefType().getType() instanceof ExternalType) + (data.getRefType().getType() as ExternalType).targetName else data.getRefType().getType().getName() - + var castTypeName = if (data.getRefType().getType() instanceof PrimitiveType) { val ct = (data.getRefType().getType() as PrimitiveType).getCastName() if (ct!=null && !ct.isEmpty()) @@ -223,51 +231,44 @@ class CppExtensions implements ILanguageExtension { } else typeName - castTypeName = castTypeName+"*" - + castTypeName += '*' + var deRef = '*' + if (data.getRefType().isRef()) { typeName = typeName+"*" - castTypeName = castTypeName+"*" - } - else if (!(data.getRefType().getType() instanceof PrimitiveType)) { - typeName = typeName+"*" - castTypeName = castTypeName+"*" + deRef = '' } - else { - castTypeName = typeName - deref = "" - } - - val typedData = typeName+" "+data.getName() + " = " + deref + "(("+castTypeName+") generic_data);\n" + + val typedData = typeName+" "+data.getName() + " = "+deRef+"(static_cast<"+castTypeName+">(generic_data__et));\n" val dataArg = ", "+data.getName() val typedArgList = ", "+typeName+" "+data.getName() - + return newArrayList(dataArg, typedData, typedArgList); } - + override getTargetType(EnumerationType type) { if (type.getPrimitiveType()!=null) type.getPrimitiveType().getTargetName() else type.getName() } - + override getCastedValue(EnumLiteral literal) { val type = literal.eContainer() as EnumerationType val cast = type.targetType - + if (type.primitiveType!=null) Long.toString(literal.getLiteralValue()) else "(("+cast+")"+Long.toString(literal.getLiteralValue())+")" } - + override getCastType(EnumerationType type) { if (type.getPrimitiveType()!=null) type.getPrimitiveType().getCastName() else type.getName() } - + } diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java index 6d3a9e406..385aa08f1 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppTranslationProvider.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.gen; @@ -17,6 +17,7 @@ import java.util.ArrayList; import org.eclipse.emf.ecore.EObject; import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; import org.eclipse.etrice.core.fsm.fSM.DetailCode; +import org.eclipse.etrice.core.room.InterfaceItem; import org.eclipse.etrice.core.room.Message; import org.eclipse.etrice.generator.base.DefaultTranslationProvider; @@ -35,17 +36,17 @@ public class CppTranslationProvider extends DefaultTranslationProvider { public boolean translateTags() { return true; } - + @Override public String getInterfaceItemMessageText(AbstractInterfaceItem item, EObject abstractMsg, ArrayList<String> args, String index, String orig) { if (index==null) return orig; - + if (!(abstractMsg instanceof Message)) return ""; - + Message msg = (Message) abstractMsg; - + StringBuilder argtext = new StringBuilder(); for (String arg : args) { argtext.append(", "+arg); @@ -54,12 +55,17 @@ public class CppTranslationProvider extends DefaultTranslationProvider { // TODO: overload operator[] ??? return item.getName()+".get("+index+")."+msg.getName()+"("+argtext.toString()+")"; } - + + @Override + public String getInterfaceItemMessageValue(InterfaceItem item, Message msg, String orig) { + return item.getName() + "." + msg.getName() + "()"; + } + @Override public String translateTag(String tag, DetailCode code) { if (tag.equals("ifitem.index")) return "ifitem.getIdx()"; - + return super.translateTag(tag, code); } diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend index b29dca461..ad7810817 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Peter Karlitschek (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.gen @@ -15,23 +15,17 @@ package org.eclipse.etrice.generator.cpp.gen import com.google.inject.Inject import com.google.inject.Singleton import java.util.List -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger import org.eclipse.etrice.core.genmodel.etricegen.Root +import org.eclipse.etrice.core.genmodel.fsm.base.ILogger import org.eclipse.etrice.core.room.Attribute import org.eclipse.etrice.core.room.ComplexType import org.eclipse.etrice.core.room.DataClass +import org.eclipse.etrice.core.room.util.RoomHelpers 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.generator.cpp.gen.Initialization import org.eclipse.xtext.generator.JavaIoFileSystemAccess -import org.eclipse.etrice.core.room.util.RoomHelpers -import org.eclipse.etrice.generator.cpp.Main -/** - * @author Peter Karlitschek - * - */ @Singleton class DataClassGen { @@ -43,7 +37,7 @@ class DataClassGen { @Inject extension Initialization @Inject extension RoomHelpers @Inject ILogger logger - + def doGenerate(Root root) { logger.logInfo("generating code") for (dc: root.usedDataClasses) { @@ -53,74 +47,62 @@ class DataClassGen { logger.logInfo("generating DataClass header '"+dc.getCppHeaderFileName+"' in '"+path+"'") fileAccess.setOutputPath(path) fileAccess.generateFile(dc.getCppHeaderFileName, root.generateHeaderFile(dc)) - + // source file logger.logInfo("generating DataClass source '"+dc.getCppSourceFileName+"' in '"+path+"'") fileAccess.setOutputPath(path) fileAccess.generateFile(dc.getCppSourceFileName, root.generateSourceFile(dc)) - + } - + } - + def generateHeaderFile(Root root, DataClass dc) { -// val ctor = dc.operations.filter(op|op.constructor).head -// val dtor = dc.operations.filter(op|op.destructor).head //TODO: getReferencedDataClasses does not contain a base class of the own package ''' «generateIncludeGuardBegin(dc.path + dc.name)» - - «IF dc.base!=null» - #include "«dc.base.path»«dc.base.name».h" - «ENDIF» + + #include "etDatatypes.h" + «IF dc.base!=null»#include "«dc.base.path»«dc.base.name».h"«ENDIF» «FOR classes : root.getReferencedDataClasses(dc)» - #include "«classes.path»«classes.name».h" - «ENDFOR» - «var models = root.getReferencedModels(dc)» - «FOR model : models» - «FOR classes : model.dataClasses» - #include "«classes.path»«classes.name».h" + #include "«classes.path»«classes.name».h" «ENDFOR» + «FOR model : root.getReferencedModels(dc)» + «FOR classes : model.dataClasses» + #include "«classes.path»«classes.name».h" + «ENDFOR» «ENDFOR» - + «helpers.userCode(dc.userCode1)» - - + + class «dc.name»«IF dc.base!=null» : public «dc.base.name»«ENDIF» { - + public: «helpers.userCode(dc.userCode2)» - + «helpers.attributes(dc.attributes)» - + «helpers.attributeSettersGettersImplementation(dc.attributes, dc.name)» - + «helpers.operationsDeclaration(dc.operations, dc.name)» - + // default constructor, copy constructor and assignment operator «dc.name»(); «dc.name»(const «dc.name»& rhs); «dc.name»& operator=(const «dc.name»& rhs); - + // constructor using fields - «dc.name»(«dc.argList»); - - «IF dc.base!=null» - // constructor using base class constructor - «dc.name»(«dc.base.name» _super, «dc.attributes.argListConstructor.toString»); - «ENDIF» - + «IF !dc.attributes.empty»«dc.name»(«dc.attributes.argList»);«ENDIF» }; - + «generateIncludeGuardEnd(dc.name)» - + ''' } - + def generateSourceFile(Root root, DataClass dc) { -// val ctor = dc.operations.filter(op|op.constructor).head -// val dtor = dc.operations.filter(op|op.destructor).head - + val baseName = dc.base?.name ''' /** * @author generated by eTrice @@ -129,71 +111,44 @@ class DataClassGen { */ #include "«dc.getCppHeaderFileName»" - «IF Main::settings.isUseEtUnit» - extern "C" { - #include "etUnit.h" - } - «ENDIF» - + + #include "etUnit/etUnit.h" + «helpers.userCode(dc.userCode3)» - + // default constructor - «dc.name»::«dc.name»() + «dc.name»::«dc.name»() «IF dc.base!=null» :«dc.base.name»() «ENDIF» { «dc.attributes.attributeInitialization(false)» -««« «IF ctor!=null» -««« { -««« // user defined constructor body -««« «FOR l : ctor.detailCode.lines» -««« «l» -««« «ENDFOR» -««« } -««« «ENDIF» + + «dc.userStructorBody(true)» } - + // copy constructor «dc.name»::«dc.name»(const «dc.name»& rhs) - : - «IF dc.base!=null» - «dc.base.name»(rhs), - «ENDIF» - «FOR a : dc.attributes SEPARATOR ","» - «a.name»(rhs.«a.name») - «ENDFOR» + «constructorList((#[if(baseName != null) baseName +'(rhs)'] + dc.attributes.map[name+'(rhs.'+name+')']).filterNull)» { } // constructor using fields - «dc.name»::«dc.name»(«dc.argList») - : - «IF dc.base!=null» - «dc.base.name»(«dc.base.paramList»), - «ENDIF» - «FOR a : dc.attributes SEPARATOR ","» - «a.name»(«a.name»_) - «ENDFOR» - { - } - - «IF dc.base!=null» - // constructor using base class constructor - «dc.name»::«dc.name»(«dc.base.name» _super, «dc.attributes.argListConstructor.toString») - : - «dc.base.name»(_super), - «FOR a : dc.attributes SEPARATOR ","» - «a.name»(«a.name»_) - «ENDFOR» - { - } + «IF !dc.attributes.empty» + «dc.name»::«dc.name»(«dc.attributes.argList») + : + «FOR a : dc.attributes SEPARATOR ","» + «a.name»(«a.name») + «ENDFOR» + { + «dc.userStructorBody(true)» + } «ENDIF» - + // assignment operator «dc.name»& «dc.name»::operator=(const «dc.name»& rhs) - { + { if (this == &rhs) { return *this; }; «IF dc.base!=null» «dc.base.name»::operator=(rhs); @@ -202,46 +157,50 @@ class DataClassGen { «a.name»= rhs.«a.name»; «ENDFOR» return *this; - } - + } + «helpers.operationsImplementation(dc.operations, dc.name)» - + '''} - - def paramList(DataClass _dc) { - var result = "" - var dc = _dc - while (dc!=null) { - result = dc.attributes.paramList.toString + result - dc = dc.base - if (dc!=null) - result = ", "+result - } - return result - } - - def paramList(List<Attribute> attributes) { - '''«FOR a: attributes SEPARATOR ", "»«a.name»_«ENDFOR»''' - } - - def argList(DataClass _dc) { - var result = "" - var dc = _dc - while (dc!=null) { - result = dc.attributes.argListConstructor.toString + result - dc = dc.base - if (dc!=null) - result = ", "+result - } - return result - } - - def argListConstructor(List<Attribute> attributes) { - '''«FOR a : attributes SEPARATOR ", "»«a.type.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»_«ENDFOR»''' - } - - + def constructorList(Iterable<? extends CharSequence> items)''' + «FOR s : items BEFORE ':' SEPARATOR ','» + «s» + «ENDFOR» + ''' + +// def paramList(DataClass _dc) { +// var result = "" +// var dc = _dc +// while (dc!=null) { +// result = dc.attributes.paramList.toString + result +// dc = dc.base +// if (dc!=null) +// result = ", "+result +// } +// return result +// } + +// def paramList(List<Attribute> attributes) { +// '''«FOR a: attributes SEPARATOR ", "»«a.name»_«ENDFOR»''' +// } +// +// def argList(DataClass _dc) { +// var result = "" +// var dc = _dc +// while (dc!=null) { +// result = dc.attributes.argListConstructor.toString + result +// dc = dc.base +// if (dc!=null) +// result = ", "+result +// } +// return result +// } +// +// def argListConstructor(List<Attribute> attributes) { +// '''«FOR a : attributes SEPARATOR ", "»«a.type.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»_«ENDFOR»''' +// } + def deepCopy(DataClass _dc) { var result = "" var dc = _dc @@ -251,7 +210,7 @@ class DataClassGen { } return result } - + def deepCopy(List<Attribute> attributes) { ''' «FOR a : attributes» diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/GeneratorSettings.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/GeneratorSettings.java deleted file mode 100644 index 823b5513f..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/GeneratorSettings.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.generator.cpp.gen; - -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; - -/** - * @author Henrik Rentz-Reichert - * - */ -public class GeneratorSettings extends GlobalGeneratorSettings { - - private boolean useEtUnit = false; - - public boolean isUseEtUnit() { - return useEtUnit; - } - - public void setUseEtUnit(boolean useEtUnit) { - this.useEtUnit = useEtUnit; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend index c70d5d8bf..c7af37f5d 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Initialization.xtend @@ -4,11 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) * Peter Karlitschek - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.gen @@ -29,7 +29,7 @@ class Initialization { @Inject ILanguageExtension languageExt // @Inject IDataConfiguration dataConfigExt // @Inject ProcedureHelpers procedureHelpers - + def attributeInitialization(List<Attribute> attribs, boolean useClassDefaultsOnly) { ''' // initialize attributes @@ -58,7 +58,7 @@ class Initialization { «ENDFOR» ''' } - + def initializeArrayWithValues(String varName, String[] values) { ''' «var i = -1» @@ -73,7 +73,7 @@ class Initialization { var value = a.defaultValueLiteral if (value != null) { if (a.size == 0 || aType.characterType) { - if (a.type.isRef) + if (a.type.isRef) '''«a.name»(new «aType.name»(«value»))''' else '''«a.name»(«value»)''' @@ -84,7 +84,7 @@ class Initialization { else { '''«a.name»()''' } - } + } else if (aType instanceof ComplexType || a.size>1 || !useClassDefaultsOnly) { if (a.size==0) { if (a.type.isRef) @@ -92,10 +92,10 @@ class Initialization { else '''«a.name»(«languageExt.defaultValue(aType)»)''' } - else + else '''«a.name»()''' } } - - + + }
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend index 450633b95..025a8ec7d 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/MainGen.xtend @@ -25,8 +25,8 @@ class MainGen { @Inject DataClassGen dataClassGen @Inject ProtocolClassGen protocolClassGen @Inject ActorClassGen actorClassGen - @Inject SubSystemClassGen subsystemClassGen - @Inject SubSystemRunnerGen subsystemRunnerGen + @Inject NodeGen subsystemClassGen + @Inject NodeRunnerGen subsystemRunnerGen @Inject PrepareFileSystem prepFS def void doGenerate(Resource resource) { diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend new file mode 100644 index 000000000..4304070eb --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend @@ -0,0 +1,250 @@ +/******************************************************************************* + * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Peter Karlitschek (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.cpp.gen + +import com.google.inject.Inject +import com.google.inject.Singleton +import java.util.Collection +import java.util.Map +import org.eclipse.etrice.core.etmap.util.ETMapUtil +import org.eclipse.etrice.core.etphys.eTPhys.ExecMode +import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread +import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants +import org.eclipse.etrice.core.genmodel.etricegen.Root +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance +import org.eclipse.etrice.core.genmodel.etricegen.WiredSubSystemClass +import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician +import org.eclipse.etrice.core.room.SubSystemClass +import org.eclipse.etrice.generator.cpp.Main +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo +import org.eclipse.etrice.generator.generic.ProcedureHelpers +import org.eclipse.etrice.generator.generic.RoomExtensions + +import static extension org.eclipse.etrice.generator.fsm.base.Indexed.* +import org.eclipse.etrice.core.common.converter.TimeConverter + +@Singleton +class NodeGen { + + @Inject extension CppExtensions + @Inject extension RoomExtensions + @Inject extension ProcedureHelpers + @Inject extension FileSystemHelpers + + @Inject IGeneratorFileIo fileIO + @Inject IDiagnostician diagnostician + + def doGenerate(Root root) { + val Map<SubSystemClass, WiredSubSystemClass> sscc2wired = newHashMap + root.wiredInstances.filter(typeof(WiredSubSystemClass)).forEach[sscc2wired.put(subSystemClass, it)] + + for (nr : ETMapUtil::getNodeRefs()) { + for (instpath : ETMapUtil::getSubSystemInstancePaths(nr)) { + val ssi = root.getInstance(instpath) as SubSystemInstance + if (ssi!=null && ssi.subSystemClass.validGenerationLocation) { + val wired = sscc2wired.get(ssi.subSystemClass) + val path = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath + val infopath = ssi.subSystemClass.generationInfoPath+ssi.subSystemClass.getPath + + //checkDataPorts(ssi) + + val usedThreads = ETMapUtil::getUsedThreads(nr, ssi) + + fileIO.generateFile("generating Node declaration", path, infopath, getCppHeaderFileName(nr, ssi), root.generateHeaderFile(ssi, wired, usedThreads)) + fileIO.generateFile("generating Node implementation", path, infopath, getCppSourceFileName(nr, ssi), root.generateSourceFile(ssi, wired, usedThreads)) + } + } + } + } + + def generateHeaderFile(Root root, SubSystemInstance comp, WiredSubSystemClass wired, Collection<PhysicalThread> usedThreads) { + val cc = comp.subSystemClass + val models = root.getReferencedModels(cc) + val nr = ETMapUtil::getNodeRef(comp) + val clsname = nr.getCppClassName(comp) + val threads = nr.type.threads.filter(t|usedThreads.contains(t)) + + ''' + /** + * @author generated by eTrice + * + * Header File of SubSystemClass «clsname» + * + */ + + «generateIncludeGuardBegin(clsname)» + + #include "common/modelbase/SubSystemClassBase.h" + +««« «FOR model : root.getReferencedModels(cc)» +««« ««« #include "«model.name».h" +««« «ENDFOR» + «cc.userCode(1, false)» + + class «clsname» : public etRuntime::SubSystemClassBase{ + + «cc.userCode(2, false)» + + public: + + «FOR thread : threads.indexed» + static const int «thread.value.threadId»; + «ENDFOR» + + «clsname»(IRTObject* parent, const std::string& name); + + virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data); + virtual void instantiateMessageServices(); + virtual void instantiateActors(); + + virtual void init(); + + «IF Main::settings.generateMSCInstrumentation» + etBool hasGeneratedMSCInstrumentation() const { return true; } + virtual void destroy(); + «ENDIF» + + private: + + «clsname»(); + «clsname»(«clsname» const&); + «clsname»& operator=(«clsname» const&); + }; + + «generateIncludeGuardEnd(cc.name)» + ''' + } + + def private getThreadId(PhysicalThread thread) { + "THREAD_"+thread.name.toUpperCase + } + + def generateSourceFile(Root root, SubSystemInstance comp, WiredSubSystemClass wired, Collection<PhysicalThread> usedThreads) { + val cc = comp.subSystemClass + val models = root.getReferencedModels(cc) + val nr = ETMapUtil::getNodeRef(comp) + val clsname = nr.getCppClassName(comp) + val threads = nr.type.threads.filter(t|usedThreads.contains(t)) + + ''' + /** + * @author generated by eTrice + * + * Source File of SubsystemClass «clsname» + * + */ + + #include "«getCppHeaderFileName(nr, comp)»" + + #include "common/debugging/DebuggingService.h" + #include "common/messaging/IMessageService.h" + #include "common/messaging/MessageService.h" + #include "common/messaging/MessageServiceController.h" + #include "common/messaging/RTServices.h" + #include "common/modelbase/InterfaceItemBase.h" + + «FOR ai : comp.actorInstances» + #include "«ai.actorClass.path»«ai.actorClass.name».h" + «ENDFOR» + #include <iostream> + + using namespace etRuntime; + + «FOR thread : threads.indexed» + const int «clsname»::«thread.value.threadId» = «thread.index0»; + «ENDFOR» + + «clsname»::«clsname»(IRTObject* parent, const std::string& name) : + SubSystemClassBase(parent, name) + { + } + + void «clsname»::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data){ + } + + void «clsname»::instantiateMessageServices(){ + + IMessageService* msgService; + «FOR thread: threads» + { + «IF thread.execmode==ExecMode::POLLED || thread.execmode==ExecMode::MIXED» + etTime interval; + interval.sec = «TimeConverter::split(thread.time, TimeConverter.SEC, true)»; + interval.nSec = «TimeConverter::split(thread.time, TimeConverter.MILLI_SEC, false)»L; + + msgService = new MessageService(this, IMessageService::«thread.execmode.getName», interval, 0, «thread.threadId», "MessageService_«thread.name»", «thread.prio»); + «ELSE» + msgService = new MessageService(this, IMessageService::«thread.execmode.getName», 0, «thread.threadId», "MessageService_«thread.name»", «thread.prio»); + «ENDIF» + RTServices::getInstance().getMsgSvcCtrl().addMsgSvc(*msgService); + } + «ENDFOR» + } + + void «clsname»::instantiateActors(){ + + // thread mappings + «FOR ai : comp.allContainedInstances» + «val mapped = ETMapUtil::getMappedThread(ai)» + «IF !(mapped.implicit || mapped.asParent)» + addPathToThread("«ai.path»", «mapped.thread.threadId»); + «ENDIF» + «ENDFOR» + + // sub actors + «FOR sub : cc.actorRefs» + «IF sub.multiplicity>1» + for (int i=0; i<«sub.multiplicity»; ++i) { + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addMessageActorCreate(*this, "«sub.name»«GenmodelConstants::INDEX_SEP»"+i); + «ENDIF» + new «sub.type.name»(this, "«sub.name»«GenmodelConstants::INDEX_SEP»"+i); + } + «ELSE» + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addMessageActorCreate(*this, "«sub.name»"); + «ENDIF» + new «sub.type.name»(this, "«sub.name»"); + «ENDIF» + «ENDFOR» + + // wiring + «FOR wire: wired.wires» + «if (wire.dataDriven) "DataPortBase" else "InterfaceItemBase"»::connect(this, "«wire.path1.join('/')»", "«wire.path2.join('/')»"); + «ENDFOR» + } + + void «clsname»::init(){ + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addVisibleComment("begin sub system initialization"); + «ENDIF» + SubSystemClassBase::init(); + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addVisibleComment("done sub system initialization"); + «ENDIF» + } + «IF Main::settings.generateMSCInstrumentation» + + void «clsname»::destroy() { + DebuggingService::getInstance().addVisibleComment("begin sub system destruction"); + SubSystemClassBase::destroy(); + DebuggingService::getInstance().addVisibleComment("done sub system destruction"); + } + «ENDIF» + + ''' + } + + +}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend new file mode 100644 index 000000000..f83fe8682 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Peter Karlitschek (initial contribution) + * + *******************************************************************************/ +package org.eclipse.etrice.generator.cpp.gen + +import com.google.inject.Inject +import com.google.inject.Singleton +import org.eclipse.etrice.core.etmap.util.ETMapUtil +import org.eclipse.etrice.core.genmodel.etricegen.Root +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance +import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo +import org.eclipse.etrice.generator.generic.RoomExtensions + + +@Singleton +class NodeRunnerGen { + + @Inject extension RoomExtensions roomExt + @Inject extension CppExtensions + @Inject extension FileSystemHelpers + + @Inject IGeneratorFileIo fileIO + + def doGenerate(Root root) { + for (nr : ETMapUtil::getNodeRefs()) { + for (instpath : ETMapUtil::getSubSystemInstancePaths(nr)) { + val ssi = root.getInstance(instpath) as SubSystemInstance + if (ssi!=null && ssi.subSystemClass.validGenerationLocation) { + val filepath = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath + val infopath = ssi.subSystemClass.generationInfoPath+ssi.subSystemClass.getPath + fileIO.generateFile("generating SubSystemRunner declaration", filepath, infopath, nr.getCppClassName(ssi)+"Runner.h", root.generateHeaderFile(ssi)) + fileIO.generateFile("generating SubSystemRunner implementation", filepath, infopath, nr.getCppClassName(ssi)+"Runner.cpp", root.generateSourceFile(ssi)) + } + } + } + } + + def generateHeaderFile(Root root, SubSystemInstance ssc) { + //val cc = ssc.subSystemClass + val nr = ETMapUtil::getNodeRef(ssc) + val clsname = nr.getCppClassName(ssc) + ''' + /** + * @author generated by eTrice + * + * this class contains the main function running component «ssc.name» + * it instantiates «ssc.name» and starts and ends the lifecycle + */ + + «generateIncludeGuardBegin(clsname+"Runner")» + + #include "common/modelbase/SubSystemRunnerBase.h" + + class «clsname+"Runner"» : public etRuntime::SubSystemRunnerBase { + + }; + + «generateIncludeGuardEnd(clsname+"Runner")» + ''' + } + + def generateSourceFile(Root root, SubSystemInstance ssc) { + //val cc = ssc.subSystemClass + val nr = ETMapUtil::getNodeRef(ssc) + val clsname = nr.getCppClassName(ssc) + ''' + /** + * @author generated by eTrice + * + * this class contains the main function running component «ssc.name» + * it instantiates «ssc.name» and starts and ends the lifecycle + */ + + + #include "«clsname»Runner.h" + + #include "«clsname».h" + #include "common/modelbase/RTSystem.h" + + using namespace etRuntime; + + /** + * main function + * creates component and starts and stops the lifecycle + */ + int main(int argc, char* argv[]) { + // instantiate the main component + RTSystem* sys = «IF ssc.eContainer instanceof SystemInstance»new RTSystem("«(ssc.eContainer as SystemInstance).name»")«ELSE»0«ENDIF»; + «clsname»* main_component = new «clsname»(sys, "«ssc.name»"); + + «clsname»Runner::run(*main_component, argc, argv); + + // TODO JH crash + //delete sys; + + return 0; + } + + + ''' + } +}
\ No newline at end of file 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 6658923ba..b5771527d 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 @@ -4,21 +4,20 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Peter Karlitschek (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.gen import com.google.inject.Inject import com.google.inject.Singleton -import java.util.ArrayList +import java.util.List import org.eclipse.etrice.core.genmodel.etricegen.Root import org.eclipse.etrice.core.genmodel.fsm.base.ILogger import org.eclipse.etrice.core.room.CommunicationType -import org.eclipse.etrice.core.room.DataClass import org.eclipse.etrice.core.room.InterfaceItem import org.eclipse.etrice.core.room.Message import org.eclipse.etrice.core.room.Port @@ -28,100 +27,101 @@ import org.eclipse.etrice.core.room.ProtocolClass import org.eclipse.etrice.core.room.SAP import org.eclipse.etrice.core.room.SPP import org.eclipse.etrice.generator.cpp.Main +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator import org.eclipse.etrice.generator.generic.ProcedureHelpers import org.eclipse.etrice.generator.generic.RoomExtensions import org.eclipse.etrice.generator.generic.TypeHelpers -import org.eclipse.xtext.generator.JavaIoFileSystemAccess -/** - * @author Peter Karlitschek - * - */ @Singleton class ProtocolClassGen extends GenericProtocolClassGenerator { - @Inject extension JavaIoFileSystemAccess fileAccess + @Inject IGeneratorFileIo fileIO @Inject extension CppExtensions stdExt @Inject extension RoomExtensions roomExt @Inject extension ProcedureHelpers helpers @Inject extension TypeHelpers @Inject extension Initialization + @Inject extension FileSystemHelpers @Inject ILogger logger - - def doGenerate(Root root) { - for (pc: root.usedProtocolClasses) { - var path = pc.generationTargetPath+pc.getPath - logger.logInfo("generating ProtocolClass header '"+pc.getCppHeaderFileName+"' in '"+path+"'") - fileAccess.setOutputPath(path) - fileAccess.generateFile(pc.getCppHeaderFileName, root.generateHeaderFile(pc)) + def doGenerate(Root root) { + + for (pc: root.usedProtocolClasses.filter(cl|cl.isValidGenerationLocation)) { + val path = pc.generationTargetPath+pc.getPath + val infopath = pc.generationInfoPath+pc.getPath + switch (pc.commType) { + case CommunicationType::EVENT_DRIVEN:{ + fileIO.generateFile("generating ProtocolClass declaration", path, infopath, pc.cppHeaderFileName, root.generateHeaderFile(pc)) + fileIO.generateFile("generating ProtocolClass implementation", path, infopath, pc.cppSourceFileName, root.generateSourceFile(pc)) + } + case CommunicationType::DATA_DRIVEN:{ + fileIO.generateFile("generating ProtocolClass declaration", path, infopath, pc.cppHeaderFileName, root.generateDataDrivenHeaderFile(pc)) + fileIO.generateFile("generating ProtocolClass implementation", path, infopath, pc.cppSourceFileName, root.generateDataDrivenSourceFile(pc)) + } + case CommunicationType::SYNCHRONOUS: + logger.logError("synchronous protocols not supported yet", pc) + } - logger.logInfo("generating ProtocolClass source '"+pc.getCppSourceFileName+"' in '"+path+"'") - fileAccess.setOutputPath(path) - fileAccess.generateFile(pc.getCppSourceFileName, root.generateSourceFile(pc)) } } - - def private generateHeaderFile(Root root, ProtocolClass pc) {''' + + def protected generateHeaderFile(Root root, ProtocolClass pc) {''' /** * @author generated by eTrice * * Header File of ProtocolClass «pc.name» - * + * */ «generateIncludeGuardBegin(pc.name)» - - #include "platforms/generic/etDatatypes.h" - #include "common/messaging/IRTObject.h" - #include "common/modelbase/PortBase.h" + #include "common/modelbase/InterfaceItemBase.h" - #include "common/messaging/Address.h" - #include "common/messaging/Message.h" - #include <vector> + #include "common/modelbase/PortBase.h" + #include "common/modelbase/ReplicatedInterfaceItemBase.h" + #include "common/modelbase/ReplicatedPortBase.h" + #include <etDatatypes.h> #include <string> - - namespace etRuntime { - class IEventReceiver; - - } - - «helpers.userCode(pc.userCode1)» - + + «pc.userCode(1)» + «FOR dataClass : root.getReferencedDataClasses(pc)» - #include "«dataClass.path»«dataClass.name».h" + #include "«dataClass.path»«dataClass.name».h" «ENDFOR» class «pc.name» { public: - «IF pc.commType==CommunicationType::EVENT_DRIVEN» /* message IDs */ + /* message IDs */ «genMessageIDs(pc)» + + «pc.userCode(2)» + static bool isValidEvtID(int evtId) { return ((MSG_MIN < evtId) && (evtId < MSG_MAX)); - }; + } static bool isValidOutgoingEvtID(int evtId) { return ((MSG_MIN < evtId) && (evtId < «IF pc.incomingMessages.size == 0»MSG_MAX«ELSE»IN_«pc.incomingMessages.get(0).name»«ENDIF»)); - }; + } static bool isValidIncomingEvtID(int evtId) { return ((«IF pc.incomingMessages.size == 0»MSG_MAX«ELSE»IN_«pc.incomingMessages.get(0).name»«ENDIF» <= evtId) && (evtId < MSG_MAX)); - }; - static std::string getMessageString(int msg_id); - + } + static const std::string& getMessageString(int msg_id); + private: - static std::string s_messageStrings[]; - «ENDIF» - «helpers.userCode(pc.userCode2)» + static const std::string s_messageStrings[]; + + }; - + «portClassDeclaration(pc, false)» «portClassDeclaration(pc, true)» «generateIncludeGuardEnd(pc.name)» ''' } - - def private portClassDeclaration(ProtocolClass pc, Boolean conj) { + + def protected portClassDeclaration(ProtocolClass pc, boolean conj) { var pclass = pc.getPortClass(conj) var portClassName = pc.getPortClassName(conj) var replPortClassName = pc.getPortClassName(conj, true) @@ -131,89 +131,108 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { //------------------------------------------------------------------------------------------------------------ class «portClassName» : public etRuntime::PortBase { «IF pclass!=null» - «helpers.userCode(pclass.userCode)» + «pclass.userCode.userCode» «ENDIF» public: - // constructors - «portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); - «portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); - - virtual void receive(etRuntime::Message* m); + «portClassName»(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId); + «portClassName»(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId, int idx); + + «IF Main::settings.generateMSCInstrumentation» + virtual void destroy(); + «ENDIF» + + virtual void receive(const etRuntime::Message* m); + «IF pclass!=null» - «helpers.attributes(pclass.attributes)» - «helpers.operationsDeclaration(pclass.operations, portClassName)» + «pclass.attributes.attributes» + «pclass.operations.operationsDeclaration(portClassName)» «ENDIF» - - // outgoing messages + + // sent messages «FOR m : pc.getAllMessages(conj)» - «sendMessageDeclaration(m,conj)» + «messageSignature(m)»; «ENDFOR» }; - + //------------------------------------------------------------------------------------------------------------ // «IF conj»conjugated «ENDIF»replicated port class //------------------------------------------------------------------------------------------------------------ - class «replPortClassName» { - private: - int m_replication; - «portClassName»* m_ports; //dynamic array used instead of vector to avoid copy construction - + class «replPortClassName» : public etRuntime::ReplicatedPortBase { + public: - «replPortClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress); - virtual ~«replPortClassName»() {}; - - int getReplication() { return m_replication; } - int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx(); } - «portClassName» get(int i) {return m_ports[i];} - - «IF pc.commType==CommunicationType::EVENT_DRIVEN» - // outgoing messages - «FOR m : pc.getAllMessages(conj)» - «sendMessageDeclaration(m,conj)» + «replPortClassName»(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId); + + int getReplication() const { return getNInterfaceItems(); } + int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); } + «portClassName»& get(int idx) const { return *dynamic_cast<«portClassName»*>(getInterfaceItem(idx)); } + + «IF conj» + // incoming messages + «FOR m : pc.getAllIncomingMessages()» + «messageSignature(m)»; + «ENDFOR» + «ELSE» + // outgoing messages + «FOR m : pc.getAllOutgoingMessages()» + «messageSignature(m)»; «ENDFOR» «ENDIF» - + + protected: + virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) { + return new «portClassName»(rcv, name, lid, idx); + } + }; ''' } - def private generateSourceFile(Root root, ProtocolClass pc) {''' + def protected generateSourceFile(Root root, ProtocolClass pc) {''' /** * @author generated by eTrice * * Source File of ProtocolClass «pc.name» - * + * */ #include "«pc.getCppHeaderFileName»" + #include "common/debugging/DebuggingService.h" + #include "common/messaging/AbstractMessageReceiver.h" + #include "common/messaging/Address.h" + #include "common/messaging/Message.h" + #include "common/modelbase/IEventReceiver.h" #include <iostream> - «IF Main::settings.isUseEtUnit» - extern "C" { - #include "etUnit.h" - } - «ENDIF» + #include <iterator> + #include <string> + #include <vector> using namespace etRuntime; - - «helpers.userCode(pc.userCode3)» - - «IF pc.commType==CommunicationType::EVENT_DRIVEN» - «helpers.userCode(pc.userCode2)» - + + + «pc.userCode(3)» + + /* message names as strings for debugging (generate MSC) */ + const std::string «pc.name»::s_messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"}; + + const std::string& «pc.name»::getMessageString(int msg_id) { + if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) { + return s_messageStrings[msg_id]; + } else { + // id out of range + static const std::string errorMsg = "Message ID out of range"; + return errorMsg; + } + } + «portClassImplementation(pc, false)» «portClassImplementation(pc, true)» - - /*--------------------- debug helpers */ - «generateDebugHelpersImplementation(root, pc)» - «ENDIF» - - + ''' } - - def portClassImplementation(ProtocolClass pc, Boolean conj) { + + def protected portClassImplementation(ProtocolClass pc, boolean conj) { var pclass = pc.getPortClass(conj) var portClassName = pc.getPortClassName(conj) var replPortClassName = pc.getPortClassName(conj, true) @@ -221,35 +240,43 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { //------------------------------------------------------------------------------------------------------------ // «IF conj»conjugated «ENDIF»port class //------------------------------------------------------------------------------------------------------------ - - «portClassName»::«portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress, bool doRegistration) - : «pclass.generateConstructorInitalizerList("0")» + + «portClassName»::«portClassName»(IInterfaceItemOwner* actor, const std::string& name, int localId) : + «pclass.generateConstructorInitalizerList('0')» { «IF pclass!=null»«pclass.attributes.attributeInitialization(false)»«ENDIF» - if (doRegistration) { + «IF Main::settings.generateMSCInstrumentation» DebuggingService::getInstance().addPortInstance(*this); - } + «ENDIF» } - «portClassName»::«portClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress, bool doRegistration) - : «pclass.generateConstructorInitalizerList("idx")» + «portClassName»::«portClassName»(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx) : + «pclass.generateConstructorInitalizerList('idx')» { «IF pclass!=null»«pclass.attributes.attributeInitialization(false)»«ENDIF» - if (doRegistration) { + «IF Main::settings.generateMSCInstrumentation» DebuggingService::getInstance().addPortInstance(*this); - } + «ENDIF» } - - void «portClassName»::receive(Message* msg) { + «IF Main::settings.generateMSCInstrumentation» + + void «portClassName»::destroy() { + DebuggingService::getInstance().removePortInstance(*this); + PortBase::destroy(); + } + «ENDIF» + + void «portClassName»::receive(const Message* msg) { + // TODO JH further if (! «pc.name»::«IF conj»isValidOutgoingEvtID«ELSE»isValidIncomingEvtID«ENDIF»(msg->getEvtId())) { std::cout << "unknown" << std::endl; } - else { - if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag - DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), «pc.name»::getMessageString(msg->getEvtId())); - } - - «IF pc.handlesReceive(conj)» + + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), «pc.name»::getMessageString(msg->getEvtId())); + «ENDIF» + + «IF pc.handlesReceive(conj)» switch (msg->getEvtId()) { «FOR hdlr : pc.getReceiveHandlers(conj)» case «pc.name»::«hdlr.msg.getCodeName()»: @@ -262,136 +289,79 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «ENDFOR» default: «ENDIF» - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); - «IF pc.handlesReceive(conj)» + getActor()->receiveEvent(this, msg->getEvtId(), msg->getData()); + «IF pc.handlesReceive(conj)» break; } - «ENDIF» - } - }; + «ENDIF» + } «IF pclass!=null» - «helpers.operationsImplementation(pclass.operations, portClassName)» + «pclass.operations.operationsImplementation(portClassName)» «ENDIF» - + // sent messages «FOR m : pc.getAllMessages(conj)» «sendMessage(m, pc.name, portClassName, conj)» «ENDFOR» - + //------------------------------------------------------------------------------------------------------------ // «IF conj»conjugated «ENDIF»replicated port class //------------------------------------------------------------------------------------------------------------ - «replPortClassName»::«replPortClassName»(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) - : m_replication(addr.size()), - m_ports() + «replPortClassName»::«replPortClassName»(IInterfaceItemOwner* actor, const std::string& name, int localId) : + ReplicatedPortBase(actor, name, localId) { - char numstr[10]; // enough to hold all numbers up to 32-bits - - m_ports = reinterpret_cast<«portClassName»*> (new char[sizeof(«portClassName») * addr.size()]); - for (int i = 0; i < m_replication; ++i) { - snprintf(numstr, sizeof(numstr), "%d", i); - //placement new to avoid copy construction, therefore no vector is used - new (&m_ports[i]) «portClassName»(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]); - } - }; - - - // outgoing messages - «FOR m : pc.getAllMessages(conj)» - «messageSignatureDefinition(m, replPortClassName)»{ - for (int i=0; i<m_replication; ++i) { - m_ports[i].«messageCall(m)»; - } - } - «ENDFOR» - ''' } - - def generateConstructorInitalizerList(PortClass pc, String index) { - var initializerList = new ArrayList<CharSequence>(); - initializerList.add('''PortBase(actor, parent, name, localId, «index», addr, peerAddress)''') - if (pc != null) { - for (attrib: pc.attributes) { - initializerList.add(attrib.attributeInitialization(false)) + + «IF conj» + // incoming messages + «FOR m : pc.getAllIncomingMessages()» + «messageSignatureDefinition(m, replPortClassName)»{ + for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) { + (dynamic_cast<«portClassName»*>(*it))->«messageCall(m)»; + } } - } - return - ''' - «initializerList.join(',\n')» - ''' + «ENDFOR» + «ELSE» + // outgoing messages + «FOR m : pc.getAllOutgoingMessages()» + «messageSignatureDefinition(m, replPortClassName)»{ + for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) { + (dynamic_cast<«portClassName»*>(*it))->«messageCall(m)»; + } + } + «ENDFOR» + «ENDIF» + ''' } - - + def private generateConstructorInitalizerList(PortClass pc, String index) { + val List<CharSequence> initList = newArrayList + initList += '''PortBase(actor, name, localId, «index»)''' + if(pc != null) + initList += pc.attributes.map[attributeInitialization(false)] - def private messageCall(Message m) { - '''«m.name»(«IF m.data!=null» «m.data.name»«ENDIF»)''' + return initList.join(','+NEWLINE) } - - - def private generateDebugHelpersImplementation(Root root, ProtocolClass pc){''' - -««« TODO: make this optional or different for smaller footprint - /* message names as strings for debugging (generate MSC) */ - std::string «pc.name»::s_messageStrings[] - = {"MIN", - «FOR m : pc.getAllOutgoingMessages()» - "«m.name»", - «ENDFOR» - «FOR m : pc.getAllIncomingMessages()» - "«m.name»", - «ENDFOR» - "MAX"}; - - std::string «pc.name»::getMessageString(int msg_id) { - if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) { - return s_messageStrings[msg_id]; - } else { - // id out of range - return "Message ID out of range"; - } - } - - ''' + def protected messageCall(Message m) { + '''«m.name»(«IF m.data!=null» «m.data.name»«ENDIF»)''' } - - def messageSignature(Message m) { - '''«IF m.priv»private:«ELSE»public:«ENDIF» void «m.name»(«IF m.data!=null»«m.data.refType.type.typeName» «m.data.name»«ENDIF»)''' - } - def messageSignatureExplicit(Message m) { - var dc = (m.data.refType.type as DataClass) - '''public: void «m.name»(«IF dc.base!=null»«dc.base.typeName» _super, «ENDIF»«FOR a : dc.attributes SEPARATOR ", "»«a.type.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»«ENDFOR»)''' + def protected messageSignature(Message m) { + '''«IF m.priv»private:«ELSE»public:«ENDIF» void «m.name»(«IF m.data!=null»«m.data.refType.type.typeName» «m.data.name»«ENDIF»)''' } - def messageSignatureDefinition(Message m, String classPrefix) { + def protected messageSignatureDefinition(Message m, String classPrefix) { '''void «classPrefix»::«m.name»(«IF m.data!=null»«m.data.refType.type.typeName» «m.data.name»«ENDIF»)''' } - def messageSignatureExplicitDefinition(Message m, String classPrefix) { - var dc = (m.data.refType.type as DataClass) - '''void «classPrefix»::«m.name»(«IF dc.base!=null»«dc.base.typeName» _super, «ENDIF»«FOR a : dc.attributes SEPARATOR ", "»«a.type.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»«ENDFOR»)''' - } - -// def messageCall(Message m) { -// '''«m.name»(«IF m.data!=null» «m.data.name»«ENDIF»)''' -// } - - def sendMessageDeclaration(Message m, boolean conj) { - ''' - «messageSignature(m)»; - «IF m.data!=null && m.data.refType.type instanceof DataClass» - «messageSignatureExplicit(m)»; - «ENDIF» - ''' - } - - def sendMessage(Message m, String portClassName, String classPrefix, boolean conj) { + def protected sendMessage(Message m, String portClassName, String classPrefix, boolean conj) { var dir = if (conj) "IN" else "OUT" var hdlr = m.getSendHandler(conj) + val dataArg = if(m.data != null) ''', «IF m.data.refType.ref»«m.data.name»«ELSE»&«m.data.name», sizeof(«m.data.refType.type.typeName»)«ENDIF»''' + val message = '''new Message(getPeerAddress(), «portClassName»::«dir»_«m.name»«dataArg?:''»)''' ''' «messageSignatureDefinition(m, classPrefix)» { «IF hdlr!=null» @@ -399,26 +369,148 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «ENDFOR» «ELSE» DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - «portClassName»::getMessageString(«portClassName»::«dir»_«m.name»)); + «portClassName»::getMessageString(«portClassName»::«dir»_«m.name»)); if (getPeerAddress().isValid()){ - «IF m.data==null»getPeerMsgReceiver()->receive(new Message(getPeerAddress(), «portClassName»::«dir»_«m.name»)); - «ELSE»getPeerMsgReceiver()->receive(new Message(getPeerAddress(),«portClassName»::«dir»_«m.name», - reinterpret_cast<void*>(«IF (!m.data.refType.ref && !(m.data.refType.type instanceof PrimitiveType))»&«ENDIF»«m.data.name»), - sizeof(«m.data.refType.type.typeName»))); - «ENDIF» + getPeerMsgReceiver()->receive(«message»); } «ENDIF» } - - «IF m.data!=null && m.data.refType.type instanceof DataClass» - «messageSignatureExplicitDefinition(m, classPrefix)» { - «m.name»(«m.data.refType.type.name»(«IF (m.data.refType.type as DataClass).base!=null»_super, «ENDIF»«FOR a : (m.data.refType.type as DataClass).attributes SEPARATOR ", "»«a.name»«ENDFOR»)); - } - «ENDIF» ''' - //TODO derived data classes are not yet handled correctly } + + def protected generateDataDrivenHeaderFile(Root root, ProtocolClass pc) { + val sentMsgs = pc.allIncomingMessages.filter(m|m.data!=null) + val models = root.getReferencedModels(pc) + ''' + /** + * @author generated by eTrice + * + * Header File of ProtocolClass «pc.name» + * + */ + + «generateIncludeGuardBegin(pc.name)» + + #include "etDatatypes.h" + #include "common/modelbase/DataPort.h" + «FOR dataClass : root.getReferencedDataClasses(pc)» + #include "«dataClass.path»«dataClass.name».h" + «ENDFOR» + + «pc.userCode(1)» + +««« «FOR model : models» +««« import «model.name».*; +««« «ENDFOR» + + class «pc.name» { + + «pc.userCode(2)» + + }; + + // send port holds data + class «pc.getPortClassName(true)» : public etRuntime::DataSendPort { + + public: + «pc.getPortClassName(true)»(etRuntime::IRTObject* parent, const std::string& name, int localId); + + // getters and setters + «FOR msg : sentMsgs» + void «msg.name»(«msg.data.refType.type.typeName» «msg.name») { + m_«msg.name» = «msg.name»; + } + «msg.data.refType.type.typeName» «msg.name»() const { + return m_«msg.name»; + } + «ENDFOR» + + private: + «FOR msg : sentMsgs» + «msg.data.refType.type.typeName» m_«msg.name»; + «ENDFOR» + }; + + // receive port accesses send port + class «pc.getPortClassName(false)» : public etRuntime::DataReceivePort { + + public: + «pc.getPortClassName(false)»(etRuntime::IRTObject* parent, const std::string& name, int localId); + + // getters + «FOR msg : sentMsgs» + «msg.data.refType.type.typeName» «msg.name»() const; + «ENDFOR» + + protected: + virtual void connect(etRuntime::DataSendPort* dataSendPort); + + private: + «pc.getPortClassName(true)»* m_peer; + + }; + + «generateIncludeGuardEnd(pc.name)» + ''' + } + + def protected generateDataDrivenSourceFile(Root root, ProtocolClass pc) { + val sentMsgs = pc.allIncomingMessages.filter(m|m.data!=null) + val models = root.getReferencedModels(pc) + ''' + /** + * @author generated by eTrice + * + * Source File of ProtocolClass «pc.name» + * + */ + + #include "«pc.getCppHeaderFileName»" + + using namespace etRuntime; + + «pc.userCode(3)» + +««« «FOR model : models» +««« import «model.name».*; +««« «ENDFOR» + // send port holds data + + // constructor + «pc.getPortClassName(true)»::«pc.getPortClassName(true)»(IRTObject* parent, const std::string& name, int localId) : + DataSendPort(parent, name, localId) + { + } + + // receive port accesses send port + + // constructor + «pc.getPortClassName(false)»::«pc.getPortClassName(false)»(IRTObject* parent, const std::string& name, int localId) : + DataReceivePort(parent, name, localId), + m_peer(0) + { + + } + + // getters + «FOR msg : sentMsgs» + «msg.data.refType.type.typeName» «pc.getPortClassName(false)»::«msg.name»() const { + // TODO needs default value + //if (m_peer == 0) + /* return «msg.data.refType.type.defaultValue»; */ + return m_peer->«msg.name»(); + } + «ENDFOR» + + void «pc.getPortClassName(false)»::connect(DataSendPort* dataSendPort) { + «pc.getPortClassName(true)»* peer = dynamic_cast<«pc.getPortClassName(true)»*>(dataSendPort); + if (peer != 0) + m_peer = peer; + } + ''' + } + override getMessageID(Message msg, InterfaceItem item) { if (item instanceof Port) { var p = item as Port; @@ -436,8 +528,8 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { return "unknown interface item"; } - - def String enumInUse(String namespace, String member) { + + def protected String enumInUse(String namespace, String member) { return namespace+"::"+member } }
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend index f8a84c8ca..de45d9c2c 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend @@ -4,86 +4,85 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) * Peter Karlitschek - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.gen import com.google.inject.Inject import com.google.inject.Singleton -import java.util.ArrayList import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent -import org.eclipse.etrice.core.room.ActorClass import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator import org.eclipse.etrice.generator.generic.RoomExtensions -import org.eclipse.xtext.util.Pair +import org.eclipse.etrice.generator.cpp.Main +import org.eclipse.etrice.core.room.ActorClass -import static org.eclipse.xtext.util.Tuples.* -/** - * @author Peter Karlitschek - * - */ @Singleton class StateMachineGen extends GenericStateMachineGenerator { - + @Inject extension RoomExtensions - @Inject ProtocolClassGen cppProtGen - - override genExtraDecl(ExpandedModelComponent xpac) { -// val ac = xpac.actorClass - ''' - protected: - static std::string s_stateStrings[]; - static const int s_numberOfStates; - - private: - void setState(int new_state); - '''} - - override genExtra(ExpandedModelComponent xpac) { - val ac = xpac.modelComponent as ActorClass - ''' - std::string «ac.name»::s_stateStrings[] = {"<no state>","<top>",«FOR state : ac.getAllBaseStatesLeavesLast() SEPARATOR ","»"«state.genStatePathName»" - «ENDFOR»}; - const int «ac.name»::s_numberOfStates = «ac.getAllBaseStatesLeavesLast().size + 2»; - - void «ac.name»::setState(int new_state) { - DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]); - if (s_stateStrings[new_state]!="Idle") { -««« TODOTS: model switch for activation - std::cout << getInstancePath() << " -> " << s_stateStrings[new_state] << std::endl; - } - m_state = new_state; - } - '''} - - override genTriggerConstants(ExpandedModelComponent xpac) { - val triggers = if (langExt.usesInheritance) - xpac.getOwnTriggers() else xpac.triggers - val list = new ArrayList<Pair<String, String>>() - list.add(pair("POLLING", "0")); - for (mif : triggers) { - list.add(pair(xpac.getTriggerCodeName(mif), "IFITEM_"+mif.from.name+" + EVT_SHIFT*"+cppProtGen.getMessageID(mif))) + override genExtra(ExpandedModelComponent xpac, boolean generateImplementation) { + val states = newArrayList + var ac = xpac.modelComponent + val clsName = xpac.modelComponent.componentName + +// it is crucial that we obey the order that is used for state IDs +// that means we have to collect base classes first and each base class list with leaf states last + while (ac!=null) { + states.addAll(0, ac.allBaseStates.leafStatesLast) + ac = ac.base } - - return langExt.genEnumeration("triggers", list) + if(generateImplementation) + ''' + «IF Main::settings.generateMSCInstrumentation || Main::settings.generateWithVerboseOutput» + // state names + const std::string «clsName»::s_stateStrings[] = { + "<no state>", + "<top>", + «FOR state : states SEPARATOR ","» + "«state.genStatePathName»" + «ENDFOR» + }; + «ENDIF» + const int «clsName»::s_numberOfStates = «2+states.size»; + + void «clsName»::setState(int new_state) { + «IF Main::settings.generateMSCInstrumentation» + DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]); + «ENDIF» + «IF Main::settings.generateWithVerboseOutput» + if (s_stateStrings[new_state] != "Idle") { + std::cout << getInstancePath() << " -> " << s_stateStrings[new_state] << std::endl; + } + «ENDIF» + m_state = new_state; + } + ''' + else + ''' + «IF Main::settings.generateMSCInstrumentation || Main::settings.generateWithVerboseOutput» + static const std::string s_stateStrings[]; + «ENDIF» + static const int s_numberOfStates; + + int history[«2+states.size»]; + + void setState(int new_state); + ''' } - - override constPointer(String classname) { - return "const " + classname + "*" + + override public stateType() { + "etInt16" } - + override boolType() { - return "bool" + "etBool" } - - - } diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend deleted file mode 100644 index c2944db1a..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.xtend +++ /dev/null @@ -1,302 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -package org.eclipse.etrice.generator.cpp.gen - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance -import org.eclipse.etrice.core.genmodel.etricegen.Root -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance -import org.eclipse.etrice.core.room.SubSystemClass -import org.eclipse.etrice.generator.generic.ProcedureHelpers -import org.eclipse.etrice.generator.generic.RoomExtensions -import org.eclipse.xtext.generator.JavaIoFileSystemAccess - -import static extension org.eclipse.etrice.generator.fsm.base.Indexed.* -import org.eclipse.etrice.generator.base.IDataConfiguration - -/** - * @author Peter Karlitschek - * - */ -@Singleton -class SubSystemClassGen { - - @Inject JavaIoFileSystemAccess fileAccess - @Inject extension CppExtensions - @Inject extension RoomExtensions - @Inject extension ProcedureHelpers - @Inject IDataConfiguration dataConfigExt - @Inject ConfigGenAddon configGenAddon - @Inject ConfigGenAddon configAddon - @Inject ILogger logger - - def doGenerate(Root root) { - for (ssi: root.subSystemInstances) { - var path = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath - var file = ssi.subSystemClass.getCppHeaderFileName - logger.logInfo("generating SubSystemClass declaration: '"+file+"' in '"+path+"'") - fileAccess.setOutputPath(path) - fileAccess.generateFile(file, root.generateHeaderFile(ssi, ssi.subSystemClass)) - - file = ssi.subSystemClass.getCppSourceFileName - logger.logInfo("generating SubSystemClass implementation: '"+file+"' in '"+path+"'") - fileAccess.setOutputPath(path) - fileAccess.generateFile(file, root.generateSourceFile(ssi, ssi.subSystemClass)) - -// file = ssi.subSystemClass.getInstSourceFileName -// logger.logInfo("generating SubSystemClass instance file: '"+file+"' in '"+path+"'") -// fileAccess.setOutputPath(path) -// fileAccess.generateFile(file, root.generateInstanceFile(ssi, ssi.subSystemClass)) -// -// file = ssi.subSystemClass.getDispSourceFileName -// logger.logInfo("generating SubSystemClass dispatcher file: '"+file+"' in '"+path+"'") -// fileAccess.setOutputPath(path) -// fileAccess.generateFile(file, root.generateDispatcherFile(ssi, ssi.subSystemClass)) - } - } - - def generateHeaderFile(Root root, SubSystemInstance comp, SubSystemClass cc) {''' - - /** - * @author generated by eTrice - * - * Header File of SubSystemClass «cc.name» - * - */ - - «generateIncludeGuardBegin(cc.name)» - - #include "platforms/generic/etDatatypes.h" - #include "common/messaging/IRTObject.h" - #include "common/modelbase/PortBase.h" - #include "common/modelbase/InterfaceItemBase.h" - #include "common/modelbase/ActorClassBase.h" - #include "common/modelbase/SubSystemClassBase.h" - #include "common/messaging/Address.h" - #include "common/messaging/IMessageReceiver.h" - #include "common/debugging/DebuggingService.h" - #include <string> - #include <vector> - - «FOR model : root.getReferencedModels(cc)» -««« #include "«model.name».h" - «ENDFOR» - - - «cc.userCode(1, false)» - - class «cc.name» : public etRuntime::SubSystemClassBase{ - - «cc.userCode(2, false)» - - public: - «cc.name»(IRTObject* parent, std::string name) - : etRuntime::SubSystemClassBase(parent, name) - { - } - - virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data); - virtual void instantiateMessageServices(); - virtual void instantiateActors(); - - private: - std::vector<etRuntime::MessageService*> m_msgServices; - }; - - «generateIncludeGuardEnd(cc.name)» - ''' - } - - def generateSourceFile(Root root, SubSystemInstance comp, SubSystemClass cc) {''' - - /** - * @author generated by eTrice - * - * Source File of SubsystemClass «cc.name» - * - */ - - #include "«cc.getCppHeaderFileName»" - #include "common/debugging/DebuggingService.h" - #include "common/messaging/RTSystemServicesProtocol.h" - «FOR ai : comp.allContainedInstances» - #include "«ai.actorClass.path»«ai.actorClass.name».h" - «ENDFOR» - #include <iostream> - - using namespace etRuntime; - - void «cc.name»::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data){ - } - - void «cc.name»::instantiateMessageServices(){ - - m_msgServices.push_back( new MessageService(this, Address(0, 0, 0),"MessageService_Main") ); - «FOR thread : cc.threads» - m_msgServices.push_back(new MessageService(this, Address(0, «cc.threads.indexOf(thread)+1», 0),"MessageService_«thread.name»", /* threadprio */ 0)); - «ENDFOR» - for (std::vector<MessageService*>::iterator it=m_msgServices.begin(); it != m_msgServices.end(); ++it) { - RTServices::getInstance().getMsgSvcCtrl().addMsgSvc( *(*it)); - } - } - - void «cc.name»::instantiateActors(){ - // all addresses - // Addresses for the Subsystem Systemport - «FOR ai : comp.allContainedInstances.indexed(comp.maxObjId)» - Address addr_item_SystemPort_«comp.allContainedInstances.indexOf(ai.value)»(0,0,«ai.index1»); - «ENDFOR» - - «FOR ai : comp.allContainedInstances» - // actor instance «ai.path» itself => Systemport Address - // TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport) - Address addr_item_«ai.path.getPathName()»(0,«ai.threadId»,«ai.objId»); - // interface items of «ai.path» - «FOR pi : ai.orderedIfItemInstances» - «IF pi.replicated» - «FOR peer : pi.peers» - «var i = pi.peers.indexOf(peer)» - Address addr_item_«pi.path.getPathName()»_«i»(0,«pi.threadId»,«pi.objId+i»); - «ENDFOR» - «ELSE» - Address addr_item_«pi.path.getPathName()»(0,«ai.threadId»,«pi.objId»); - «ENDIF» - «ENDFOR» - «ENDFOR» - - // instantiate all actor instances - m_instances.reserve(«comp.allContainedInstances.size»); - «FOR ai : comp.allContainedInstances» - //---------------------------------------------------------------------------------------------- - // addresses for actor instance: «ai.name» - //---------------------------------------------------------------------------------------------- - «generateOwnInterfaceItemAddresses(ai)» - «generatePeerInterfaceItemAddresses(ai, comp)» - - m_instances[«comp.allContainedInstances.indexOf(ai)»] = new «ai.actorClass.name»( - «IF ai.eContainer instanceof SubSystemInstance» - this, - «ELSE» - m_instances[«comp.allContainedInstances.indexOf(ai.eContainer)»], - «ENDIF» - "«ai.name»", - «ai.name»_ownInterfaceItemAddresses, - «ai.name»_peerInterfaceItemAddresses - ); - «ENDFOR» - -««« // apply instance attribute configurations -««« «FOR ai : comp.allContainedInstances» -««« «IF !(ai.configAttributes.empty && ai.getConfigPorts.empty)» -««« { -««« «ai.actorClass.name» inst = («ai.actorClass.name») instances[«comp.allContainedInstances.indexOf(ai)»]; -««« «configAddon.applyInstanceConfig("inst", ai.actorClass.name, ai.configAttributes)» -««« «FOR portConfig : ai.configPorts» -««« «configAddon.applyInstanceConfig(("inst."+portConfig.item.name.invokeGetter(ai.actorClass.name)), portConfig.item.portClassName, portConfig.attributes)» -««« «ENDFOR» -««« } -««« «ENDIF» -««« «ENDFOR» - - // apply instance attribute configurations - «FOR ai: comp.allContainedInstances» - «val cfg = configGenAddon.genActorInstanceConfig(ai, "inst")» - «IF cfg.length>0» - { - «ai.actorClass.name» inst = («ai.actorClass.name») instances[«comp.allContainedInstances.indexOf(ai)»]; - «cfg» - } - «ENDIF» - «ENDFOR» - - //---------------------------------------------------------------------------------------------- - // addresses for the subsystem system port - //---------------------------------------------------------------------------------------------- - - std::vector<Address> ownAddresses(«comp.allContainedInstances.size»); - «FOR ai : comp.allContainedInstances» - ownAddresses[«comp.allContainedInstances.indexOf(ai)»] = addr_item_SystemPort_«comp.allContainedInstances.indexOf(ai)»; - «ENDFOR» - std::vector<Address> peerAddresses(«comp.allContainedInstances.size»); - «FOR ai : comp.allContainedInstances» - peerAddresses[«comp.allContainedInstances.indexOf(ai)»] = addr_item_«ai.path.getPathName()»; - «ENDFOR» - - - // create the subsystem system port - m_RTSystemPort = new RTSystemServicesProtocolConjPortRepl(*this, this, "RTSystemPort", - 0, //local ID - ownAddresses, - peerAddresses); - - } - - - ''' - } - def generateOwnInterfaceItemAddresses(ActorInstance ai) ''' - std::vector<std::vector<Address> > «ai.name»_ownInterfaceItemAddresses; - - std::vector<Address> «ai.name»_actorInstanceAddresses(1); - «ai.name»_actorInstanceAddresses[0] = addr_item_«ai.path.getPathName()»; - - «ai.name»_ownInterfaceItemAddresses.push_back(«ai.name»_actorInstanceAddresses); - «FOR pi : ai.orderedIfItemInstances» - «IF pi.replicated» - «IF pi.peers.empty» - std::vector<Address> «ai.name»_«pi.name»Addresses; - «ELSE» - std::vector<Address> «ai.name»_«pi.name»Addresses(«pi.peers.size»); - «FOR peer : pi.peers» - «ai.name»_«pi.name»Addresses[«pi.peers.indexOf(peer)»] = addr_item_«pi.path.getPathName()»_«pi.peers.indexOf(peer)»; - «ENDFOR» - «ENDIF» - «ELSE» - std::vector<Address> «ai.name»_«pi.name»Addresses(1); - «ai.name»_«pi.name»Addresses[0] = addr_item_«pi.path.getPathName()»; - «ENDIF» - «ai.name»_ownInterfaceItemAddresses.push_back(«ai.name»_«pi.name»Addresses); - - «ENDFOR» - ''' - - def generatePeerInterfaceItemAddresses(ActorInstance ai, SubSystemInstance comp) ''' - std::vector<std::vector<Address> > «ai.name»_peerInterfaceItemAddresses; - - std::vector<Address> «ai.name»_systemPortAddresses(1); - «ai.name»_systemPortAddresses[0] = addr_item_SystemPort_«comp.allContainedInstances.indexOf(ai)»; - - «ai.name»_peerInterfaceItemAddresses.push_back(«ai.name»_systemPortAddresses); - «FOR pi : ai.orderedIfItemInstances » - «IF pi.replicated && pi.peers.isEmpty» - «ELSE» - «IF pi.peers.empty» - std::vector<Address> «ai.name»_«pi.name»PeerAddresses; - «ELSE» - std::vector<Address> «ai.name»_«pi.name»PeerAddresses(«pi.peers.size»); - «FOR pp : pi.peers» - «IF pp.replicated» - «ai.name»_«pi.name»PeerAddresses[«pi.peers.indexOf(pp)»] = addr_item_«pp.path.getPathName()»_«pp.peers.indexOf(pi)»; - «ELSE» - «ai.name»_«pi.name»PeerAddresses[«pi.peers.indexOf(pp)»] = addr_item_«pp.path.getPathName()»; - «ENDIF» - «ENDFOR» - «ENDIF» - «ai.name»_peerInterfaceItemAddresses.push_back(«ai.name»_«pi.name»PeerAddresses); - «ENDIF» - «ENDFOR» - ''' - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend deleted file mode 100644 index 18f9c60a7..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.xtend +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ -package org.eclipse.etrice.generator.cpp.gen - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.etrice.core.room.SubSystemClass -import org.eclipse.etrice.core.genmodel.etricegen.Root -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance -import org.eclipse.xtext.generator.JavaIoFileSystemAccess -import org.eclipse.etrice.generator.generic.RoomExtensions - -/** - * @author Peter Karlitschek - * - */ -@Singleton -class SubSystemRunnerGen { - - @Inject extension JavaIoFileSystemAccess fileAccess - @Inject extension CppExtensions - @Inject extension RoomExtensions roomExt - - def doGenerate(Root root) { - for (sc: root.subSystemInstances) { - fileAccess.setOutputPath(sc.subSystemClass.generationTargetPath+sc.subSystemClass.getPath) - fileAccess.generateFile( sc.subSystemClass.name+"_Runner.h", root.generateHeaderFile(sc, sc.subSystemClass)) - - fileAccess.setOutputPath(sc.subSystemClass.generationTargetPath+sc.subSystemClass.getPath) - fileAccess.generateFile( sc.subSystemClass.name+"_Runner.cpp", root.generateSourceFile(sc, sc.subSystemClass)) - } - } - - def generateHeaderFile(Root root, SubSystemInstance ssc, SubSystemClass cc) {''' - /** - * @author generated by eTrice - * - * this class contains the main function running component «cc.name» - * it instantiates «cc.name» and starts and ends the lifecycle - */ - - «generateIncludeGuardBegin(cc.name+"_Runner")» - - #include "common/modelbase/SubSystemRunnerBase.h" - - class «cc.name+"Runner"» :public etRuntime::SubSystemRunnerBase { - - }; - - «generateIncludeGuardEnd(cc.name+"_Runner")» - ''' - } - - def generateSourceFile(Root root, SubSystemInstance ssi, SubSystemClass ssc) {''' - /** - * @author generated by eTrice - * - * this class contains the main function running component «ssc.name» - * it instantiates «ssc.name» and starts and ends the lifecycle - */ - - - #include "«ssc.name».h" - #include "«ssc.name»_Runner.h" - - #include <iostream> - - - /** - * main function - * creates component and starts and stops the lifecycle - */ - - - int main(int argc, char* argv[]) { - «ssc.name» mainComponent(0, "«ssc.name»"); - «ssc.name+"Runner"»::run(mainComponent, argc, argv); - return 0; - } - - - ''' - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java index f286a7157..2c92ef8ca 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java +++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.cpp.setup; @@ -15,13 +15,15 @@ package org.eclipse.etrice.generator.cpp.setup; import org.eclipse.etrice.core.common.scoping.ModelLocatorUriResolver; import org.eclipse.etrice.generator.base.AbstractGenerator; import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule; -import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; import org.eclipse.etrice.generator.base.IDataConfiguration; import org.eclipse.etrice.generator.base.ITranslationProvider; import org.eclipse.etrice.generator.cpp.Main; +import org.eclipse.etrice.generator.cpp.gen.ActorClassGen; import org.eclipse.etrice.generator.cpp.gen.CppExtensions; import org.eclipse.etrice.generator.cpp.gen.CppTranslationProvider; -import org.eclipse.etrice.generator.cpp.gen.GeneratorSettings; +import org.eclipse.etrice.generator.cpp.gen.ProtocolClassGen; +import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; +import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator; import org.eclipse.etrice.generator.generic.ILanguageExtension; import org.eclipse.xtext.scoping.impl.ImportUriResolver; @@ -32,12 +34,12 @@ public class GeneratorModule extends AbstractGeneratorBaseModule { // @Override public void configure(Binder binder) { super.configure(binder); - + binder.bind(AbstractGenerator.class).to(Main.class); + binder.bind(GenericProtocolClassGenerator.class).to(ProtocolClassGen.class); + binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class); binder.bind(ImportUriResolver.class).to(ModelLocatorUriResolver.class); - - binder.bind(GlobalGeneratorSettings.class).to(GeneratorSettings.class); } public Class<? extends ILanguageExtension> bindILanguageExtension() { 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 9f4550dec..5ffc61237 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 @@ -11,48 +11,55 @@ package org.eclipse.etrice.generator.cpp.gen; import com.google.common.base.Objects; +import com.google.common.collect.Iterables; import com.google.inject.Inject; import com.google.inject.Singleton; import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.eclipse.emf.common.util.EList; import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType; +import org.eclipse.etrice.core.fsm.fSM.StateGraph; +import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants; 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; +import org.eclipse.etrice.core.genmodel.etricegen.Wire; +import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass; +import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; import org.eclipse.etrice.core.room.ActorClass; +import org.eclipse.etrice.core.room.ActorRef; import org.eclipse.etrice.core.room.Attribute; import org.eclipse.etrice.core.room.DataClass; import org.eclipse.etrice.core.room.Port; import org.eclipse.etrice.core.room.ProtocolClass; -import org.eclipse.etrice.core.room.RoomModel; 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.GlobalGeneratorSettings; import org.eclipse.etrice.generator.cpp.Main; import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.GeneratorSettings; import org.eclipse.etrice.generator.cpp.gen.Initialization; import org.eclipse.etrice.generator.cpp.gen.StateMachineGen; +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; import org.eclipse.etrice.generator.generic.ProcedureHelpers; import org.eclipse.etrice.generator.generic.RoomExtensions; +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.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.ListExtensions; +import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; -/** - * @author Peter Karlitschek - */ @Singleton @SuppressWarnings("all") public class ActorClassGen extends GenericActorClassGenerator { @Inject - private JavaIoFileSystemAccess fileAccess; + private IGeneratorFileIo fileIO; @Inject @Extension @@ -64,547 +71,506 @@ public class ActorClassGen extends GenericActorClassGenerator { @Inject @Extension - private Initialization _initialization; + private ProcedureHelpers _procedureHelpers; @Inject @Extension - private ProcedureHelpers _procedureHelpers; + private Initialization _initialization; @Inject @Extension private StateMachineGen _stateMachineGen; @Inject - private ILogger logger; + @Extension + private TypeHelpers _typeHelpers; + + @Inject + @Extension + private FileSystemHelpers _fileSystemHelpers; public void doGenerate(final Root root) { + final Map<ActorClass, WiredActorClass> ac2wired = CollectionLiterals.<ActorClass, WiredActorClass>newHashMap(); + EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); + Iterable<WiredActorClass> _filter = Iterables.<WiredActorClass>filter(_wiredInstances, WiredActorClass.class); + final Procedure1<WiredActorClass> _function = new Procedure1<WiredActorClass>() { + public void apply(final WiredActorClass it) { + ActorClass _actorClass = it.getActorClass(); + ac2wired.put(_actorClass, it); + } + }; + IterableExtensions.<WiredActorClass>forEach(_filter, _function); EList<ExpandedActorClass> _xpActorClasses = root.getXpActorClasses(); - for (final ExpandedActorClass xpac : _xpActorClasses) { + final Function1<ExpandedActorClass, Boolean> _function_1 = new Function1<ExpandedActorClass, Boolean>() { + public Boolean apply(final ExpandedActorClass cl) { + ActorClass _actorClass = cl.getActorClass(); + return Boolean.valueOf(ActorClassGen.this._fileSystemHelpers.isValidGenerationLocation(_actorClass)); + } + }; + Iterable<ExpandedActorClass> _filter_1 = IterableExtensions.<ExpandedActorClass>filter(_xpActorClasses, _function_1); + for (final ExpandedActorClass xpac : _filter_1) { { ActorClass _actorClass = xpac.getActorClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass); + final WiredActorClass wired = ac2wired.get(_actorClass); ActorClass _actorClass_1 = xpac.getActorClass(); - String _path = this._roomExtensions.getPath(_actorClass_1); - String path = (_generationTargetPath + _path); + final boolean manualBehavior = this._roomHelpers.isBehaviorAnnotationPresent(_actorClass_1, "BehaviorManual"); ActorClass _actorClass_2 = xpac.getActorClass(); - String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(_actorClass_2); - String _plus = ("generating ActorClass header \'" + _cppHeaderFileName); - String _plus_1 = (_plus + "\' in \'"); - String _plus_2 = (_plus_1 + path); - String _plus_3 = (_plus_2 + "\'"); - this.logger.logInfo(_plus_3); - this.fileAccess.setOutputPath(path); + String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_actorClass_2); ActorClass _actorClass_3 = xpac.getActorClass(); - String _cppHeaderFileName_1 = this._cppExtensions.getCppHeaderFileName(_actorClass_3); + String _path = this._roomExtensions.getPath(_actorClass_3); + final String path = (_generationTargetPath + _path); ActorClass _actorClass_4 = xpac.getActorClass(); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, xpac, _actorClass_4); - this.fileAccess.generateFile(_cppHeaderFileName_1, _generateHeaderFile); + String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_actorClass_4); ActorClass _actorClass_5 = xpac.getActorClass(); - String _cppSourceFileName = this._cppExtensions.getCppSourceFileName(_actorClass_5); - String _plus_4 = ("generating ActorClass source \'" + _cppSourceFileName); - String _plus_5 = (_plus_4 + "\' in \'"); - String _plus_6 = (_plus_5 + path); - String _plus_7 = (_plus_6 + "\'"); - this.logger.logInfo(_plus_7); - this.fileAccess.setOutputPath(path); + String _path_1 = this._roomExtensions.getPath(_actorClass_5); + final String infopath = (_generationInfoPath + _path_1); + String _xifexpression = null; + if (manualBehavior) { + _xifexpression = "Abstract"; + } else { + _xifexpression = ""; + } + String file = _xifexpression; ActorClass _actorClass_6 = xpac.getActorClass(); - String _cppSourceFileName_1 = this._cppExtensions.getCppSourceFileName(_actorClass_6); + String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(_actorClass_6); + String _plus = (file + _cppHeaderFileName); + CharSequence _generateHeaderFile = this.generateHeaderFile(root, xpac, wired, manualBehavior); + this.fileIO.generateFile("generating ActorClass declaration", path, infopath, _plus, _generateHeaderFile); ActorClass _actorClass_7 = xpac.getActorClass(); - CharSequence _generateSourceFile = this.generateSourceFile(root, xpac, _actorClass_7); - this.fileAccess.generateFile(_cppSourceFileName_1, _generateSourceFile); + String _cppSourceFileName = this._cppExtensions.getCppSourceFileName(_actorClass_7); + String _plus_1 = (file + _cppSourceFileName); + CharSequence _generateSourceFile = this.generateSourceFile(root, xpac, wired, manualBehavior); + this.fileIO.generateFile("generating ActorClass implementation", path, infopath, _plus_1, _generateSourceFile); } } } - private CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac, final ActorClass ac) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @author generated by eTrice"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* Header File of ActorClass "); - String _name = ac.getName(); - _builder.append(_name, "\t "); - _builder.newLineIfNotEmpty(); - _builder.append("\t "); - _builder.append("* "); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - String _name_1 = ac.getName(); - CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(_name_1); - _builder.append(_generateIncludeGuardBegin, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"platforms/generic/etDatatypes.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/IRTObject.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/PortBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/ActorClassBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/SubSystemClassBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/Address.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/IMessageReceiver.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); + private CharSequence generateHeaderFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) { + CharSequence _xblockexpression = null; { - GeneratorSettings _settings = Main.getSettings(); - boolean _isUseEtUnit = _settings.isUseEtUnit(); - if (_isUseEtUnit) { - _builder.append("\t"); - _builder.append("extern \"C\" {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("#include \"etUnit.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); + final ActorClass ac = xpac.getActorClass(); + String _xifexpression = null; + if (manualBehavior) { + String _name = ac.getName(); + _xifexpression = ("Abstract" + _name); + } else { + _xifexpression = ac.getName(); } - } - _builder.append("\t"); - _builder.append("#include <string>"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include <vector>"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - { - EList<RoomModel> _referencedModels = root.getReferencedModels(ac); - for(final RoomModel model : _referencedModels) { + final String clsname = _xifexpression; + String _elvis = null; + ActorClass _actorBase = ac.getActorBase(); + String _name_1 = null; + if (_actorBase!=null) { + _name_1=_actorBase.getName(); } - } - _builder.append("\t"); - _builder.newLine(); - { - EList<ProtocolClass> _referencedProtocolClasses = root.getReferencedProtocolClasses(ac); - for(final ProtocolClass pc : _referencedProtocolClasses) { - _builder.append("\t"); - _builder.append("#include \""); - String _path = this._roomExtensions.getPath(pc); - _builder.append(_path, "\t"); - String _name_2 = pc.getName(); - _builder.append(_name_2, "\t"); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); + if (_name_1 != null) { + _elvis = _name_1; + } else { + _elvis = "etRuntime::ActorClassBase"; } - } - { - EList<DataClass> _referencedDataClasses = root.getReferencedDataClasses(ac); - for(final DataClass dc : _referencedDataClasses) { - _builder.append("\t"); - _builder.append("#include \""); - String _path_1 = this._roomExtensions.getPath(dc); - _builder.append(_path_1, "\t"); - String _name_3 = dc.getName(); - _builder.append(_name_3, "\t"); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); + final String rtBaseClassName = _elvis; + 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("* Header File of ActorClass "); + _builder.append(clsname, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(clsname); + _builder.append(_generateIncludeGuardBegin, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("#include \"etDatatypes.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/IRTObject.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/PortBase.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/ActorClassBase.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/SubSystemClassBase.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/Address.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/IMessageReceiver.h\""); + _builder.newLine(); + _builder.append("#include \"common/debugging/DebuggingService.h\""); + _builder.newLine(); + _builder.append("#include <string>"); + _builder.newLine(); + _builder.append("#include <vector>"); + _builder.newLine(); + _builder.newLine(); + { + EList<ProtocolClass> _referencedProtocolClasses = root.getReferencedProtocolClasses(ac); + for(final ProtocolClass pc : _referencedProtocolClasses) { + _builder.append("#include \""); + String _path = this._roomExtensions.getPath(pc); + _builder.append(_path, ""); + String _name_2 = pc.getName(); + _builder.append(_name_2, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); + } } - } - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode = this._procedureHelpers.userCode(ac, 1, true); - _builder.append(_userCode, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("class "); - String _name_4 = ac.getName(); - _builder.append(_name_4, "\t"); - _builder.append(" : public "); - { - ActorClass _actorBase = ac.getActorBase(); - boolean _notEquals = (!Objects.equal(_actorBase, null)); - if (_notEquals) { - ActorClass _actorBase_1 = ac.getActorBase(); - String _name_5 = _actorBase_1.getName(); - _builder.append(_name_5, "\t"); - } else { - _builder.append("etRuntime::ActorClassBase"); + { + EList<DataClass> _referencedDataClasses = root.getReferencedDataClasses(ac); + for(final DataClass dc : _referencedDataClasses) { + _builder.append("#include \""); + String _path_1 = this._roomExtensions.getPath(dc); + _builder.append(_path_1, ""); + String _name_3 = dc.getName(); + _builder.append(_name_3, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); + } } - } - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("protected:"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("//--------------------- ports"); - _builder.newLine(); - _builder.append("\t\t\t"); - List<Port> _endPorts = this._roomHelpers.getEndPorts(ac); - final Function1<Port, String> _function = new Function1<Port, String>() { - public String apply(final Port port) { - StringConcatenation _builder = new StringConcatenation(); - String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(port); - _builder.append(_portClassName, ""); - _builder.append(" "); - String _name = port.getName(); - _builder.append(_name, ""); - _builder.append(";"); - return _builder.toString(); + _builder.newLine(); + _builder.append("using namespace etRuntime; //TODO JH remove"); + _builder.newLine(); + _builder.newLine(); + CharSequence _userCode = this._procedureHelpers.userCode(ac, 1, true); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("class "); + _builder.append(clsname, ""); + _builder.append(" : public "); + _builder.append(rtBaseClassName, ""); + _builder.append(" {"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("protected:"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- ports"); + _builder.newLine(); + { + List<Port> _endPorts = this._roomHelpers.getEndPorts(ac); + for(final Port ep : _endPorts) { + _builder.append("\t\t"); + String _portClassName = this._roomExtensions.getPortClassName(ep); + _builder.append(_portClassName, "\t\t"); + _builder.append(" "); + String _name_4 = ep.getName(); + _builder.append(_name_4, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + } } - }; - List<String> _map = ListExtensions.<Port, String>map(_endPorts, _function); - String _join = IterableExtensions.join(_map, "\n"); - _builder.append(_join, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("//--------------------- saps"); - _builder.newLine(); - _builder.append("\t\t\t"); - EList<SAP> _serviceAccessPoints = ac.getServiceAccessPoints(); - final Function1<SAP, String> _function_1 = new Function1<SAP, String>() { - public String apply(final SAP sap) { - StringConcatenation _builder = new StringConcatenation(); - String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(sap); - _builder.append(_portClassName, ""); - _builder.append(" "); - String _name = sap.getName(); - _builder.append(_name, ""); - _builder.append(";"); - return _builder.toString(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- saps"); + _builder.newLine(); + { + EList<SAP> _serviceAccessPoints = ac.getServiceAccessPoints(); + for(final SAP sap : _serviceAccessPoints) { + _builder.append("\t\t"); + String _portClassName_1 = this._roomExtensions.getPortClassName(sap); + _builder.append(_portClassName_1, "\t\t"); + _builder.append(" "); + String _name_5 = sap.getName(); + _builder.append(_name_5, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + } } - }; - List<String> _map_1 = ListExtensions.<SAP, String>map(_serviceAccessPoints, _function_1); - String _join_1 = IterableExtensions.join(_map_1, "\n"); - _builder.append(_join_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t"); - _builder.append("//--------------------- services"); - _builder.newLine(); - _builder.append("\t\t\t"); - EList<ServiceImplementation> _serviceImplementations = ac.getServiceImplementations(); - final Function1<ServiceImplementation, String> _function_2 = new Function1<ServiceImplementation, String>() { - public String apply(final ServiceImplementation svc) { - StringConcatenation _builder = new StringConcatenation(); - String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(svc); - _builder.append(_portClassName, ""); - _builder.append(" "); - SPP _spp = svc.getSpp(); - String _name = _spp.getName(); - _builder.append(_name, ""); - _builder.append(";"); - return _builder.toString(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- services"); + _builder.newLine(); + { + EList<ServiceImplementation> _serviceImplementations = ac.getServiceImplementations(); + for(final ServiceImplementation svc : _serviceImplementations) { + _builder.append("\t\t"); + String _portClassName_2 = this._roomExtensions.getPortClassName(svc); + _builder.append(_portClassName_2, "\t\t"); + _builder.append(" "); + SPP _spp = svc.getSpp(); + String _name_6 = _spp.getName(); + _builder.append(_name_6, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + } } - }; - List<String> _map_2 = ListExtensions.<ServiceImplementation, String>map(_serviceImplementations, _function_2); - String _join_2 = IterableExtensions.join(_map_2, "\n"); - _builder.append(_join_2, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("//--------------------- interface item IDs"); - _builder.newLine(); - _builder.append("\t\t\t"); - String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac); - _builder.append(_genInterfaceItemConstants, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t"); - _builder.newLine(); - _builder.append("\t\t\t"); - EList<Attribute> _attributes = ac.getAttributes(); - CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); - _builder.append(_attributes_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t\t\t"); - 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"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("//--------------------- construction"); - _builder.newLine(); - _builder.append("\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 "); - _builder.append("const std::vector<std::vector<etRuntime::Address> >& peer_addr);"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("//--------------------- port getters"); - _builder.newLine(); - { + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- interface item IDs"); + _builder.newLine(); + _builder.append("\t\t"); + String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac); + _builder.append(_genInterfaceItemConstants, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + EList<Attribute> _attributes = ac.getAttributes(); + CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); + _builder.append(_attributes_1, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + EList<StandardOperation> _operations = ac.getOperations(); + String _name_7 = ac.getName(); + CharSequence _operationsDeclaration = this._procedureHelpers.operationsDeclaration(_operations, _name_7); + _builder.append(_operationsDeclaration, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("public:"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- construction"); + _builder.newLine(); + _builder.append("\t\t"); + String _name_8 = ac.getName(); + _builder.append(_name_8, "\t\t"); + _builder.append("(etRuntime::IRTObject* parent, const std::string& name);"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- port getters"); + _builder.newLine(); + _builder.append("\t\t"); List<Port> _endPorts_1 = this._roomHelpers.getEndPorts(ac); - for(final Port ep : _endPorts_1) { - _builder.append("\t\t"); - String _portClassName = this._roomExtensions.getPortClassName(ep); - 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(); - } - } - { + final Function1<Port, CharSequence> _function = new Function1<Port, CharSequence>() { + public CharSequence apply(final Port it) { + String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(it); + String _plus = (_portClassName + "&"); + String _name = it.getName(); + return ActorClassGen.this._procedureHelpers.getterImplementation(_plus, _name, clsname); + } + }; + List<CharSequence> _map = ListExtensions.<Port, CharSequence>map(_endPorts_1, _function); + String _join = IterableExtensions.join(_map, this._roomExtensions.NEWLINE); + _builder.append(_join, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); EList<SAP> _serviceAccessPoints_1 = ac.getServiceAccessPoints(); - for(final SAP sap : _serviceAccessPoints_1) { - _builder.append("\t\t"); - String _portClassName_1 = this._roomExtensions.getPortClassName(sap); - 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(); - } - } - { + final Function1<SAP, CharSequence> _function_1 = new Function1<SAP, CharSequence>() { + public CharSequence apply(final SAP it) { + String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(it); + String _plus = (_portClassName + "&"); + String _name = it.getName(); + return ActorClassGen.this._procedureHelpers.getterImplementation(_plus, _name, clsname); + } + }; + List<CharSequence> _map_1 = ListExtensions.<SAP, CharSequence>map(_serviceAccessPoints_1, _function_1); + String _join_1 = IterableExtensions.join(_map_1, this._roomExtensions.NEWLINE); + _builder.append(_join_1, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); EList<ServiceImplementation> _serviceImplementations_1 = ac.getServiceImplementations(); - for(final ServiceImplementation svc : _serviceImplementations_1) { - _builder.append("\t\t"); - String _portClassName_2 = this._roomExtensions.getPortClassName(svc); - SPP _spp = svc.getSpp(); - 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(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//--------------------- lifecycle functions"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("virtual void init();"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("virtual void start();"); - _builder.newLine(); - { - boolean _overridesStop = this._roomExtensions.overridesStop(ac); - boolean _not = (!_overridesStop); - if (_not) { - _builder.append("\t\t"); - _builder.append("virtual void stop();"); - _builder.newLine(); - } - } - _builder.append("\t\t\t"); - _builder.append("virtual void destroy();\t\t\t"); - _builder.newLine(); - { - boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); - if (_hasNonEmptyStateMachine) { - _builder.append("\t\t"); - CharSequence _genStateMachineMethodDeclarations = this._stateMachineGen.genStateMachineMethodDeclarations(xpac); - _builder.append(_genStateMachineMethodDeclarations, "\t\t"); - _builder.newLineIfNotEmpty(); - } else { - boolean _hasStateMachine = xpac.hasStateMachine(); - boolean _not_1 = (!_hasStateMachine); - if (_not_1) { - _builder.append("\t\t"); - _builder.append("public: "); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("//--------------------- no state machine"); - _builder.newLine(); + final Function1<ServiceImplementation, CharSequence> _function_2 = new Function1<ServiceImplementation, CharSequence>() { + public CharSequence apply(final ServiceImplementation it) { + String _portClassName = ActorClassGen.this._roomExtensions.getPortClassName(it); + String _plus = (_portClassName + "&"); + SPP _spp = it.getSpp(); + String _name = _spp.getName(); + return ActorClassGen.this._procedureHelpers.getterImplementation(_plus, _name, clsname); + } + }; + List<CharSequence> _map_2 = ListExtensions.<ServiceImplementation, CharSequence>map(_serviceImplementations_1, _function_2); + String _join_2 = IterableExtensions.join(_map_2, this._roomExtensions.NEWLINE); + _builder.append(_join_2, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("//--------------------- lifecycle functions"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void destroy();"); + _builder.newLine(); + _builder.newLine(); + { + boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); + if (_hasNonEmptyStateMachine) { _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);"); + CharSequence _genStateMachineConstants = this._stateMachineGen.genStateMachineConstants(xpac); + _builder.append(_genStateMachineConstants, "\t\t"); + _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("virtual void executeInitTransition();"); - _builder.newLine(); + CharSequence _genStateMachineMethods = this._stateMachineGen.genStateMachineMethods(xpac, false); + _builder.append(_genStateMachineMethods, "\t\t"); + _builder.newLineIfNotEmpty(); + { + ComponentCommunicationType _commType = ac.getCommType(); + boolean _equals = Objects.equal(_commType, ComponentCommunicationType.DATA_DRIVEN); + if (_equals) { + _builder.append("\t\t"); + _builder.append("void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* generic_data);"); + _builder.newLine(); + } + } + { + boolean _or = false; + ComponentCommunicationType _commType_1 = ac.getCommType(); + boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals_1) { + _or = true; + } else { + ComponentCommunicationType _commType_2 = ac.getCommType(); + boolean _equals_2 = Objects.equal(_commType_2, ComponentCommunicationType.DATA_DRIVEN); + _or = _equals_2; + } + if (_or) { + _builder.append("\t\t"); + _builder.append("virtual void receive(const etRuntime::Message* msg);"); + _builder.newLine(); + } + } + } else { + StateGraph _stateMachine = xpac.getStateMachine(); + boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); + if (_isEmpty) { + _builder.append("\t\t"); + _builder.append("//--------------------- no state machine"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void executeInitTransition() {}"); + _builder.newLine(); + } } } + _builder.newLine(); + _builder.append("\t\t"); + CharSequence _userCode_1 = this._procedureHelpers.userCode(ac, 2, false); + _builder.append(_userCode_1, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + _builder.newLine(); + String _name_9 = ac.getName(); + CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_name_9); + _builder.append(_generateIncludeGuardEnd, ""); + _builder.newLineIfNotEmpty(); + _xblockexpression = _builder; } - _builder.newLine(); - _builder.append("\t\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(ac, 2, false); - _builder.append(_userCode_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("};"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - String _name_14 = ac.getName(); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_name_14); - _builder.append(_generateIncludeGuardEnd, "\t"); - _builder.newLineIfNotEmpty(); - return _builder; + return _xblockexpression; } private String generateConstructorInitalizerList(final ActorClass ac) { - ArrayList<CharSequence> initializerList = new ArrayList<CharSequence>(); - ActorClass _actorBase = ac.getActorBase(); - boolean _equals = Objects.equal(_actorBase, null); - if (_equals) { + String _xblockexpression = null; + { + ArrayList<CharSequence> initializerList = new ArrayList<CharSequence>(); StringConcatenation _builder = new StringConcatenation(); - _builder.append("ActorClassBase( parent, name, port_addr[0][0], peer_addr[0][0])"); + String _elvis = null; + ActorClass _actorBase = ac.getActorBase(); + String _name = null; + if (_actorBase!=null) { + _name=_actorBase.getName(); + } + if (_name != null) { + _elvis = _name; + } else { + _elvis = "ActorClassBase"; + } + _builder.append(_elvis, ""); + _builder.append("(parent, name)"); initializerList.add(_builder); - } else { - StringConcatenation _builder_1 = new StringConcatenation(); - ActorClass _actorBase_1 = ac.getActorBase(); - String _name = _actorBase_1.getName(); - _builder_1.append(_name, ""); - _builder_1.append("(*this, parent, name, port_addr, peer_addr)"); - initializerList.add(_builder_1); - } - List<Port> _endPorts = this._roomHelpers.getEndPorts(ac); - for (final Port ep : _endPorts) { - StringConcatenation _builder_2 = new StringConcatenation(); - String _name_1 = ep.getName(); - _builder_2.append(_name_1, ""); - _builder_2.append("(*this, this, \""); - String _name_2 = ep.getName(); - _builder_2.append(_name_2, ""); - _builder_2.append("\", IFITEM_"); - String _name_3 = ep.getName(); - _builder_2.append(_name_3, ""); - _builder_2.append(", "); - { - int _multiplicity = ep.getMultiplicity(); - boolean _equals_1 = (_multiplicity == 1); - if (_equals_1) { - _builder_2.append("0, "); - } + List<Port> _endPorts = this._roomHelpers.getEndPorts(ac); + for (final Port ep : _endPorts) { + StringConcatenation _builder_1 = new StringConcatenation(); + String _name_1 = ep.getName(); + _builder_1.append(_name_1, ""); + _builder_1.append("(this, \""); + String _name_2 = ep.getName(); + _builder_1.append(_name_2, ""); + _builder_1.append("\", IFITEM_"); + String _name_3 = ep.getName(); + _builder_1.append(_name_3, ""); + _builder_1.append(")"); + initializerList.add(_builder_1); } - _builder_2.append("port_addr[IFITEM_"); - String _name_4 = ep.getName(); - _builder_2.append(_name_4, ""); - _builder_2.append("]"); - { - int _multiplicity_1 = ep.getMultiplicity(); - boolean _equals_2 = (_multiplicity_1 == 1); - if (_equals_2) { - _builder_2.append("[0]"); - } + EList<SAP> _serviceAccessPoints = ac.getServiceAccessPoints(); + for (final SAP sap : _serviceAccessPoints) { + StringConcatenation _builder_2 = new StringConcatenation(); + String _name_4 = sap.getName(); + _builder_2.append(_name_4, ""); + _builder_2.append("(this, \""); + String _name_5 = sap.getName(); + _builder_2.append(_name_5, ""); + _builder_2.append("\", IFITEM_"); + String _name_6 = sap.getName(); + _builder_2.append(_name_6, ""); + _builder_2.append(")"); + initializerList.add(_builder_2); } - _builder_2.append(", peer_addr[IFITEM_"); - String _name_5 = ep.getName(); - _builder_2.append(_name_5, ""); - _builder_2.append("]"); - { - int _multiplicity_2 = ep.getMultiplicity(); - boolean _equals_3 = (_multiplicity_2 == 1); - if (_equals_3) { - _builder_2.append("[0]"); - } + EList<ServiceImplementation> _serviceImplementations = ac.getServiceImplementations(); + for (final ServiceImplementation svc : _serviceImplementations) { + StringConcatenation _builder_3 = new StringConcatenation(); + SPP _spp = svc.getSpp(); + String _name_7 = _spp.getName(); + _builder_3.append(_name_7, ""); + _builder_3.append("(this, \""); + SPP _spp_1 = svc.getSpp(); + String _name_8 = _spp_1.getName(); + _builder_3.append(_name_8, ""); + _builder_3.append("\", IFITEM_"); + SPP _spp_2 = svc.getSpp(); + String _name_9 = _spp_2.getName(); + _builder_3.append(_name_9, ""); + _builder_3.append(")"); + initializerList.add(_builder_3); } - _builder_2.append(")"); - initializerList.add(_builder_2); - } - EList<SAP> _serviceAccessPoints = ac.getServiceAccessPoints(); - for (final SAP sap : _serviceAccessPoints) { - StringConcatenation _builder_3 = new StringConcatenation(); - String _name_6 = sap.getName(); - _builder_3.append(_name_6, ""); - _builder_3.append("(*this, this, \""); - String _name_7 = sap.getName(); - _builder_3.append(_name_7, ""); - _builder_3.append("\", IFITEM_"); - String _name_8 = sap.getName(); - _builder_3.append(_name_8, ""); - _builder_3.append(", 0, port_addr[IFITEM_"); - String _name_9 = sap.getName(); - _builder_3.append(_name_9, ""); - _builder_3.append("][0], peer_addr[IFITEM_"); - String _name_10 = sap.getName(); - _builder_3.append(_name_10, ""); - _builder_3.append("][0])"); - initializerList.add(_builder_3); - } - EList<ServiceImplementation> _serviceImplementations = ac.getServiceImplementations(); - for (final ServiceImplementation svc : _serviceImplementations) { - StringConcatenation _builder_4 = new StringConcatenation(); - SPP _spp = svc.getSpp(); - String _name_11 = _spp.getName(); - _builder_4.append(_name_11, ""); - _builder_4.append("(*this, this, \""); - SPP _spp_1 = svc.getSpp(); - String _name_12 = _spp_1.getName(); - _builder_4.append(_name_12, ""); - _builder_4.append("\", IFITEM_"); - SPP _spp_2 = svc.getSpp(); - String _name_13 = _spp_2.getName(); - _builder_4.append(_name_13, ""); - _builder_4.append(", port_addr[IFITEM_"); - SPP _spp_3 = svc.getSpp(); - String _name_14 = _spp_3.getName(); - _builder_4.append(_name_14, ""); - _builder_4.append("], peer_addr[IFITEM_"); - SPP _spp_4 = svc.getSpp(); - String _name_15 = _spp_4.getName(); - _builder_4.append(_name_15, ""); - _builder_4.append("])"); - initializerList.add(_builder_4); - } - EList<Attribute> _attributes = ac.getAttributes(); - for (final Attribute attrib : _attributes) { - CharSequence _attributeInitialization = this._initialization.attributeInitialization(attrib, false); - initializerList.add(_attributeInitialization); + EList<Attribute> _attributes = ac.getAttributes(); + for (final Attribute attrib : _attributes) { + CharSequence _attributeInitialization = this._initialization.attributeInitialization(attrib, false); + initializerList.add(_attributeInitialization); + } + _xblockexpression = IterableExtensions.join(initializerList, ("," + this._roomExtensions.NEWLINE)); } - StringConcatenation _builder_5 = new StringConcatenation(); - String _join = IterableExtensions.join(initializerList, ",\n"); - _builder_5.append(_join, ""); - _builder_5.newLineIfNotEmpty(); - return _builder_5.toString(); + return _xblockexpression; } - private CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final ActorClass ac) { + private CharSequence generateSourceFile(final Root root, final ExpandedActorClass xpac, final WiredActorClass wired, final boolean manualBehavior) { CharSequence _xblockexpression = null; { - ActorClass _actorClass = xpac.getActorClass(); - ComponentCommunicationType _commType = _actorClass.getCommType(); - final boolean async = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); + final ActorClass ac = xpac.getActorClass(); + String _xifexpression = null; + if (manualBehavior) { + String _name = ac.getName(); + _xifexpression = ("Abstract" + _name); + } else { + _xifexpression = ac.getName(); + } + final String clsname = _xifexpression; + String _elvis = null; + ActorClass _actorBase = ac.getActorBase(); + String _name_1 = null; + if (_actorBase!=null) { + _name_1=_actorBase.getName(); + } + if (_name_1 != null) { + _elvis = _name_1; + } else { + _elvis = "ActorClassBase"; + } + final String rtBaseClassName = _elvis; StringConcatenation _builder = new StringConcatenation(); _builder.append("/**"); _builder.newLine(); @@ -616,11 +582,11 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.append(" "); _builder.append("* Source File of ActorClass "); - String _name = ac.getName(); - _builder.append(_name, " "); + String _name_2 = ac.getName(); + _builder.append(_name_2, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -631,28 +597,47 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_cppHeaderFileName, ""); _builder.append("\""); _builder.newLineIfNotEmpty(); - _builder.append("#include \"common/debugging/DebuggingService.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/RTObject.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/RTServices.h\""); + _builder.newLine(); + _builder.append("#include \"etDatatypes.h\""); + _builder.newLine(); + _builder.append("#include \"etUnit/etUnit.h\""); _builder.newLine(); _builder.append("#include <iostream>"); _builder.newLine(); + _builder.append("#include <string>"); + _builder.newLine(); + _builder.newLine(); + { + EList<ActorRef> _actorRefs = ac.getActorRefs(); + for(final ActorRef ar : _actorRefs) { + _builder.append("#include \""); + ActorClass _type = ar.getType(); + String _path = this._roomExtensions.getPath(_type); + _builder.append(_path, ""); + ActorClass _type_1 = ar.getType(); + String _name_3 = _type_1.getName(); + _builder.append(_name_3, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); + } + } _builder.newLine(); _builder.append("using namespace etRuntime;"); _builder.newLine(); _builder.newLine(); _builder.newLine(); - String _name_1 = ac.getName(); - _builder.append(_name_1, ""); + _builder.append(clsname, ""); _builder.append("::"); - String _name_2 = ac.getName(); - _builder.append(_name_2, ""); - _builder.append("(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr, "); + _builder.append(clsname, ""); + _builder.append("(etRuntime::IRTObject* parent, const std::string& name) :"); _builder.newLineIfNotEmpty(); - _builder.append(" \t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t "); - _builder.append("const std::vector<std::vector<etRuntime::Address> >& peer_addr)"); - _builder.newLine(); - _builder.append(": "); + _builder.append("\t\t"); String _generateConstructorInitalizerList = this.generateConstructorInitalizerList(ac); - _builder.append(_generateConstructorInitalizerList, ""); + _builder.append(_generateConstructorInitalizerList, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("{"); _builder.newLine(); @@ -660,9 +645,6 @@ public class ActorClassGen extends GenericActorClassGenerator { boolean _hasNonEmptyStateMachine = this._roomHelpers.hasNonEmptyStateMachine(ac); if (_hasNonEmptyStateMachine) { _builder.append("\t"); - _builder.append("history = new int[s_numberOfStates];"); - _builder.newLine(); - _builder.append("\t"); _builder.append("for (int i = 0; i < s_numberOfStates; i++) {"); _builder.newLine(); _builder.append("\t"); @@ -676,8 +658,8 @@ public class ActorClassGen extends GenericActorClassGenerator { } _builder.append("\t"); _builder.append("setClassName(\""); - String _name_3 = ac.getName(); - _builder.append(_name_3, "\t"); + String _name_4 = ac.getName(); + _builder.append(_name_4, "\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -686,86 +668,255 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append(_attributeInitialization, "\t"); _builder.newLineIfNotEmpty(); _builder.newLine(); + _builder.append("\t"); + _builder.append("// sub actors"); + _builder.newLine(); + { + EList<ActorRef> _actorRefs_1 = ac.getActorRefs(); + for(final ActorRef sub : _actorRefs_1) { + { + int _multiplicity = sub.getMultiplicity(); + boolean _greaterThan = (_multiplicity > 1); + if (_greaterThan) { + _builder.append("\t"); + _builder.append("for (int i=0; i<"); + int _multiplicity_1 = sub.getMultiplicity(); + _builder.append(_multiplicity_1, "\t"); + _builder.append("; ++i) {"); + _builder.newLineIfNotEmpty(); + { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { + _builder.append("\t"); + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, \""); + String _name_5 = sub.getName(); + _builder.append(_name_5, "\t\t"); + _builder.append(GenmodelConstants.INDEX_SEP, "\t\t"); + _builder.append("\"+i);"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("\t"); + _builder.append("\t"); + _builder.append("new "); + ActorClass _type_2 = sub.getType(); + String _name_6 = _type_2.getName(); + _builder.append(_name_6, "\t\t"); + _builder.append("(this, \""); + String _name_7 = sub.getName(); + _builder.append(_name_7, "\t\t"); + _builder.append(GenmodelConstants.INDEX_SEP, "\t\t"); + _builder.append("\"+i);"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + } else { + { + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_1) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, \""); + String _name_8 = sub.getName(); + _builder.append(_name_8, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("\t"); + _builder.append("new "); + ActorClass _type_3 = sub.getType(); + String _name_9 = _type_3.getName(); + _builder.append(_name_9, "\t"); + _builder.append("(this, \""); + String _name_10 = sub.getName(); + _builder.append(_name_10, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); + } + } + } + } + _builder.newLine(); + _builder.append("\t"); + _builder.append("// wiring"); + _builder.newLine(); { - if (async) { + EList<Wire> _wires = wired.getWires(); + for(final Wire wire : _wires) { _builder.append("\t"); - _builder.append("getMsgsvc()->addAsyncActor(*this);"); - _builder.newLine(); + String _xifexpression_1 = null; + boolean _isDataDriven = wire.isDataDriven(); + if (_isDataDriven) { + _xifexpression_1 = "DataPortBase"; + } else { + _xifexpression_1 = "InterfaceItemBase"; + } + _builder.append(_xifexpression_1, "\t"); + _builder.append("::connect(this, \""); + EList<String> _path1 = wire.getPath1(); + String _join = IterableExtensions.join(_path1, "/"); + _builder.append(_join, "\t"); + _builder.append("\", \""); + EList<String> _path2 = wire.getPath2(); + String _join_1 = IterableExtensions.join(_path2, "/"); + _builder.append(_join_1, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); } } - _builder.append("}"); _builder.newLine(); + { + boolean _or = false; + ComponentCommunicationType _commType = ac.getCommType(); + boolean _equals = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals) { + _or = true; + } else { + ComponentCommunicationType _commType_1 = ac.getCommType(); + boolean _equals_1 = Objects.equal(_commType_1, ComponentCommunicationType.DATA_DRIVEN); + _or = _equals_1; + } + if (_or) { + _builder.append("\t"); + _builder.append("// activate polling for data-driven communication"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->addPollingMessageReceiver(*this);"); + _builder.newLine(); + } + } _builder.newLine(); - _builder.append("void "); - String _name_4 = ac.getName(); - _builder.append(_name_4, ""); - _builder.append("::init(){"); - _builder.newLineIfNotEmpty(); _builder.append("\t"); - _builder.append("initUser();"); - _builder.newLine(); + String _userStructorBody = this._procedureHelpers.userStructorBody(ac, true); + _builder.append(_userStructorBody, "\t"); + _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); _builder.newLine(); _builder.append("void "); - String _name_5 = ac.getName(); - _builder.append(_name_5, ""); - _builder.append("::start(){"); + String _name_11 = ac.getName(); + _builder.append(_name_11, ""); + _builder.append("::destroy(){"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - _builder.append("startUser();"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); + String _userStructorBody_1 = this._procedureHelpers.userStructorBody(ac, false); + _builder.append(_userStructorBody_1, "\t"); + _builder.newLineIfNotEmpty(); { - boolean _overridesStop = this._roomExtensions.overridesStop(ac); - boolean _not = (!_overridesStop); - if (_not) { - _builder.append("void "); - String _name_6 = ac.getName(); - _builder.append(_name_6, ""); - _builder.append("::stop(){"); - _builder.newLineIfNotEmpty(); + GlobalGeneratorSettings _settings_2 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_2) { _builder.append("\t"); - _builder.append("stopUser();"); + _builder.append("DebuggingService::getInstance().addMessageActorDestroy(*this);"); _builder.newLine(); - _builder.append("}"); + } + } + { + boolean _or_1 = false; + ComponentCommunicationType _commType_2 = ac.getCommType(); + boolean _equals_2 = Objects.equal(_commType_2, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals_2) { + _or_1 = true; + } else { + ComponentCommunicationType _commType_3 = ac.getCommType(); + boolean _equals_3 = Objects.equal(_commType_3, ComponentCommunicationType.DATA_DRIVEN); + _or_1 = _equals_3; + } + if (_or_1) { + _builder.append("\t"); + _builder.append("RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(getThread())->removePollingMessageReceiver(*this);"); _builder.newLine(); } } + _builder.append("\t"); + _builder.append(rtBaseClassName, "\t"); + _builder.append("::destroy();"); + _builder.newLineIfNotEmpty(); + _builder.append("}"); + _builder.newLine(); _builder.newLine(); + EList<StandardOperation> _operations = ac.getOperations(); + String _name_12 = ac.getName(); + CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_12); + _builder.append(_operationsImplementation, ""); + _builder.newLineIfNotEmpty(); _builder.newLine(); { boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac); if (_hasNonEmptyStateMachine_1) { - CharSequence _genStateMachine = this._stateMachineGen.genStateMachine(xpac, false); - _builder.append(_genStateMachine, ""); + CharSequence _genStateMachineMethods = this._stateMachineGen.genStateMachineMethods(xpac, true); + _builder.append(_genStateMachineMethods, ""); _builder.newLineIfNotEmpty(); + { + ComponentCommunicationType _commType_4 = ac.getCommType(); + boolean _equals_4 = Objects.equal(_commType_4, ComponentCommunicationType.DATA_DRIVEN); + if (_equals_4) { + _builder.append("void "); + String _name_13 = ac.getName(); + _builder.append(_name_13, ""); + _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("handleSystemEvent(ifitem, evt, generic_data);"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + } + } + { + boolean _or_2 = false; + ComponentCommunicationType _commType_5 = ac.getCommType(); + boolean _equals_5 = Objects.equal(_commType_5, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals_5) { + _or_2 = true; + } else { + ComponentCommunicationType _commType_6 = ac.getCommType(); + boolean _equals_6 = Objects.equal(_commType_6, ComponentCommunicationType.DATA_DRIVEN); + _or_2 = _equals_6; + } + if (_or_2) { + _builder.append("void "); + String _name_14 = ac.getName(); + _builder.append(_name_14, ""); + _builder.append("::receive(const Message* msg) {"); + _builder.newLineIfNotEmpty(); + { + ComponentCommunicationType _commType_7 = ac.getCommType(); + boolean _equals_7 = Objects.equal(_commType_7, ComponentCommunicationType.ASYNCHRONOUS); + if (_equals_7) { + _builder.append("\t"); + _builder.append("receiveEvent(0, -1, 0);"); + _builder.newLine(); + } else { + _builder.append("\t"); + _builder.append("receiveEventInternal();"); + _builder.newLine(); + } + } + _builder.append("}"); + _builder.newLine(); + } + } } else { - boolean _hasStateMachine = xpac.hasStateMachine(); - boolean _not_1 = (!_hasStateMachine); - if (_not_1) { + StateGraph _stateMachine = xpac.getStateMachine(); + boolean _isEmpty = this._roomHelpers.isEmpty(_stateMachine); + if (_isEmpty) { _builder.append("//--------------------- no state machine"); _builder.newLine(); _builder.append("void "); - String _name_7 = ac.getName(); - _builder.append(_name_7, ""); - _builder.append("::receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data) {"); + String _name_15 = ac.getName(); + _builder.append(_name_15, ""); + _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data) {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("handleSystemEvent(ifitem, evt, data);"); _builder.newLine(); _builder.append("}"); _builder.newLine(); - _builder.newLine(); - _builder.append("void "); - String _name_8 = ac.getName(); - _builder.append(_name_8, ""); - _builder.append("::executeInitTransition(){"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); } } } diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java index afa30d77e..d21aaf225 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/CppExtensions.java @@ -18,6 +18,8 @@ import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; import org.eclipse.etrice.core.room.Attribute; import org.eclipse.etrice.core.room.DataClass; @@ -64,14 +66,22 @@ public class CppExtensions implements ILanguageExtension { return (_name + ".cpp"); } - public String getInstSourceFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + "_Inst.h"); + public String getCppClassName(final NodeRef nr, final SubSystemInstance ssi) { + String _name = nr.getName(); + String _plus = ("Node_" + _name); + String _plus_1 = (_plus + "_"); + String _name_1 = ssi.getName(); + return (_plus_1 + _name_1); } - public String getDispSourceFileName(final RoomClass rc) { - String _name = rc.getName(); - return (_name + "_Disp.h"); + public String getCppHeaderFileName(final NodeRef nr, final SubSystemInstance ssi) { + String _cppClassName = this.getCppClassName(nr, ssi); + return (_cppClassName + ".h"); + } + + public String getCppSourceFileName(final NodeRef nr, final SubSystemInstance ssi) { + String _cppClassName = this.getCppClassName(nr, ssi); + return (_cppClassName + ".cpp"); } public String accessLevelPrivate() { @@ -125,24 +135,39 @@ public class CppExtensions implements ILanguageExtension { } public String genEnumeration(final String name, final List<Pair<String, String>> entries) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("typedef enum {"); - _builder.newLine(); + String _xblockexpression = null; { - for(final Pair<String, String> entry : entries) { - String _first = entry.getFirst(); - _builder.append(_first, ""); - _builder.append(" = "); - String _second = entry.getSecond(); - _builder.append(_second, ""); - _builder.append(","); - _builder.newLineIfNotEmpty(); + boolean _isEmpty = entries.isEmpty(); + if (_isEmpty) { + return ""; } + StringConcatenation _builder = new StringConcatenation(); + _builder.append("typedef enum {"); + _builder.newLine(); + { + boolean _hasElements = false; + for(final Pair<String, String> entry : entries) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(",", "\t"); + } + _builder.append("\t"); + String _first = entry.getFirst(); + _builder.append(_first, "\t"); + _builder.append(" = "); + String _second = entry.getSecond(); + _builder.append(_second, "\t"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("} "); + _builder.append(name, ""); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _xblockexpression = _builder.toString(); } - _builder.append("} "); - _builder.append(name, ""); - _builder.append(";"); - return _builder.toString(); + return _xblockexpression; } public String booleanConstant(final boolean b) { @@ -161,24 +186,25 @@ public class CppExtensions implements ILanguageExtension { return "void*"; } - public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) { - return (((((type + " ") + name) + "[") + Integer.valueOf(size)) + "]"); - } - - public String constructorName(final String cls) { - return cls; - } - - public String destructorName(final String cls) { - return (cls + "_dtor"); - } - - public String constructorReturnType() { - return ""; + public String typeArrayModifier() { + return this.pointerLiteral(); } - public String destructorReturnType() { - return "void"; + public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(type, ""); + { + if (isRef) { + _builder.append("*"); + } + } + _builder.append(" "); + _builder.append(name, ""); + _builder.append("["); + _builder.append(size, ""); + _builder.append("]"); + _builder.newLineIfNotEmpty(); + return _builder.toString(); } public CharSequence getIncludeGuardString(final String filename) { @@ -327,10 +353,19 @@ public class CppExtensions implements ILanguageExtension { } public String[] generateArglistAndTypedData(final EObject d) { - final VarDecl data = ((VarDecl) d); - String deref = "*"; - boolean _equals = Objects.equal(data, null); + boolean _or = false; + boolean _equals = Objects.equal(d, null); if (_equals) { + _or = true; + } else { + _or = (!(d instanceof VarDecl)); + } + if (_or) { + return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class)); + } + final VarDecl data = ((VarDecl) d); + boolean _equals_1 = Objects.equal(data, null); + if (_equals_1) { return ((String[])Conversions.unwrapArray(CollectionLiterals.<String>newArrayList("", "", ""), String.class)); } String _xifexpression = null; @@ -349,23 +384,33 @@ public class CppExtensions implements ILanguageExtension { DataType _type_3 = _refType_3.getType(); _xifexpression_1 = this.getTargetType(((EnumerationType) _type_3)); } else { + String _xifexpression_2 = null; RefableType _refType_4 = data.getRefType(); DataType _type_4 = _refType_4.getType(); - _xifexpression_1 = _type_4.getName(); + if ((_type_4 instanceof ExternalType)) { + RefableType _refType_5 = data.getRefType(); + DataType _type_5 = _refType_5.getType(); + _xifexpression_2 = ((ExternalType) _type_5).getTargetName(); + } else { + RefableType _refType_6 = data.getRefType(); + DataType _type_6 = _refType_6.getType(); + _xifexpression_2 = _type_6.getName(); + } + _xifexpression_1 = _xifexpression_2; } _xifexpression = _xifexpression_1; } String typeName = _xifexpression; - String _xifexpression_2 = null; - RefableType _refType_5 = data.getRefType(); - DataType _type_5 = _refType_5.getType(); - if ((_type_5 instanceof PrimitiveType)) { + String _xifexpression_3 = null; + RefableType _refType_7 = data.getRefType(); + DataType _type_7 = _refType_7.getType(); + if ((_type_7 instanceof PrimitiveType)) { String _xblockexpression = null; { - RefableType _refType_6 = data.getRefType(); - DataType _type_6 = _refType_6.getType(); - final String ct = ((PrimitiveType) _type_6).getCastName(); - String _xifexpression_3 = null; + RefableType _refType_8 = data.getRefType(); + DataType _type_8 = _refType_8.getType(); + final String ct = ((PrimitiveType) _type_8).getCastName(); + String _xifexpression_4 = null; boolean _and = false; boolean _notEquals = (!Objects.equal(ct, null)); if (!_notEquals) { @@ -376,51 +421,43 @@ public class CppExtensions implements ILanguageExtension { _and = _not; } if (_and) { - _xifexpression_3 = ct; + _xifexpression_4 = ct; } else { - _xifexpression_3 = typeName; + _xifexpression_4 = typeName; } - _xblockexpression = _xifexpression_3; + _xblockexpression = _xifexpression_4; } - _xifexpression_2 = _xblockexpression; + _xifexpression_3 = _xblockexpression; } else { - String _xifexpression_3 = null; - RefableType _refType_6 = data.getRefType(); - DataType _type_6 = _refType_6.getType(); - if ((_type_6 instanceof EnumerationType)) { - RefableType _refType_7 = data.getRefType(); - DataType _type_7 = _refType_7.getType(); - _xifexpression_3 = this.getCastType(((EnumerationType) _type_7)); + String _xifexpression_4 = null; + RefableType _refType_8 = data.getRefType(); + DataType _type_8 = _refType_8.getType(); + if ((_type_8 instanceof EnumerationType)) { + RefableType _refType_9 = data.getRefType(); + DataType _type_9 = _refType_9.getType(); + _xifexpression_4 = this.getCastType(((EnumerationType) _type_9)); } else { - _xifexpression_3 = typeName; + _xifexpression_4 = typeName; } - _xifexpression_2 = _xifexpression_3; + _xifexpression_3 = _xifexpression_4; } - String castTypeName = _xifexpression_2; - castTypeName = (castTypeName + "*"); - RefableType _refType_8 = data.getRefType(); - boolean _isRef = _refType_8.isRef(); + String castTypeName = _xifexpression_3; + String _castTypeName = castTypeName; + castTypeName = (_castTypeName + "*"); + String deRef = "*"; + RefableType _refType_10 = data.getRefType(); + boolean _isRef = _refType_10.isRef(); if (_isRef) { typeName = (typeName + "*"); - castTypeName = (castTypeName + "*"); - } else { - RefableType _refType_9 = data.getRefType(); - DataType _type_8 = _refType_9.getType(); - if ((!(_type_8 instanceof PrimitiveType))) { - typeName = (typeName + "*"); - castTypeName = (castTypeName + "*"); - } else { - castTypeName = typeName; - deref = ""; - } + deRef = ""; } String _name = data.getName(); String _plus = ((typeName + " ") + _name); String _plus_1 = (_plus + " = "); - String _plus_2 = (_plus_1 + deref); - String _plus_3 = (_plus_2 + "(("); + String _plus_2 = (_plus_1 + deRef); + String _plus_3 = (_plus_2 + "(static_cast<"); String _plus_4 = (_plus_3 + castTypeName); - final String typedData = (_plus_4 + ") generic_data);\n"); + final String typedData = (_plus_4 + ">(generic_data__et));\n"); String _name_1 = data.getName(); final String dataArg = (", " + _name_1); String _name_2 = data.getName(); 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 52ae2a728..51c89f577 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 @@ -11,8 +11,10 @@ package org.eclipse.etrice.generator.cpp.gen; import com.google.common.base.Objects; +import com.google.common.collect.Iterables; import com.google.inject.Inject; import com.google.inject.Singleton; +import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.etrice.core.fsm.fSM.DetailCode; @@ -26,20 +28,19 @@ import org.eclipse.etrice.core.room.RefableType; import org.eclipse.etrice.core.room.RoomModel; import org.eclipse.etrice.core.room.StandardOperation; import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.cpp.Main; import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.GeneratorSettings; import org.eclipse.etrice.generator.cpp.gen.Initialization; import org.eclipse.etrice.generator.generic.ProcedureHelpers; import org.eclipse.etrice.generator.generic.RoomExtensions; 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.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.eclipse.xtext.xbase.lib.ListExtensions; -/** - * @author Peter Karlitschek - */ @Singleton @SuppressWarnings("all") public class DataClassGen { @@ -115,6 +116,8 @@ public class DataClassGen { _builder.append(_generateIncludeGuardBegin, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); + _builder.append("#include \"etDatatypes.h\""); + _builder.newLine(); { DataClass _base = dc.getBase(); boolean _notEquals = (!Objects.equal(_base, null)); @@ -127,9 +130,9 @@ public class DataClassGen { String _name_1 = _base_2.getName(); _builder.append(_name_1, ""); _builder.append(".h\""); - _builder.newLineIfNotEmpty(); } } + _builder.newLineIfNotEmpty(); { EList<DataClass> _referencedDataClasses = root.getReferencedDataClasses(dc); for(final DataClass classes : _referencedDataClasses) { @@ -142,10 +145,9 @@ public class DataClassGen { _builder.newLineIfNotEmpty(); } } - EList<RoomModel> models = root.getReferencedModels(dc); - _builder.newLineIfNotEmpty(); { - for(final RoomModel model : models) { + EList<RoomModel> _referencedModels = root.getReferencedModels(dc); + for(final RoomModel model : _referencedModels) { { EList<DataClass> _dataClasses = model.getDataClasses(); for(final DataClass classes_1 : _dataClasses) { @@ -182,7 +184,6 @@ public class DataClassGen { } _builder.append(" {"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("public:"); _builder.newLine(); @@ -191,14 +192,12 @@ public class DataClassGen { 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(); @@ -206,7 +205,6 @@ public class DataClassGen { 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(); @@ -214,7 +212,6 @@ public class DataClassGen { 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"); @@ -240,51 +237,31 @@ public class DataClassGen { _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"); + EList<Attribute> _attributes_3 = dc.getAttributes(); + boolean _isEmpty = _attributes_3.isEmpty(); + boolean _not = (!_isEmpty); + if (_not) { + String _name_13 = dc.getName(); + _builder.append(_name_13, "\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"); + EList<Attribute> _attributes_4 = dc.getAttributes(); + CharSequence _argList = this.helpers.argList(_attributes_4); + _builder.append(_argList, "\t"); _builder.append(");"); - _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); - _builder.newLine(); + _builder.newLineIfNotEmpty(); _builder.append("};"); _builder.newLine(); _builder.newLine(); - String _name_16 = dc.getName(); - CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_16); + String _name_14 = dc.getName(); + CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_14); _builder.append(_generateIncludeGuardEnd, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); @@ -292,387 +269,246 @@ public class DataClassGen { } public CharSequence generateSourceFile(final Root root, final DataClass dc) { - 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(); + CharSequence _xblockexpression = null; { DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append("\t"); - _builder.append(":"); + String _name = null; + if (_base!=null) { + _name=_base.getName(); + } + final String baseName = _name; + 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_1 = dc.getName(); + _builder.append(_name_1, " "); + _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(); + _builder.newLine(); + _builder.append("#include \"etUnit/etUnit.h\""); + _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_2 = dc.getName(); + _builder.append(_name_2, ""); + _builder.append("::"); + String _name_3 = dc.getName(); + _builder.append(_name_3, ""); + _builder.append("()"); + _builder.newLineIfNotEmpty(); + { DataClass _base_1 = dc.getBase(); - String _name_3 = _base_1.getName(); - _builder.append(_name_3, "\t"); - _builder.append("()"); - _builder.newLineIfNotEmpty(); + boolean _notEquals = (!Objects.equal(_base_1, null)); + if (_notEquals) { + _builder.append("\t"); + _builder.append(":"); + DataClass _base_2 = dc.getBase(); + String _name_4 = _base_2.getName(); + _builder.append(_name_4, "\t"); + _builder.append("()"); + _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)); + _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.newLine(); + _builder.append("\t"); + String _userStructorBody = this.helpers.userStructorBody(dc, true); + _builder.append(_userStructorBody, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// copy constructor"); + _builder.newLine(); + String _name_5 = dc.getName(); + _builder.append(_name_5, ""); + _builder.append("::"); + String _name_6 = dc.getName(); + _builder.append(_name_6, ""); + _builder.append("(const "); + String _name_7 = dc.getName(); + _builder.append(_name_7, ""); + _builder.append("& rhs)"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + String _xifexpression = null; + boolean _notEquals_1 = (!Objects.equal(baseName, 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(); + _xifexpression = (baseName + "(rhs)"); } - } - { 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_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"); + final Function1<Attribute, String> _function = new Function1<Attribute, String>() { + public String apply(final Attribute it) { + String _name = it.getName(); + String _plus = (_name + "(rhs."); + String _name_1 = it.getName(); + String _plus_1 = (_plus + _name_1); + return (_plus_1 + ")"); } - _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_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"); + }; + List<String> _map = ListExtensions.<Attribute, String>map(_attributes_1, _function); + Iterable<String> _plus = Iterables.<String>concat(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_xifexpression)), _map); + Iterable<String> _filterNull = IterableExtensions.<String>filterNull(_plus); + CharSequence _constructorList = this.constructorList(_filterNull); + _builder.append(_constructorList, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("{"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// constructor using fields"); + _builder.newLine(); + { + EList<Attribute> _attributes_2 = dc.getAttributes(); + boolean _isEmpty = _attributes_2.isEmpty(); + boolean _not = (!_isEmpty); + if (_not) { + String _name_8 = dc.getName(); + _builder.append(_name_8, ""); + _builder.append("::"); + String _name_9 = dc.getName(); + _builder.append(_name_9, ""); + _builder.append("("); + EList<Attribute> _attributes_3 = dc.getAttributes(); + CharSequence _argList = this.helpers.argList(_attributes_3); + _builder.append(_argList, ""); + _builder.append(")"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append(":"); + _builder.newLine(); + { + EList<Attribute> _attributes_4 = dc.getAttributes(); + boolean _hasElements = false; + for(final Attribute a : _attributes_4) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(",", "\t"); + } + _builder.append("\t"); + String _name_10 = a.getName(); + _builder.append(_name_10, "\t"); + _builder.append("("); + String _name_11 = a.getName(); + _builder.append(_name_11, "\t"); + _builder.append(")"); + _builder.newLineIfNotEmpty(); } - _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("\t"); + String _userStructorBody_1 = this.helpers.userStructorBody(dc, true); + _builder.append(_userStructorBody_1, "\t"); + _builder.newLineIfNotEmpty(); + _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_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(); } - } - _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) { - String result = ""; - DataClass dc = _dc; - while ((!Objects.equal(dc, null))) { + _builder.newLine(); + _builder.append("// assignment operator"); + _builder.newLine(); + String _name_12 = dc.getName(); + _builder.append(_name_12, ""); + _builder.append("& "); + String _name_13 = dc.getName(); + _builder.append(_name_13, ""); + _builder.append("::operator=(const "); + String _name_14 = dc.getName(); + _builder.append(_name_14, ""); + _builder.append("& rhs)"); + _builder.newLineIfNotEmpty(); + _builder.append("{"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("if (this == &rhs) { return *this; };"); + _builder.newLine(); { - EList<Attribute> _attributes = dc.getAttributes(); - CharSequence _paramList = this.paramList(_attributes); - String _string = _paramList.toString(); - String _plus = (_string + result); - result = _plus; - DataClass _base = dc.getBase(); - dc = _base; - boolean _notEquals = (!Objects.equal(dc, null)); - if (_notEquals) { - result = (", " + result); - } - } - } - return result; - } - - public CharSequence paramList(final List<Attribute> attributes) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasElements = false; - for(final Attribute a : attributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); + DataClass _base_3 = dc.getBase(); + boolean _notEquals_2 = (!Objects.equal(_base_3, null)); + if (_notEquals_2) { + _builder.append("\t"); + DataClass _base_4 = dc.getBase(); + String _name_15 = _base_4.getName(); + _builder.append(_name_15, "\t"); + _builder.append("::operator=(rhs);"); + _builder.newLineIfNotEmpty(); } - String _name = a.getName(); - _builder.append(_name, ""); - _builder.append("_"); } - } - return _builder; - } - - public String argList(final DataClass _dc) { - String result = ""; - DataClass dc = _dc; - while ((!Objects.equal(dc, null))) { { - EList<Attribute> _attributes = dc.getAttributes(); - CharSequence _argListConstructor = this.argListConstructor(_attributes); - String _string = _argListConstructor.toString(); - String _plus = (_string + result); - result = _plus; - DataClass _base = dc.getBase(); - dc = _base; - boolean _notEquals = (!Objects.equal(dc, null)); - if (_notEquals) { - result = (", " + result); + EList<Attribute> _attributes_5 = dc.getAttributes(); + for(final Attribute a_1 : _attributes_5) { + _builder.append("\t"); + String _name_16 = a_1.getName(); + _builder.append(_name_16, "\t"); + _builder.append("= rhs."); + String _name_17 = a_1.getName(); + _builder.append(_name_17, "\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); } } + _builder.append("\t"); + _builder.append("return *this;"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + EList<StandardOperation> _operations = dc.getOperations(); + String _name_18 = dc.getName(); + CharSequence _operationsImplementation = this.helpers.operationsImplementation(_operations, _name_18); + _builder.append(_operationsImplementation, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _xblockexpression = _builder; } - return result; + return _xblockexpression; } - public CharSequence argListConstructor(final List<Attribute> attributes) { + public CharSequence constructorList(final Iterable<? extends CharSequence> items) { StringConcatenation _builder = new StringConcatenation(); { boolean _hasElements = false; - for(final Attribute a : attributes) { + for(final CharSequence s : items) { if (!_hasElements) { _hasElements = true; + _builder.append(":", ""); } else { - _builder.appendImmediate(", ", ""); + _builder.appendImmediate(",", ""); } - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this.typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name = a.getName(); - _builder.append(_name, ""); - _builder.append("_"); + _builder.append(s, ""); + _builder.newLineIfNotEmpty(); } } return _builder; diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java index ccae32727..91fb4674e 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/MainGen.java @@ -19,9 +19,9 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.etrice.core.genmodel.etricegen.Root; import org.eclipse.etrice.generator.cpp.gen.ActorClassGen; import org.eclipse.etrice.generator.cpp.gen.DataClassGen; +import org.eclipse.etrice.generator.cpp.gen.NodeGen; +import org.eclipse.etrice.generator.cpp.gen.NodeRunnerGen; import org.eclipse.etrice.generator.cpp.gen.ProtocolClassGen; -import org.eclipse.etrice.generator.cpp.gen.SubSystemClassGen; -import org.eclipse.etrice.generator.cpp.gen.SubSystemRunnerGen; import org.eclipse.etrice.generator.generic.PrepareFileSystem; @Singleton @@ -37,10 +37,10 @@ public class MainGen { private ActorClassGen actorClassGen; @Inject - private SubSystemClassGen subsystemClassGen; + private NodeGen subsystemClassGen; @Inject - private SubSystemRunnerGen subsystemRunnerGen; + private NodeRunnerGen subsystemRunnerGen; @Inject private PrepareFileSystem prepFS; diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java new file mode 100644 index 000000000..a7b953871 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeGen.java @@ -0,0 +1,680 @@ +/** + * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Peter Karlitschek (initial contribution) + */ +package org.eclipse.etrice.generator.cpp.gen; + +import com.google.common.base.Objects; +import com.google.common.collect.Iterables; +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.eclipse.emf.common.util.EList; +import org.eclipse.etrice.core.common.converter.TimeConverter; +import org.eclipse.etrice.core.etmap.util.ETMapUtil; +import org.eclipse.etrice.core.etphys.eTPhys.ExecMode; +import org.eclipse.etrice.core.etphys.eTPhys.NodeClass; +import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; +import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread; +import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants; +import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; +import org.eclipse.etrice.core.genmodel.etricegen.Root; +import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; +import org.eclipse.etrice.core.genmodel.etricegen.Wire; +import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; +import org.eclipse.etrice.core.genmodel.etricegen.WiredSubSystemClass; +import org.eclipse.etrice.core.genmodel.fsm.fsmgen.IDiagnostician; +import org.eclipse.etrice.core.room.ActorClass; +import org.eclipse.etrice.core.room.ActorRef; +import org.eclipse.etrice.core.room.RoomModel; +import org.eclipse.etrice.core.room.SubSystemClass; +import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; +import org.eclipse.etrice.generator.cpp.Main; +import org.eclipse.etrice.generator.cpp.gen.CppExtensions; +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; +import org.eclipse.etrice.generator.fsm.base.Indexed; +import org.eclipse.etrice.generator.generic.ProcedureHelpers; +import org.eclipse.etrice.generator.generic.RoomExtensions; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.xbase.lib.CollectionLiterals; +import org.eclipse.xtext.xbase.lib.Extension; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; + +@Singleton +@SuppressWarnings("all") +public class NodeGen { + @Inject + @Extension + private CppExtensions _cppExtensions; + + @Inject + @Extension + private RoomExtensions _roomExtensions; + + @Inject + @Extension + private ProcedureHelpers _procedureHelpers; + + @Inject + @Extension + private FileSystemHelpers _fileSystemHelpers; + + @Inject + private IGeneratorFileIo fileIO; + + @Inject + private IDiagnostician diagnostician; + + public void doGenerate(final Root root) { + final Map<SubSystemClass, WiredSubSystemClass> sscc2wired = CollectionLiterals.<SubSystemClass, WiredSubSystemClass>newHashMap(); + EList<WiredStructureClass> _wiredInstances = root.getWiredInstances(); + Iterable<WiredSubSystemClass> _filter = Iterables.<WiredSubSystemClass>filter(_wiredInstances, WiredSubSystemClass.class); + final Procedure1<WiredSubSystemClass> _function = new Procedure1<WiredSubSystemClass>() { + public void apply(final WiredSubSystemClass it) { + SubSystemClass _subSystemClass = it.getSubSystemClass(); + sscc2wired.put(_subSystemClass, it); + } + }; + IterableExtensions.<WiredSubSystemClass>forEach(_filter, _function); + Collection<NodeRef> _nodeRefs = ETMapUtil.getNodeRefs(); + for (final NodeRef nr : _nodeRefs) { + List<String> _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); + for (final String instpath : _subSystemInstancePaths) { + { + StructureInstance _instance = root.getInstance(instpath); + final SubSystemInstance ssi = ((SubSystemInstance) _instance); + boolean _and = false; + boolean _notEquals = (!Objects.equal(ssi, null)); + if (!_notEquals) { + _and = false; + } else { + SubSystemClass _subSystemClass = ssi.getSubSystemClass(); + boolean _isValidGenerationLocation = this._fileSystemHelpers.isValidGenerationLocation(_subSystemClass); + _and = _isValidGenerationLocation; + } + if (_and) { + SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); + final WiredSubSystemClass wired = sscc2wired.get(_subSystemClass_1); + SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); + String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass_2); + SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); + String _path = this._roomExtensions.getPath(_subSystemClass_3); + final String path = (_generationTargetPath + _path); + SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); + String _generationInfoPath = this._roomExtensions.getGenerationInfoPath(_subSystemClass_4); + SubSystemClass _subSystemClass_5 = ssi.getSubSystemClass(); + String _path_1 = this._roomExtensions.getPath(_subSystemClass_5); + final String infopath = (_generationInfoPath + _path_1); + final Set<PhysicalThread> usedThreads = ETMapUtil.getUsedThreads(nr, ssi); + String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(nr, ssi); + CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi, wired, usedThreads); + this.fileIO.generateFile("generating Node declaration", path, infopath, _cppHeaderFileName, _generateHeaderFile); + String _cppSourceFileName = this._cppExtensions.getCppSourceFileName(nr, ssi); + CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, wired, usedThreads); + this.fileIO.generateFile("generating Node implementation", path, infopath, _cppSourceFileName, _generateSourceFile); + } + } + } + } + } + + public CharSequence generateHeaderFile(final Root root, final SubSystemInstance comp, final WiredSubSystemClass wired, final Collection<PhysicalThread> usedThreads) { + CharSequence _xblockexpression = null; + { + final SubSystemClass cc = comp.getSubSystemClass(); + final EList<RoomModel> models = root.getReferencedModels(cc); + final NodeRef nr = ETMapUtil.getNodeRef(comp); + final String clsname = this._cppExtensions.getCppClassName(nr, comp); + NodeClass _type = nr.getType(); + EList<PhysicalThread> _threads = _type.getThreads(); + final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + public Boolean apply(final PhysicalThread t) { + return Boolean.valueOf(usedThreads.contains(t)); + } + }; + final Iterable<PhysicalThread> threads = IterableExtensions.<PhysicalThread>filter(_threads, _function); + 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("* Header File of SubSystemClass "); + _builder.append(clsname, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(clsname); + _builder.append(_generateIncludeGuardBegin, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("#include \"common/modelbase/SubSystemClassBase.h\""); + _builder.newLine(); + _builder.newLine(); + CharSequence _userCode = this._procedureHelpers.userCode(cc, 1, false); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("class "); + _builder.append(clsname, ""); + _builder.append(" : public etRuntime::SubSystemClassBase{"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + CharSequence _userCode_1 = this._procedureHelpers.userCode(cc, 2, false); + _builder.append(_userCode_1, "\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("public:"); + _builder.newLine(); + _builder.newLine(); + { + Iterable<Indexed<PhysicalThread>> _indexed = Indexed.<PhysicalThread>indexed(threads); + for(final Indexed<PhysicalThread> thread : _indexed) { + _builder.append("\t\t"); + _builder.append("static const int "); + PhysicalThread _value = thread.getValue(); + String _threadId = this.getThreadId(_value); + _builder.append(_threadId, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + } + } + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(clsname, "\t\t"); + _builder.append("(IRTObject* parent, const std::string& name);"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void instantiateMessageServices();"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void instantiateActors();"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void init();"); + _builder.newLine(); + _builder.newLine(); + { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { + _builder.append("\t\t"); + _builder.append("etBool hasGeneratedMSCInstrumentation() const { return true; }"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual void destroy();"); + _builder.newLine(); + } + } + _builder.newLine(); + _builder.append("\t"); + _builder.append("private:"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append(clsname, "\t\t"); + _builder.append("();"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append(clsname, "\t\t"); + _builder.append("("); + _builder.append(clsname, "\t\t"); + _builder.append(" const&);"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append(clsname, "\t\t"); + _builder.append("& operator=("); + _builder.append(clsname, "\t\t"); + _builder.append(" const&);"); + _builder.newLineIfNotEmpty(); + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + String _name = cc.getName(); + CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_name); + _builder.append(_generateIncludeGuardEnd, ""); + _builder.newLineIfNotEmpty(); + _xblockexpression = _builder; + } + return _xblockexpression; + } + + private String getThreadId(final PhysicalThread thread) { + String _name = thread.getName(); + String _upperCase = _name.toUpperCase(); + return ("THREAD_" + _upperCase); + } + + public CharSequence generateSourceFile(final Root root, final SubSystemInstance comp, final WiredSubSystemClass wired, final Collection<PhysicalThread> usedThreads) { + CharSequence _xblockexpression = null; + { + final SubSystemClass cc = comp.getSubSystemClass(); + final EList<RoomModel> models = root.getReferencedModels(cc); + final NodeRef nr = ETMapUtil.getNodeRef(comp); + final String clsname = this._cppExtensions.getCppClassName(nr, comp); + NodeClass _type = nr.getType(); + EList<PhysicalThread> _threads = _type.getThreads(); + final Function1<PhysicalThread, Boolean> _function = new Function1<PhysicalThread, Boolean>() { + public Boolean apply(final PhysicalThread t) { + return Boolean.valueOf(usedThreads.contains(t)); + } + }; + final Iterable<PhysicalThread> threads = IterableExtensions.<PhysicalThread>filter(_threads, _function); + 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 SubsystemClass "); + _builder.append(clsname, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + _builder.append("#include \""); + String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(nr, comp); + _builder.append(_cppHeaderFileName, ""); + _builder.append("\""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("#include \"common/debugging/DebuggingService.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/IMessageService.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/MessageService.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/MessageServiceController.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/RTServices.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); + _builder.newLine(); + _builder.newLine(); + { + EList<ActorInstance> _actorInstances = comp.getActorInstances(); + for(final ActorInstance ai : _actorInstances) { + _builder.append("#include \""); + ActorClass _actorClass = ai.getActorClass(); + String _path = this._roomExtensions.getPath(_actorClass); + _builder.append(_path, ""); + ActorClass _actorClass_1 = ai.getActorClass(); + String _name = _actorClass_1.getName(); + _builder.append(_name, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("#include <iostream>"); + _builder.newLine(); + _builder.newLine(); + _builder.append("using namespace etRuntime;"); + _builder.newLine(); + _builder.newLine(); + { + Iterable<Indexed<PhysicalThread>> _indexed = Indexed.<PhysicalThread>indexed(threads); + for(final Indexed<PhysicalThread> thread : _indexed) { + _builder.append("const int "); + _builder.append(clsname, ""); + _builder.append("::"); + PhysicalThread _value = thread.getValue(); + String _threadId = this.getThreadId(_value); + _builder.append(_threadId, ""); + _builder.append(" = "); + int _index0 = thread.getIndex0(); + _builder.append(_index0, ""); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + } + } + _builder.newLine(); + _builder.append(clsname, ""); + _builder.append("::"); + _builder.append(clsname, ""); + _builder.append("(IRTObject* parent, const std::string& name) :"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("SubSystemClassBase(parent, name)"); + _builder.newLine(); + _builder.append("{"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("void "); + _builder.append(clsname, ""); + _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data){"); + _builder.newLineIfNotEmpty(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("void "); + _builder.append(clsname, ""); + _builder.append("::instantiateMessageServices(){"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("IMessageService* msgService;"); + _builder.newLine(); + { + for(final PhysicalThread thread_1 : threads) { + _builder.append("\t"); + _builder.append("{"); + _builder.newLine(); + { + boolean _or = false; + ExecMode _execmode = thread_1.getExecmode(); + boolean _equals = Objects.equal(_execmode, ExecMode.POLLED); + if (_equals) { + _or = true; + } else { + ExecMode _execmode_1 = thread_1.getExecmode(); + boolean _equals_1 = Objects.equal(_execmode_1, ExecMode.MIXED); + _or = _equals_1; + } + if (_or) { + _builder.append("\t"); + _builder.append("\t"); + _builder.append("etTime interval;"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("interval.sec = "); + long _time = thread_1.getTime(); + long _split = TimeConverter.split(_time, TimeConverter.SEC, true); + _builder.append(_split, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("interval.nSec = "); + long _time_1 = thread_1.getTime(); + long _split_1 = TimeConverter.split(_time_1, TimeConverter.MILLI_SEC, false); + _builder.append(_split_1, "\t\t"); + _builder.append("L;"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("msgService = new MessageService(this, IMessageService::"); + ExecMode _execmode_2 = thread_1.getExecmode(); + String _name_1 = _execmode_2.getName(); + _builder.append(_name_1, "\t\t"); + _builder.append(", interval, 0, "); + String _threadId_1 = this.getThreadId(thread_1); + _builder.append(_threadId_1, "\t\t"); + _builder.append(", \"MessageService_"); + String _name_2 = thread_1.getName(); + _builder.append(_name_2, "\t\t"); + _builder.append("\", "); + int _prio = thread_1.getPrio(); + _builder.append(_prio, "\t\t"); + _builder.append(");"); + _builder.newLineIfNotEmpty(); + } else { + _builder.append("\t"); + _builder.append("\t"); + _builder.append("msgService = new MessageService(this, IMessageService::"); + ExecMode _execmode_3 = thread_1.getExecmode(); + String _name_3 = _execmode_3.getName(); + _builder.append(_name_3, "\t\t"); + _builder.append(", 0, "); + String _threadId_2 = this.getThreadId(thread_1); + _builder.append(_threadId_2, "\t\t"); + _builder.append(", \"MessageService_"); + String _name_4 = thread_1.getName(); + _builder.append(_name_4, "\t\t"); + _builder.append("\", "); + int _prio_1 = thread_1.getPrio(); + _builder.append(_prio_1, "\t\t"); + _builder.append(");"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("\t"); + _builder.append("\t"); + _builder.append("RTServices::getInstance().getMsgSvcCtrl().addMsgSvc(*msgService);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + } + } + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("void "); + _builder.append(clsname, ""); + _builder.append("::instantiateActors(){"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// thread mappings"); + _builder.newLine(); + { + EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances(); + for(final ActorInstance ai_1 : _allContainedInstances) { + _builder.append("\t"); + final ETMapUtil.MappedThread mapped = ETMapUtil.getMappedThread(ai_1); + _builder.newLineIfNotEmpty(); + { + boolean _or_1 = false; + boolean _isImplicit = mapped.isImplicit(); + if (_isImplicit) { + _or_1 = true; + } else { + boolean _isAsParent = mapped.isAsParent(); + _or_1 = _isAsParent; + } + boolean _not = (!_or_1); + if (_not) { + _builder.append("\t"); + _builder.append("addPathToThread(\""); + String _path_1 = ai_1.getPath(); + _builder.append(_path_1, "\t"); + _builder.append("\", "); + PhysicalThread _thread = mapped.getThread(); + String _threadId_3 = this.getThreadId(_thread); + _builder.append(_threadId_3, "\t"); + _builder.append(");"); + _builder.newLineIfNotEmpty(); + } + } + } + } + _builder.newLine(); + _builder.append("\t"); + _builder.append("// sub actors"); + _builder.newLine(); + { + EList<ActorRef> _actorRefs = cc.getActorRefs(); + for(final ActorRef sub : _actorRefs) { + { + int _multiplicity = sub.getMultiplicity(); + boolean _greaterThan = (_multiplicity > 1); + if (_greaterThan) { + _builder.append("\t"); + _builder.append("for (int i=0; i<"); + int _multiplicity_1 = sub.getMultiplicity(); + _builder.append(_multiplicity_1, "\t"); + _builder.append("; ++i) {"); + _builder.newLineIfNotEmpty(); + { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { + _builder.append("\t"); + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, \""); + String _name_5 = sub.getName(); + _builder.append(_name_5, "\t\t"); + _builder.append(GenmodelConstants.INDEX_SEP, "\t\t"); + _builder.append("\"+i);"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("\t"); + _builder.append("\t"); + _builder.append("new "); + ActorClass _type_1 = sub.getType(); + String _name_6 = _type_1.getName(); + _builder.append(_name_6, "\t\t"); + _builder.append("(this, \""); + String _name_7 = sub.getName(); + _builder.append(_name_7, "\t\t"); + _builder.append(GenmodelConstants.INDEX_SEP, "\t\t"); + _builder.append("\"+i);"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + } else { + { + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_1) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addMessageActorCreate(*this, \""); + String _name_8 = sub.getName(); + _builder.append(_name_8, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("\t"); + _builder.append("new "); + ActorClass _type_2 = sub.getType(); + String _name_9 = _type_2.getName(); + _builder.append(_name_9, "\t"); + _builder.append("(this, \""); + String _name_10 = sub.getName(); + _builder.append(_name_10, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); + } + } + } + } + _builder.newLine(); + _builder.append("\t"); + _builder.append("// wiring"); + _builder.newLine(); + { + EList<Wire> _wires = wired.getWires(); + for(final Wire wire : _wires) { + _builder.append("\t"); + String _xifexpression = null; + boolean _isDataDriven = wire.isDataDriven(); + if (_isDataDriven) { + _xifexpression = "DataPortBase"; + } else { + _xifexpression = "InterfaceItemBase"; + } + _builder.append(_xifexpression, "\t"); + _builder.append("::connect(this, \""); + EList<String> _path1 = wire.getPath1(); + String _join = IterableExtensions.join(_path1, "/"); + _builder.append(_join, "\t"); + _builder.append("\", \""); + EList<String> _path2 = wire.getPath2(); + String _join_1 = IterableExtensions.join(_path2, "/"); + _builder.append(_join_1, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("void "); + _builder.append(clsname, ""); + _builder.append("::init(){"); + _builder.newLineIfNotEmpty(); + { + GlobalGeneratorSettings _settings_2 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_2) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addVisibleComment(\"begin sub system initialization\");"); + _builder.newLine(); + } + } + _builder.append("\t"); + _builder.append("SubSystemClassBase::init();"); + _builder.newLine(); + { + GlobalGeneratorSettings _settings_3 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_3 = _settings_3.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_3) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addVisibleComment(\"done sub system initialization\");"); + _builder.newLine(); + } + } + _builder.append("}"); + _builder.newLine(); + { + GlobalGeneratorSettings _settings_4 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_4 = _settings_4.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_4) { + _builder.newLine(); + _builder.append("void "); + _builder.append(clsname, ""); + _builder.append("::destroy() {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addVisibleComment(\"begin sub system destruction\");"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("SubSystemClassBase::destroy();"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addVisibleComment(\"done sub system destruction\");"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + } + } + _builder.newLine(); + _xblockexpression = _builder; + } + return _xblockexpression; + } +} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java new file mode 100644 index 000000000..f545a6b45 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.java @@ -0,0 +1,255 @@ +/** + * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Peter Karlitschek (initial contribution) + */ +package org.eclipse.etrice.generator.cpp.gen; + +import com.google.common.base.Objects; +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.Collection; +import java.util.List; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.etrice.core.etmap.util.ETMapUtil; +import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; +import org.eclipse.etrice.core.genmodel.etricegen.Root; +import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance; +import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; +import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance; +import org.eclipse.etrice.core.room.SubSystemClass; +import org.eclipse.etrice.generator.cpp.gen.CppExtensions; +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; +import org.eclipse.etrice.generator.generic.RoomExtensions; +import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.xbase.lib.Extension; + +@Singleton +@SuppressWarnings("all") +public class NodeRunnerGen { + @Inject + @Extension + private RoomExtensions roomExt; + + @Inject + @Extension + private CppExtensions _cppExtensions; + + @Inject + @Extension + private FileSystemHelpers _fileSystemHelpers; + + @Inject + private IGeneratorFileIo fileIO; + + public void doGenerate(final Root root) { + Collection<NodeRef> _nodeRefs = ETMapUtil.getNodeRefs(); + for (final NodeRef nr : _nodeRefs) { + List<String> _subSystemInstancePaths = ETMapUtil.getSubSystemInstancePaths(nr); + for (final String instpath : _subSystemInstancePaths) { + { + StructureInstance _instance = root.getInstance(instpath); + final SubSystemInstance ssi = ((SubSystemInstance) _instance); + boolean _and = false; + boolean _notEquals = (!Objects.equal(ssi, null)); + if (!_notEquals) { + _and = false; + } else { + SubSystemClass _subSystemClass = ssi.getSubSystemClass(); + boolean _isValidGenerationLocation = this._fileSystemHelpers.isValidGenerationLocation(_subSystemClass); + _and = _isValidGenerationLocation; + } + if (_and) { + SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); + String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass_1); + SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); + String _path = this.roomExt.getPath(_subSystemClass_2); + final String filepath = (_generationTargetPath + _path); + SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); + String _generationInfoPath = this.roomExt.getGenerationInfoPath(_subSystemClass_3); + SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); + String _path_1 = this.roomExt.getPath(_subSystemClass_4); + final String infopath = (_generationInfoPath + _path_1); + String _cppClassName = this._cppExtensions.getCppClassName(nr, ssi); + String _plus = (_cppClassName + "Runner.h"); + CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi); + this.fileIO.generateFile("generating SubSystemRunner declaration", filepath, infopath, _plus, _generateHeaderFile); + String _cppClassName_1 = this._cppExtensions.getCppClassName(nr, ssi); + String _plus_1 = (_cppClassName_1 + "Runner.cpp"); + CharSequence _generateSourceFile = this.generateSourceFile(root, ssi); + this.fileIO.generateFile("generating SubSystemRunner implementation", filepath, infopath, _plus_1, _generateSourceFile); + } + } + } + } + } + + public CharSequence generateHeaderFile(final Root root, final SubSystemInstance ssc) { + CharSequence _xblockexpression = null; + { + final NodeRef nr = ETMapUtil.getNodeRef(ssc); + final String clsname = this._cppExtensions.getCppClassName(nr, ssc); + 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("* this class contains the main function running component "); + String _name = ssc.getName(); + _builder.append(_name, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("* it instantiates "); + String _name_1 = ssc.getName(); + _builder.append(_name_1, " "); + _builder.append(" and starts and ends the lifecycle"); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin((clsname + "Runner")); + _builder.append(_generateIncludeGuardBegin, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("#include \"common/modelbase/SubSystemRunnerBase.h\""); + _builder.newLine(); + _builder.newLine(); + _builder.append("class "); + _builder.append((clsname + "Runner"), ""); + _builder.append(" : public etRuntime::SubSystemRunnerBase {"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd((clsname + "Runner")); + _builder.append(_generateIncludeGuardEnd, ""); + _builder.newLineIfNotEmpty(); + _xblockexpression = _builder; + } + return _xblockexpression; + } + + public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssc) { + CharSequence _xblockexpression = null; + { + final NodeRef nr = ETMapUtil.getNodeRef(ssc); + final String clsname = this._cppExtensions.getCppClassName(nr, ssc); + 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("* this class contains the main function running component "); + String _name = ssc.getName(); + _builder.append(_name, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("* it instantiates "); + String _name_1 = ssc.getName(); + _builder.append(_name_1, " "); + _builder.append(" and starts and ends the lifecycle"); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + _builder.newLine(); + _builder.append("#include \""); + _builder.append(clsname, ""); + _builder.append("Runner.h\""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("#include \""); + _builder.append(clsname, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); + _builder.append("#include \"common/modelbase/RTSystem.h\""); + _builder.newLine(); + _builder.newLine(); + _builder.append("using namespace etRuntime;"); + _builder.newLine(); + _builder.newLine(); + _builder.append("/**"); + _builder.newLine(); + _builder.append(" "); + _builder.append("* main function"); + _builder.newLine(); + _builder.append(" "); + _builder.append("* creates component and starts and stops the lifecycle"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.append("int main(int argc, char* argv[]) {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// instantiate the main component"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("RTSystem* sys = "); + { + EObject _eContainer = ssc.eContainer(); + if ((_eContainer instanceof SystemInstance)) { + _builder.append("new RTSystem(\""); + EObject _eContainer_1 = ssc.eContainer(); + String _name_2 = ((SystemInstance) _eContainer_1).getName(); + _builder.append(_name_2, "\t"); + _builder.append("\")"); + } else { + _builder.append("0"); + } + } + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append(clsname, "\t"); + _builder.append("* main_component = new "); + _builder.append(clsname, "\t"); + _builder.append("(sys, \""); + String _name_3 = ssc.getName(); + _builder.append(_name_3, "\t"); + _builder.append("\");"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append(clsname, "\t"); + _builder.append("Runner::run(*main_component, argc, argv);"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// TODO JH crash"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("//delete sys;"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("return 0;"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.newLine(); + _xblockexpression = _builder; + } + return _xblockexpression; + } +} 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 4cb5c5ba6..bf8c8d675 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 @@ -11,9 +11,9 @@ package org.eclipse.etrice.generator.cpp.gen; import com.google.common.base.Objects; +import com.google.common.collect.Iterables; import com.google.inject.Inject; import com.google.inject.Singleton; -import java.util.ArrayList; import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.etrice.core.fsm.fSM.DetailCode; @@ -30,34 +30,34 @@ import org.eclipse.etrice.core.room.MessageHandler; import org.eclipse.etrice.core.room.Port; import org.eclipse.etrice.core.room.PortClass; import org.eclipse.etrice.core.room.PortOperation; -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.RoomModel; import org.eclipse.etrice.core.room.SAP; import org.eclipse.etrice.core.room.SPP; import org.eclipse.etrice.core.room.VarDecl; +import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; import org.eclipse.etrice.generator.cpp.Main; import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.cpp.gen.GeneratorSettings; import org.eclipse.etrice.generator.cpp.gen.Initialization; +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; +import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator; import org.eclipse.etrice.generator.generic.ProcedureHelpers; import org.eclipse.etrice.generator.generic.RoomExtensions; 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.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; +import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.eclipse.xtext.xbase.lib.ListExtensions; -/** - * @author Peter Karlitschek - */ @Singleton @SuppressWarnings("all") public class ProtocolClassGen extends GenericProtocolClassGenerator { @Inject - @Extension - private JavaIoFileSystemAccess fileAccess; + private IGeneratorFileIo fileIO; @Inject @Extension @@ -80,40 +80,59 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { private Initialization _initialization; @Inject + @Extension + private FileSystemHelpers _fileSystemHelpers; + + @Inject private ILogger logger; public void doGenerate(final Root root) { EList<ProtocolClass> _usedProtocolClasses = root.getUsedProtocolClasses(); - for (final ProtocolClass pc : _usedProtocolClasses) { + final Function1<ProtocolClass, Boolean> _function = new Function1<ProtocolClass, Boolean>() { + public Boolean apply(final ProtocolClass cl) { + return Boolean.valueOf(ProtocolClassGen.this._fileSystemHelpers.isValidGenerationLocation(cl)); + } + }; + Iterable<ProtocolClass> _filter = IterableExtensions.<ProtocolClass>filter(_usedProtocolClasses, _function); + for (final ProtocolClass pc : _filter) { { String _generationTargetPath = this.roomExt.getGenerationTargetPath(pc); String _path = this.roomExt.getPath(pc); - String path = (_generationTargetPath + _path); - String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); - String _plus = ("generating ProtocolClass header \'" + _cppHeaderFileName); - String _plus_1 = (_plus + "\' in \'"); - String _plus_2 = (_plus_1 + path); - String _plus_3 = (_plus_2 + "\'"); - this.logger.logInfo(_plus_3); - this.fileAccess.setOutputPath(path); - String _cppHeaderFileName_1 = this.stdExt.getCppHeaderFileName(pc); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, pc); - this.fileAccess.generateFile(_cppHeaderFileName_1, _generateHeaderFile); - String _cppSourceFileName = this.stdExt.getCppSourceFileName(pc); - String _plus_4 = ("generating ProtocolClass source \'" + _cppSourceFileName); - String _plus_5 = (_plus_4 + "\' in \'"); - String _plus_6 = (_plus_5 + path); - String _plus_7 = (_plus_6 + "\'"); - this.logger.logInfo(_plus_7); - this.fileAccess.setOutputPath(path); - String _cppSourceFileName_1 = this.stdExt.getCppSourceFileName(pc); - CharSequence _generateSourceFile = this.generateSourceFile(root, pc); - this.fileAccess.generateFile(_cppSourceFileName_1, _generateSourceFile); + final String path = (_generationTargetPath + _path); + String _generationInfoPath = this.roomExt.getGenerationInfoPath(pc); + String _path_1 = this.roomExt.getPath(pc); + final String infopath = (_generationInfoPath + _path_1); + CommunicationType _commType = pc.getCommType(); + if (_commType != null) { + switch (_commType) { + case EVENT_DRIVEN: + String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); + CharSequence _generateHeaderFile = this.generateHeaderFile(root, pc); + this.fileIO.generateFile("generating ProtocolClass declaration", path, infopath, _cppHeaderFileName, _generateHeaderFile); + String _cppSourceFileName = this.stdExt.getCppSourceFileName(pc); + CharSequence _generateSourceFile = this.generateSourceFile(root, pc); + this.fileIO.generateFile("generating ProtocolClass implementation", path, infopath, _cppSourceFileName, _generateSourceFile); + break; + case DATA_DRIVEN: + String _cppHeaderFileName_1 = this.stdExt.getCppHeaderFileName(pc); + CharSequence _generateDataDrivenHeaderFile = this.generateDataDrivenHeaderFile(root, pc); + this.fileIO.generateFile("generating ProtocolClass declaration", path, infopath, _cppHeaderFileName_1, _generateDataDrivenHeaderFile); + String _cppSourceFileName_1 = this.stdExt.getCppSourceFileName(pc); + CharSequence _generateDataDrivenSourceFile = this.generateDataDrivenSourceFile(root, pc); + this.fileIO.generateFile("generating ProtocolClass implementation", path, infopath, _cppSourceFileName_1, _generateDataDrivenSourceFile); + break; + case SYNCHRONOUS: + this.logger.logError("synchronous protocols not supported yet", pc); + break; + default: + break; + } + } } } } - private CharSequence generateHeaderFile(final Root root, final ProtocolClass pc) { + protected CharSequence generateHeaderFile(final Root root, final ProtocolClass pc) { StringConcatenation _builder = new StringConcatenation(); _builder.append("/**"); _builder.newLine(); @@ -129,7 +148,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(_name, " "); _builder.newLineIfNotEmpty(); _builder.append(" "); - _builder.append("* "); + _builder.append("*"); _builder.newLine(); _builder.append(" "); _builder.append("*/"); @@ -140,36 +159,20 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(_generateIncludeGuardBegin, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); - _builder.append("#include \"platforms/generic/etDatatypes.h\""); - _builder.newLine(); - _builder.append("#include \"common/messaging/IRTObject.h\""); + _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); _builder.newLine(); _builder.append("#include \"common/modelbase/PortBase.h\""); _builder.newLine(); - _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); + _builder.append("#include \"common/modelbase/ReplicatedInterfaceItemBase.h\""); _builder.newLine(); - _builder.append("#include \"common/messaging/Address.h\""); + _builder.append("#include \"common/modelbase/ReplicatedPortBase.h\""); _builder.newLine(); - _builder.append("#include \"common/messaging/Message.h\""); - _builder.newLine(); - _builder.append("#include <vector>"); + _builder.append("#include <etDatatypes.h>"); _builder.newLine(); _builder.append("#include <string>"); _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("namespace etRuntime {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("class IEventReceiver;"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); _builder.newLine(); - DetailCode _userCode1 = pc.getUserCode1(); - CharSequence _userCode = this.helpers.userCode(_userCode1); + CharSequence _userCode = this.helpers.userCode(pc, 1); _builder.append(_userCode, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); @@ -194,98 +197,95 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(" "); _builder.append("public:"); _builder.newLine(); + _builder.append("\t\t"); + _builder.append("/* message IDs */"); + _builder.newLine(); + _builder.append("\t\t"); + String _genMessageIDs = this.genMessageIDs(pc); + _builder.append(_genMessageIDs, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + CharSequence _userCode_1 = this.helpers.userCode(pc, 2); + _builder.append(_userCode_1, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("static bool isValidEvtID(int evtId) {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("return ((MSG_MIN < evtId) && (evtId < MSG_MAX));"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("static bool isValidOutgoingEvtID(int evtId) {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("return ((MSG_MIN < evtId) && (evtId < "); { - CommunicationType _commType = pc.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN); + EList<Message> _incomingMessages = pc.getIncomingMessages(); + int _size = _incomingMessages.size(); + boolean _equals = (_size == 0); if (_equals) { - _builder.append("\t /* message IDs */"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - String _genMessageIDs = this.genMessageIDs(pc); - _builder.append(_genMessageIDs, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("static bool isValidEvtID(int evtId) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return ((MSG_MIN < evtId) && (evtId < MSG_MAX));"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("};"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static bool isValidOutgoingEvtID(int evtId) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return ((MSG_MIN < evtId) && (evtId < "); - { - EList<Message> _incomingMessages = pc.getIncomingMessages(); - int _size = _incomingMessages.size(); - boolean _equals_1 = (_size == 0); - if (_equals_1) { - _builder.append("MSG_MAX"); - } else { - _builder.append("IN_"); - EList<Message> _incomingMessages_1 = pc.getIncomingMessages(); - Message _get = _incomingMessages_1.get(0); - String _name_4 = _get.getName(); - _builder.append(_name_4, "\t\t\t"); - } - } - _builder.append("));"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("};"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static bool isValidIncomingEvtID(int evtId) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("return (("); - { - EList<Message> _incomingMessages_2 = pc.getIncomingMessages(); - int _size_1 = _incomingMessages_2.size(); - boolean _equals_2 = (_size_1 == 0); - if (_equals_2) { - _builder.append("MSG_MAX"); - } else { - _builder.append("IN_"); - EList<Message> _incomingMessages_3 = pc.getIncomingMessages(); - Message _get_1 = _incomingMessages_3.get(0); - String _name_5 = _get_1.getName(); - _builder.append(_name_5, "\t\t\t"); - } - } - _builder.append(" <= evtId) && (evtId < MSG_MAX));"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("};"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static std::string getMessageString(int msg_id);"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("static std::string s_messageStrings[];"); - _builder.newLine(); + _builder.append("MSG_MAX"); + } else { + _builder.append("IN_"); + EList<Message> _incomingMessages_1 = pc.getIncomingMessages(); + Message _get = _incomingMessages_1.get(0); + String _name_4 = _get.getName(); + _builder.append(_name_4, "\t\t\t"); } } + _builder.append("));"); + _builder.newLineIfNotEmpty(); _builder.append("\t\t"); - DetailCode _userCode2 = pc.getUserCode2(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("static bool isValidIncomingEvtID(int evtId) {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("return (("); + { + EList<Message> _incomingMessages_2 = pc.getIncomingMessages(); + int _size_1 = _incomingMessages_2.size(); + boolean _equals_1 = (_size_1 == 0); + if (_equals_1) { + _builder.append("MSG_MAX"); + } else { + _builder.append("IN_"); + EList<Message> _incomingMessages_3 = pc.getIncomingMessages(); + Message _get_1 = _incomingMessages_3.get(0); + String _name_5 = _get_1.getName(); + _builder.append(_name_5, "\t\t\t"); + } + } + _builder.append(" <= evtId) && (evtId < MSG_MAX));"); _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("static const std::string& getMessageString(int msg_id);"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("private:"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("static const std::string s_messageStrings[];"); + _builder.newLine(); + _builder.newLine(); + _builder.newLine(); _builder.append("};"); _builder.newLine(); _builder.newLine(); - CharSequence _portClassDeclaration = this.portClassDeclaration(pc, Boolean.valueOf(false)); + CharSequence _portClassDeclaration = this.portClassDeclaration(pc, false); _builder.append(_portClassDeclaration, ""); _builder.newLineIfNotEmpty(); - CharSequence _portClassDeclaration_1 = this.portClassDeclaration(pc, Boolean.valueOf(true)); + CharSequence _portClassDeclaration_1 = this.portClassDeclaration(pc, true); _builder.append(_portClassDeclaration_1, ""); _builder.newLineIfNotEmpty(); String _name_6 = pc.getName(); @@ -295,18 +295,18 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _builder; } - private CharSequence portClassDeclaration(final ProtocolClass pc, final Boolean conj) { + protected CharSequence portClassDeclaration(final ProtocolClass pc, final boolean conj) { CharSequence _xblockexpression = null; { - PortClass pclass = this.roomExt.getPortClass(pc, (conj).booleanValue()); - String portClassName = this.roomExt.getPortClassName(pc, (conj).booleanValue()); - String replPortClassName = this.roomExt.getPortClassName(pc, (conj).booleanValue(), true); + PortClass pclass = this.roomExt.getPortClass(pc, conj); + String portClassName = this.roomExt.getPortClassName(pc, conj); + String replPortClassName = this.roomExt.getPortClassName(pc, conj, true); StringConcatenation _builder = new StringConcatenation(); _builder.append("//------------------------------------------------------------------------------------------------------------"); _builder.newLine(); _builder.append("// "); { - if ((conj).booleanValue()) { + if (conj) { _builder.append("conjugated "); } } @@ -331,20 +331,28 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(" "); _builder.append("public:"); _builder.newLine(); - _builder.append("\t"); - _builder.append("// constructors"); - _builder.newLine(); _builder.append("\t "); _builder.append(portClassName, "\t "); - _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); "); + _builder.append("(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId);"); _builder.newLineIfNotEmpty(); _builder.append("\t "); _builder.append(portClassName, "\t "); - _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true);"); + _builder.append("(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId, int idx);"); _builder.newLineIfNotEmpty(); _builder.newLine(); + { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { + _builder.append("\t"); + _builder.append("virtual void destroy();"); + _builder.newLine(); + } + } + _builder.newLine(); _builder.append("\t "); - _builder.append("virtual void receive(etRuntime::Message* m);"); + _builder.append("virtual void receive(const etRuntime::Message* m);"); + _builder.newLine(); _builder.newLine(); { boolean _notEquals_1 = (!Objects.equal(pclass, null)); @@ -361,17 +369,17 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); - _builder.append("\t "); - _builder.append("// outgoing messages"); + _builder.append("\t "); + _builder.append("// sent messages"); _builder.newLine(); { - List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, (conj).booleanValue()); + List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, conj); for(final Message m : _allMessages) { _builder.append("\t"); - CharSequence _sendMessageDeclaration = this.sendMessageDeclaration(m, (conj).booleanValue()); - _builder.append(_sendMessageDeclaration, "\t"); + CharSequence _messageSignature = this.messageSignature(m); + _builder.append(_messageSignature, "\t"); + _builder.append(";"); _builder.newLineIfNotEmpty(); } } @@ -382,7 +390,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLine(); _builder.append("// "); { - if ((conj).booleanValue()) { + if (conj) { _builder.append("conjugated "); } } @@ -392,17 +400,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLine(); _builder.append("class "); _builder.append(replPortClassName, ""); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("int m_replication;"); - _builder.newLine(); - _builder.append("\t "); - _builder.append(portClassName, "\t "); - _builder.append("* m_ports; //dynamic array used instead of vector to avoid copy construction"); + _builder.append(" : public etRuntime::ReplicatedPortBase {"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t"); @@ -410,47 +408,68 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLine(); _builder.append("\t\t"); _builder.append(replPortClassName, "\t\t"); - _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress);"); + _builder.append("(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId);"); _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("virtual ~"); - _builder.append(replPortClassName, "\t\t"); - _builder.append("() {};"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); - _builder.append("int getReplication() {\treturn m_replication; }"); + _builder.append("int getReplication() const { return getNInterfaceItems(); }"); _builder.newLine(); _builder.append("\t\t"); - _builder.append("int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx();\t}"); + _builder.append("int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); }"); _builder.newLine(); _builder.append("\t\t"); _builder.append(portClassName, "\t\t"); - _builder.append(" get(int i) {return m_ports[i];}"); + _builder.append("& get(int idx) const { return *dynamic_cast<"); + _builder.append(portClassName, "\t\t"); + _builder.append("*>(getInterfaceItem(idx)); }"); _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); _builder.newLine(); { - CommunicationType _commType = pc.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN); - if (_equals) { + if (conj) { + _builder.append("\t\t"); + _builder.append("// incoming messages"); + _builder.newLine(); + { + List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); + for(final Message m_1 : _allIncomingMessages) { + _builder.append("\t\t"); + CharSequence _messageSignature_1 = this.messageSignature(m_1); + _builder.append(_messageSignature_1, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + } + } + } else { _builder.append("\t\t"); - _builder.append(" "); _builder.append("// outgoing messages"); _builder.newLine(); { - List<Message> _allMessages_1 = this._roomHelpers.getAllMessages(pc, (conj).booleanValue()); - for(final Message m_1 : _allMessages_1) { + List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); + for(final Message m_2 : _allOutgoingMessages) { _builder.append("\t\t"); - CharSequence _sendMessageDeclaration_1 = this.sendMessageDeclaration(m_1, (conj).booleanValue()); - _builder.append(_sendMessageDeclaration_1, "\t\t"); + CharSequence _messageSignature_2 = this.messageSignature(m_2); + _builder.append(_messageSignature_2, "\t\t"); + _builder.append(";"); _builder.newLineIfNotEmpty(); } } } } + _builder.newLine(); + _builder.append("\t"); + _builder.append("protected:"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) {"); + _builder.newLine(); + _builder.append("\t\t\t"); + _builder.append("return new "); + _builder.append(portClassName, "\t\t\t"); + _builder.append("(rcv, name, lid, idx);"); + _builder.newLineIfNotEmpty(); _builder.append("\t\t"); + _builder.append("}"); + _builder.newLine(); _builder.newLine(); _builder.append("};"); _builder.newLine(); @@ -459,118 +478,140 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _xblockexpression; } - private CharSequence generateSourceFile(final Root root, final ProtocolClass pc) { + protected CharSequence generateSourceFile(final Root root, final ProtocolClass pc) { StringConcatenation _builder = new StringConcatenation(); - _builder.append("\t"); _builder.append("/**"); _builder.newLine(); - _builder.append("\t "); + _builder.append(" "); _builder.append("* @author generated by eTrice"); _builder.newLine(); - _builder.append("\t "); + _builder.append(" "); _builder.append("*"); _builder.newLine(); - _builder.append("\t "); + _builder.append(" "); _builder.append("* Source File of ProtocolClass "); String _name = pc.getName(); - _builder.append(_name, "\t "); + _builder.append(_name, " "); _builder.newLineIfNotEmpty(); - _builder.append("\t "); - _builder.append("* "); + _builder.append(" "); + _builder.append("*"); _builder.newLine(); - _builder.append("\t "); + _builder.append(" "); _builder.append("*/"); _builder.newLine(); _builder.newLine(); - _builder.append("\t"); _builder.append("#include \""); String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); - _builder.append(_cppHeaderFileName, "\t"); + _builder.append(_cppHeaderFileName, ""); _builder.append("\""); _builder.newLineIfNotEmpty(); - _builder.append("\t"); + _builder.newLine(); _builder.append("#include \"common/debugging/DebuggingService.h\""); _builder.newLine(); - _builder.append("\t"); + _builder.append("#include \"common/messaging/AbstractMessageReceiver.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/Address.h\""); + _builder.newLine(); + _builder.append("#include \"common/messaging/Message.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/IEventReceiver.h\""); + _builder.newLine(); _builder.append("#include <iostream>"); _builder.newLine(); - { - GeneratorSettings _settings = Main.getSettings(); - boolean _isUseEtUnit = _settings.isUseEtUnit(); - if (_isUseEtUnit) { - _builder.append("\t"); - _builder.append("extern \"C\" {"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append("#include \"etUnit.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - } - } + _builder.append("#include <iterator>"); + _builder.newLine(); + _builder.append("#include <string>"); + _builder.newLine(); + _builder.append("#include <vector>"); + _builder.newLine(); _builder.newLine(); - _builder.append("\t"); _builder.append("using namespace etRuntime;"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); - _builder.append("\t"); - DetailCode _userCode3 = pc.getUserCode3(); - CharSequence _userCode = this.helpers.userCode(_userCode3); - _builder.append(_userCode, "\t"); + _builder.newLine(); + CharSequence _userCode = this.helpers.userCode(pc, 3); + _builder.append(_userCode, ""); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); + _builder.append("/* message names as strings for debugging (generate MSC) */"); + _builder.newLine(); + _builder.append("const std::string "); + String _name_1 = pc.getName(); + _builder.append(_name_1, ""); + _builder.append("::s_messageStrings[] = {\"MIN\", "); { - CommunicationType _commType = pc.getCommType(); - boolean _equals = Objects.equal(_commType, CommunicationType.EVENT_DRIVEN); - if (_equals) { - _builder.append("\t"); - DetailCode _userCode2 = pc.getUserCode2(); - CharSequence _userCode_1 = this.helpers.userCode(_userCode2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - CharSequence _portClassImplementation = this.portClassImplementation(pc, Boolean.valueOf(false)); - _builder.append(_portClassImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _portClassImplementation_1 = this.portClassImplementation(pc, Boolean.valueOf(true)); - _builder.append(_portClassImplementation_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/*--------------------- debug helpers */"); - _builder.newLine(); - _builder.append("\t"); - CharSequence _generateDebugHelpersImplementation = this.generateDebugHelpersImplementation(root, pc); - _builder.append(_generateDebugHelpersImplementation, "\t"); - _builder.newLineIfNotEmpty(); + List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); + for(final Message m : _allOutgoingMessages) { + _builder.append("\""); + String _name_2 = m.getName(); + _builder.append(_name_2, ""); + _builder.append("\","); + } + } + _builder.append(" "); + { + List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); + for(final Message m_1 : _allIncomingMessages) { + _builder.append("\""); + String _name_3 = m_1.getName(); + _builder.append(_name_3, ""); + _builder.append("\","); } } + _builder.append("\"MAX\"};"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("const std::string& "); + String _name_4 = pc.getName(); + _builder.append(_name_4, ""); + _builder.append("::getMessageString(int msg_id) {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("return s_messageStrings[msg_id];"); + _builder.newLine(); _builder.append("\t"); + _builder.append("} else {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("// id out of range"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("static const std::string errorMsg = \"Message ID out of range\";"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("return errorMsg;"); _builder.newLine(); _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + CharSequence _portClassImplementation = this.portClassImplementation(pc, false); + _builder.append(_portClassImplementation, ""); + _builder.newLineIfNotEmpty(); + CharSequence _portClassImplementation_1 = this.portClassImplementation(pc, true); + _builder.append(_portClassImplementation_1, ""); + _builder.newLineIfNotEmpty(); _builder.newLine(); return _builder; } - public CharSequence portClassImplementation(final ProtocolClass pc, final Boolean conj) { + protected CharSequence portClassImplementation(final ProtocolClass pc, final boolean conj) { CharSequence _xblockexpression = null; { - PortClass pclass = this.roomExt.getPortClass(pc, (conj).booleanValue()); - String portClassName = this.roomExt.getPortClassName(pc, (conj).booleanValue()); - String replPortClassName = this.roomExt.getPortClassName(pc, (conj).booleanValue(), true); + PortClass pclass = this.roomExt.getPortClass(pc, conj); + String portClassName = this.roomExt.getPortClassName(pc, conj); + String replPortClassName = this.roomExt.getPortClassName(pc, conj, true); StringConcatenation _builder = new StringConcatenation(); _builder.append("//------------------------------------------------------------------------------------------------------------"); _builder.newLine(); _builder.append("// "); { - if ((conj).booleanValue()) { + if (conj) { _builder.append("conjugated "); } } @@ -582,12 +623,11 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(portClassName, ""); _builder.append("::"); _builder.append(portClassName, ""); - _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress, bool doRegistration)"); + _builder.append("(IInterfaceItemOwner* actor, const std::string& name, int localId) :"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(": "); + _builder.append("\t\t"); String _generateConstructorInitalizerList = this.generateConstructorInitalizerList(pclass, "0"); - _builder.append(_generateConstructorInitalizerList, "\t"); + _builder.append(_generateConstructorInitalizerList, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("{"); _builder.newLine(); @@ -601,27 +641,26 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { } } _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if (doRegistration) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("DebuggingService::getInstance().addPortInstance(*this);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); + { + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addPortInstance(*this);"); + _builder.newLine(); + } + } _builder.append("}"); _builder.newLine(); _builder.newLine(); _builder.append(portClassName, ""); _builder.append("::"); _builder.append(portClassName, ""); - _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress, bool doRegistration)"); + _builder.append("(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx) :"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(": "); + _builder.append("\t\t"); String _generateConstructorInitalizerList_1 = this.generateConstructorInitalizerList(pclass, "idx"); - _builder.append(_generateConstructorInitalizerList_1, "\t"); + _builder.append(_generateConstructorInitalizerList_1, "\t\t"); _builder.newLineIfNotEmpty(); _builder.append("{"); _builder.newLine(); @@ -635,30 +674,51 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { } } _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if (doRegistration) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("DebuggingService::getInstance().addPortInstance(*this);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); + { + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_1) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addPortInstance(*this);"); + _builder.newLine(); + } + } _builder.append("}"); _builder.newLine(); - _builder.append("\t"); + { + GlobalGeneratorSettings _settings_2 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_2 = _settings_2.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_2) { + _builder.newLine(); + _builder.append("void "); + _builder.append(portClassName, ""); + _builder.append("::destroy() {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().removePortInstance(*this);"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("PortBase::destroy();"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + } + } _builder.newLine(); _builder.append("void "); _builder.append(portClassName, ""); - _builder.append("::receive(Message* msg) {"); + _builder.append("::receive(const Message* msg) {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); + _builder.append("// TODO JH further"); + _builder.newLine(); + _builder.append("\t"); _builder.append("if (! "); String _name = pc.getName(); _builder.append(_name, "\t"); _builder.append("::"); { - if ((conj).booleanValue()) { + if (conj) { _builder.append("isValidOutgoingEvtID"); } else { _builder.append("isValidIncomingEvtID"); @@ -672,44 +732,41 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); - _builder.append("else {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("if (msg->hasDebugFlagSet()) {\t\t\t// TODO: model switch for activation of this flag"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), "); - String _name_1 = pc.getName(); - _builder.append(_name_1, "\t\t\t"); - _builder.append("::getMessageString(msg->getEvtId()));"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); _builder.newLine(); - _builder.append("\t\t"); + { + GlobalGeneratorSettings _settings_3 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_3 = _settings_3.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_3) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), "); + String _name_1 = pc.getName(); + _builder.append(_name_1, "\t"); + _builder.append("::getMessageString(msg->getEvtId()));"); + _builder.newLineIfNotEmpty(); + } + } _builder.newLine(); { - boolean _handlesReceive = this.roomExt.handlesReceive(pc, (conj).booleanValue()); + boolean _handlesReceive = this.roomExt.handlesReceive(pc, conj); if (_handlesReceive) { - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("switch (msg->getEvtId()) {"); _builder.newLine(); { - List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, (conj).booleanValue()); + List<MessageHandler> _receiveHandlers = this.roomExt.getReceiveHandlers(pc, conj); for(final MessageHandler hdlr : _receiveHandlers) { - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t"); _builder.append("case "); String _name_2 = pc.getName(); - _builder.append(_name_2, "\t\t\t"); + _builder.append(_name_2, "\t\t"); _builder.append("::"); Message _msg = hdlr.getMsg(); String _codeName = this.roomExt.getCodeName(_msg); - _builder.append(_codeName, "\t\t\t"); + _builder.append(_codeName, "\t\t"); _builder.append(":"); _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t"); _builder.append("\t"); _builder.append("{"); @@ -718,51 +775,48 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { DetailCode _detailCode = hdlr.getDetailCode(); EList<String> _lines = _detailCode.getLines(); for(final String command : _lines) { - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t"); _builder.append("\t\t"); - _builder.append(command, "\t\t\t\t\t"); + _builder.append(command, "\t\t\t\t"); _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t"); _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t"); _builder.append("\t"); _builder.append("break;"); _builder.newLine(); } } - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t"); _builder.append("default:"); _builder.newLine(); } } - _builder.append("\t\t\t\t"); - _builder.append("getEventReceiver().receiveEvent(this, msg->getEvtId(),\tmsg->getData());"); + _builder.append("\t"); + _builder.append("getActor()->receiveEvent(this, msg->getEvtId(),\tmsg->getData());"); _builder.newLine(); { - boolean _handlesReceive_1 = this.roomExt.handlesReceive(pc, (conj).booleanValue()); + boolean _handlesReceive_1 = this.roomExt.handlesReceive(pc, conj); if (_handlesReceive_1) { - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("\t\t"); _builder.append("break;"); _builder.newLine(); - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("}"); _builder.newLine(); } } - _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("};"); - _builder.newLine(); _builder.newLine(); { boolean _notEquals_2 = (!Objects.equal(pclass, null)); @@ -773,26 +827,24 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("// sent messages"); _builder.newLine(); { - List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, (conj).booleanValue()); + List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, conj); for(final Message m : _allMessages) { String _name_3 = pc.getName(); - CharSequence _sendMessage = this.sendMessage(m, _name_3, portClassName, (conj).booleanValue()); + CharSequence _sendMessage = this.sendMessage(m, _name_3, portClassName, conj); _builder.append(_sendMessage, ""); _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("//------------------------------------------------------------------------------------------------------------"); _builder.newLine(); _builder.append("// "); { - if ((conj).booleanValue()) { + if (conj) { _builder.append("conjugated "); } } @@ -803,72 +855,73 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(replPortClassName, ""); _builder.append("::"); _builder.append(replPortClassName, ""); - _builder.append("(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) "); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(": m_replication(addr.size()),"); - _builder.newLine(); - _builder.append(" \t "); - _builder.append("m_ports()"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("char numstr[10]; // enough to hold all numbers up to 32-bits"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("m_ports = reinterpret_cast<"); - _builder.append(portClassName, "\t"); - _builder.append("*> (new char[sizeof("); - _builder.append(portClassName, "\t"); - _builder.append(") * addr.size()]);"); + _builder.append("(IInterfaceItemOwner* actor, const std::string& name, int localId) :"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("for (int i = 0; i < m_replication; ++i) {"); - _builder.newLine(); _builder.append("\t\t"); - _builder.append("snprintf(numstr, sizeof(numstr), \"%d\", i);"); + _builder.append("ReplicatedPortBase(actor, name, localId)"); _builder.newLine(); - _builder.append("\t\t"); - _builder.append("//placement new to avoid copy construction, therefore no vector is used"); + _builder.append("{"); _builder.newLine(); - _builder.append("\t\t"); - _builder.append("new (&m_ports[i]) "); - _builder.append(portClassName, "\t\t"); - _builder.append("(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("// outgoing messages"); _builder.newLine(); { - List<Message> _allMessages_1 = this._roomHelpers.getAllMessages(pc, (conj).booleanValue()); - for(final Message m_1 : _allMessages_1) { - CharSequence _messageSignatureDefinition = this.messageSignatureDefinition(m_1, replPortClassName); - _builder.append(_messageSignatureDefinition, ""); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("for (int i=0; i<m_replication; ++i) {"); + if (conj) { + _builder.append("// incoming messages"); _builder.newLine(); - _builder.append("\t\t"); - _builder.append("m_ports[i]."); - CharSequence _messageCall = this.messageCall(m_1); - _builder.append(_messageCall, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); + { + List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); + for(final Message m_1 : _allIncomingMessages) { + CharSequence _messageSignatureDefinition = this.messageSignatureDefinition(m_1, replPortClassName); + _builder.append(_messageSignatureDefinition, ""); + _builder.append("{"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("(dynamic_cast<"); + _builder.append(portClassName, "\t\t"); + _builder.append("*>(*it))->"); + CharSequence _messageCall = this.messageCall(m_1); + _builder.append(_messageCall, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + } + } + } else { + _builder.append("// outgoing messages"); _builder.newLine(); + { + List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); + for(final Message m_2 : _allOutgoingMessages) { + CharSequence _messageSignatureDefinition_1 = this.messageSignatureDefinition(m_2, replPortClassName); + _builder.append(_messageSignatureDefinition_1, ""); + _builder.append("{"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("(dynamic_cast<"); + _builder.append(portClassName, "\t\t"); + _builder.append("*>(*it))->"); + CharSequence _messageCall_1 = this.messageCall(m_2); + _builder.append(_messageCall_1, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + } + } } } _xblockexpression = _builder; @@ -876,29 +929,28 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _xblockexpression; } - public String generateConstructorInitalizerList(final PortClass pc, final String index) { - ArrayList<CharSequence> initializerList = new ArrayList<CharSequence>(); + private String generateConstructorInitalizerList(final PortClass pc, final String index) { + final List<CharSequence> initList = CollectionLiterals.<CharSequence>newArrayList(); StringConcatenation _builder = new StringConcatenation(); - _builder.append("PortBase(actor, parent, name, localId, "); + _builder.append("PortBase(actor, name, localId, "); _builder.append(index, ""); - _builder.append(", addr, peerAddress)"); - initializerList.add(_builder); + _builder.append(")"); + initList.add(_builder.toString()); boolean _notEquals = (!Objects.equal(pc, null)); if (_notEquals) { EList<Attribute> _attributes = pc.getAttributes(); - for (final Attribute attrib : _attributes) { - CharSequence _attributeInitialization = this._initialization.attributeInitialization(attrib, false); - initializerList.add(_attributeInitialization); - } + final Function1<Attribute, CharSequence> _function = new Function1<Attribute, CharSequence>() { + public CharSequence apply(final Attribute it) { + return ProtocolClassGen.this._initialization.attributeInitialization(it, false); + } + }; + List<CharSequence> _map = ListExtensions.<Attribute, CharSequence>map(_attributes, _function); + Iterables.<CharSequence>addAll(initList, _map); } - StringConcatenation _builder_1 = new StringConcatenation(); - String _join = IterableExtensions.join(initializerList, ",\n"); - _builder_1.append(_join, ""); - _builder_1.newLineIfNotEmpty(); - return _builder_1.toString(); + return IterableExtensions.join(initList, ("," + this.roomExt.NEWLINE)); } - private CharSequence messageCall(final Message m) { + protected CharSequence messageCall(final Message m) { StringConcatenation _builder = new StringConcatenation(); String _name = m.getName(); _builder.append(_name, ""); @@ -917,75 +969,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _builder; } - private CharSequence generateDebugHelpersImplementation(final Root root, final ProtocolClass pc) { - StringConcatenation _builder = new StringConcatenation(); - _builder.newLine(); - _builder.append("/* message names as strings for debugging (generate MSC) */"); - _builder.newLine(); - _builder.append("std::string "); - String _name = pc.getName(); - _builder.append(_name, ""); - _builder.append("::s_messageStrings[] "); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("= {\"MIN\", "); - _builder.newLine(); - { - List<Message> _allOutgoingMessages = this._roomHelpers.getAllOutgoingMessages(pc); - for(final Message m : _allOutgoingMessages) { - _builder.append("\t\t "); - _builder.append("\""); - String _name_1 = m.getName(); - _builder.append(_name_1, "\t\t "); - _builder.append("\","); - _builder.newLineIfNotEmpty(); - } - } - { - List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); - for(final Message m_1 : _allIncomingMessages) { - _builder.append("\t\t "); - _builder.append("\""); - String _name_2 = m_1.getName(); - _builder.append(_name_2, "\t\t "); - _builder.append("\","); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t "); - _builder.append("\"MAX\"};"); - _builder.newLine(); - _builder.newLine(); - _builder.append("std::string "); - String _name_3 = pc.getName(); - _builder.append(_name_3, ""); - _builder.append("::getMessageString(int msg_id) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return s_messageStrings[msg_id];"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("} else {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("// id out of range"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("return \"Message ID out of range\";"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); - return _builder; - } - - public CharSequence messageSignature(final Message m) { + protected CharSequence messageSignature(final Message m) { StringConcatenation _builder = new StringConcatenation(); { boolean _isPriv = m.isPriv(); @@ -1018,60 +1002,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _builder; } - public CharSequence messageSignatureExplicit(final Message m) { - CharSequence _xblockexpression = null; - { - VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - DataClass dc = ((DataClass) _type); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("public: void "); - String _name = m.getName(); - _builder.append(_name, ""); - _builder.append("("); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - DataClass _base_1 = dc.getBase(); - String _typeName = this._typeHelpers.typeName(_base_1); - _builder.append(_typeName, ""); - _builder.append(" _super, "); - } - } - { - EList<Attribute> _attributes = dc.getAttributes(); - boolean _hasElements = false; - for(final Attribute a : _attributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - RefableType _type_1 = a.getType(); - DataType _type_2 = _type_1.getType(); - String _typeName_1 = this._typeHelpers.typeName(_type_2); - _builder.append(_typeName_1, ""); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name_1 = a.getName(); - _builder.append(_name_1, ""); - } - } - _builder.append(")"); - _xblockexpression = _builder; - } - return _xblockexpression; - } - - public CharSequence messageSignatureDefinition(final Message m, final String classPrefix) { + protected CharSequence messageSignatureDefinition(final Message m, final String classPrefix) { StringConcatenation _builder = new StringConcatenation(); _builder.append("void "); _builder.append(classPrefix, ""); @@ -1098,268 +1029,502 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _builder; } - public CharSequence messageSignatureExplicitDefinition(final Message m, final String classPrefix) { + protected CharSequence sendMessage(final Message m, final String portClassName, final String classPrefix, final boolean conj) { CharSequence _xblockexpression = null; { + String _xifexpression = null; + if (conj) { + _xifexpression = "IN"; + } else { + _xifexpression = "OUT"; + } + String dir = _xifexpression; + MessageHandler hdlr = this.roomExt.getSendHandler(m, conj); + String _xifexpression_1 = null; VarDecl _data = m.getData(); - RefableType _refType = _data.getRefType(); - DataType _type = _refType.getType(); - DataClass dc = ((DataClass) _type); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("void "); - _builder.append(classPrefix, ""); - _builder.append("::"); - String _name = m.getName(); - _builder.append(_name, ""); - _builder.append("("); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - DataClass _base_1 = dc.getBase(); - String _typeName = this._typeHelpers.typeName(_base_1); - _builder.append(_typeName, ""); - _builder.append(" _super, "); + boolean _notEquals = (!Objects.equal(_data, null)); + if (_notEquals) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append(", "); + { + VarDecl _data_1 = m.getData(); + RefableType _refType = _data_1.getRefType(); + boolean _isRef = _refType.isRef(); + if (_isRef) { + VarDecl _data_2 = m.getData(); + String _name = _data_2.getName(); + _builder.append(_name, ""); + } else { + _builder.append("&"); + VarDecl _data_3 = m.getData(); + String _name_1 = _data_3.getName(); + _builder.append(_name_1, ""); + _builder.append(", sizeof("); + VarDecl _data_4 = m.getData(); + RefableType _refType_1 = _data_4.getRefType(); + DataType _type = _refType_1.getType(); + String _typeName = this._typeHelpers.typeName(_type); + _builder.append(_typeName, ""); + _builder.append(")"); + } } + _xifexpression_1 = _builder.toString(); + } + final String dataArg = _xifexpression_1; + StringConcatenation _builder_1 = new StringConcatenation(); + _builder_1.append("new Message(getPeerAddress(), "); + _builder_1.append(portClassName, ""); + _builder_1.append("::"); + _builder_1.append(dir, ""); + _builder_1.append("_"); + String _name_2 = m.getName(); + _builder_1.append(_name_2, ""); + String _elvis = null; + if (dataArg != null) { + _elvis = dataArg; + } else { + _elvis = ""; } + _builder_1.append(_elvis, ""); + _builder_1.append(")"); + final String message = _builder_1.toString(); + StringConcatenation _builder_2 = new StringConcatenation(); + CharSequence _messageSignatureDefinition = this.messageSignatureDefinition(m, classPrefix); + _builder_2.append(_messageSignatureDefinition, ""); + _builder_2.append(" {"); + _builder_2.newLineIfNotEmpty(); { - EList<Attribute> _attributes = dc.getAttributes(); - boolean _hasElements = false; - for(final Attribute a : _attributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - RefableType _type_1 = a.getType(); - DataType _type_2 = _type_1.getType(); - String _typeName_1 = this._typeHelpers.typeName(_type_2); - _builder.append(_typeName_1, ""); + boolean _notEquals_1 = (!Objects.equal(hdlr, null)); + if (_notEquals_1) { + _builder_2.append("\t"); { - int _size = a.getSize(); - boolean _greaterThan = (_size > 1); - if (_greaterThan) { - _builder.append("[]"); + DetailCode _detailCode = hdlr.getDetailCode(); + EList<String> _lines = _detailCode.getLines(); + for(final String command : _lines) { + _builder_2.append("\t"); + _builder_2.append(command, "\t"); + _builder_2.newLineIfNotEmpty(); } } - _builder.append(" "); - String _name_1 = a.getName(); - _builder.append(_name_1, ""); + } else { + _builder_2.append("\t"); + _builder_2.append("DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),"); + _builder_2.newLine(); + _builder_2.append("\t"); + _builder_2.append("\t"); + _builder_2.append(portClassName, "\t\t"); + _builder_2.append("::getMessageString("); + _builder_2.append(portClassName, "\t\t"); + _builder_2.append("::"); + _builder_2.append(dir, "\t\t"); + _builder_2.append("_"); + String _name_3 = m.getName(); + _builder_2.append(_name_3, "\t\t"); + _builder_2.append("));"); + _builder_2.newLineIfNotEmpty(); + _builder_2.append("\t"); + _builder_2.append("if (getPeerAddress().isValid()){"); + _builder_2.newLine(); + _builder_2.append("\t"); + _builder_2.append("\t"); + _builder_2.append("getPeerMsgReceiver()->receive("); + _builder_2.append(message, "\t\t"); + _builder_2.append(");"); + _builder_2.newLineIfNotEmpty(); + _builder_2.append("\t"); + _builder_2.append("}"); + _builder_2.newLine(); } } - _builder.append(")"); - _xblockexpression = _builder; + _builder_2.append("}"); + _builder_2.newLine(); + _xblockexpression = _builder_2; } return _xblockexpression; } - public CharSequence sendMessageDeclaration(final Message m, final boolean conj) { - StringConcatenation _builder = new StringConcatenation(); - CharSequence _messageSignature = this.messageSignature(m); - _builder.append(_messageSignature, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - { - boolean _and = false; - VarDecl _data = m.getData(); - boolean _notEquals = (!Objects.equal(_data, null)); - if (!_notEquals) { - _and = false; - } else { - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - DataType _type = _refType.getType(); - _and = (_type instanceof DataClass); - } - if (_and) { - CharSequence _messageSignatureExplicit = this.messageSignatureExplicit(m); - _builder.append(_messageSignatureExplicit, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - return _builder; - } - - public CharSequence sendMessage(final Message m, final String portClassName, final String classPrefix, final boolean conj) { + protected CharSequence generateDataDrivenHeaderFile(final Root root, final ProtocolClass pc) { CharSequence _xblockexpression = null; { - String _xifexpression = null; - if (conj) { - _xifexpression = "IN"; - } else { - _xifexpression = "OUT"; - } - String dir = _xifexpression; - MessageHandler hdlr = this.roomExt.getSendHandler(m, conj); + List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); + final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + public Boolean apply(final Message m) { + VarDecl _data = m.getData(); + return Boolean.valueOf((!Objects.equal(_data, null))); + } + }; + final Iterable<Message> sentMsgs = IterableExtensions.<Message>filter(_allIncomingMessages, _function); + final EList<RoomModel> models = root.getReferencedModels(pc); StringConcatenation _builder = new StringConcatenation(); - CharSequence _messageSignatureDefinition = this.messageSignatureDefinition(m, classPrefix); - _builder.append(_messageSignatureDefinition, ""); + _builder.append("/**"); + _builder.newLine(); + _builder.append(" "); + _builder.append("* @author generated by eTrice"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("* Header File of ProtocolClass "); + String _name = pc.getName(); + _builder.append(_name, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + String _name_1 = pc.getName(); + CharSequence _generateIncludeGuardBegin = this.stdExt.generateIncludeGuardBegin(_name_1); + _builder.append(_generateIncludeGuardBegin, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("#include \"etDatatypes.h\""); + _builder.newLine(); + _builder.append("#include \"common/modelbase/DataPort.h\""); + _builder.newLine(); + { + EList<DataClass> _referencedDataClasses = root.getReferencedDataClasses(pc); + for(final DataClass dataClass : _referencedDataClasses) { + _builder.append("#include \""); + String _path = this.roomExt.getPath(dataClass); + _builder.append(_path, ""); + String _name_2 = dataClass.getName(); + _builder.append(_name_2, ""); + _builder.append(".h\""); + _builder.newLineIfNotEmpty(); + } + } + _builder.newLine(); + CharSequence _userCode = this.helpers.userCode(pc, 1); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.newLine(); + _builder.append("class "); + String _name_3 = pc.getName(); + _builder.append(_name_3, ""); _builder.append(" {"); _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + CharSequence _userCode_1 = this.helpers.userCode(pc, 2); + _builder.append(_userCode_1, "\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// send port holds data"); + _builder.newLine(); + _builder.append("class "); + String _portClassName = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName, ""); + _builder.append(" : public etRuntime::DataSendPort {"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("public:"); + _builder.newLine(); + _builder.append("\t"); + String _portClassName_1 = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName_1, "\t"); + _builder.append("(etRuntime::IRTObject* parent, const std::string& name, int localId);"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// getters and setters"); + _builder.newLine(); { - boolean _notEquals = (!Objects.equal(hdlr, null)); - if (_notEquals) { + for(final Message msg : sentMsgs) { _builder.append("\t"); - { - DetailCode _detailCode = hdlr.getDetailCode(); - EList<String> _lines = _detailCode.getLines(); - for(final String command : _lines) { - _builder.append("\t"); - _builder.append(command, "\t"); - _builder.newLineIfNotEmpty(); - } - } - } else { + _builder.append("void "); + String _name_4 = msg.getName(); + _builder.append(_name_4, "\t"); + _builder.append("("); + VarDecl _data = msg.getData(); + RefableType _refType = _data.getRefType(); + DataType _type = _refType.getType(); + String _typeName = this._typeHelpers.typeName(_type); + _builder.append(_typeName, "\t"); + _builder.append(" "); + String _name_5 = msg.getName(); + _builder.append(_name_5, "\t"); + _builder.append(") {"); + _builder.newLineIfNotEmpty(); _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),"); - _builder.newLine(); _builder.append("\t"); - _builder.append("\t\t\t\t\t\t\t\t\t\t\t\t "); - _builder.append(portClassName, "\t\t\t\t\t\t\t\t\t\t\t\t\t "); - _builder.append("::getMessageString("); - _builder.append(portClassName, "\t\t\t\t\t\t\t\t\t\t\t\t\t "); - _builder.append("::"); - _builder.append(dir, "\t\t\t\t\t\t\t\t\t\t\t\t\t "); - _builder.append("_"); - String _name = m.getName(); - _builder.append(_name, "\t\t\t\t\t\t\t\t\t\t\t\t\t "); - _builder.append("));"); + _builder.append("m_"); + String _name_6 = msg.getName(); + _builder.append(_name_6, "\t\t"); + _builder.append(" = "); + String _name_7 = msg.getName(); + _builder.append(_name_7, "\t\t"); + _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - _builder.append("if (getPeerAddress().isValid()){"); + _builder.append("}"); _builder.newLine(); _builder.append("\t"); + VarDecl _data_1 = msg.getData(); + RefableType _refType_1 = _data_1.getRefType(); + DataType _type_1 = _refType_1.getType(); + String _typeName_1 = this._typeHelpers.typeName(_type_1); + _builder.append(_typeName_1, "\t"); + _builder.append(" "); + String _name_8 = msg.getName(); + _builder.append(_name_8, "\t"); + _builder.append("() const {"); + _builder.newLineIfNotEmpty(); _builder.append("\t"); - { - VarDecl _data = m.getData(); - boolean _equals = Objects.equal(_data, null); - if (_equals) { - _builder.append("getPeerMsgReceiver()->receive(new Message(getPeerAddress(), "); - _builder.append(portClassName, "\t\t"); - _builder.append("::"); - _builder.append(dir, "\t\t"); - _builder.append("_"); - String _name_1 = m.getName(); - _builder.append(_name_1, "\t\t"); - _builder.append("));"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - } else { - _builder.append("getPeerMsgReceiver()->receive(new Message(getPeerAddress(),"); - _builder.append(portClassName, "\t\t"); - _builder.append("::"); - _builder.append(dir, "\t\t"); - _builder.append("_"); - String _name_2 = m.getName(); - _builder.append(_name_2, "\t\t"); - _builder.append(", "); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(" "); - _builder.append("reinterpret_cast<void*>("); - { - boolean _and = false; - VarDecl _data_1 = m.getData(); - RefableType _refType = _data_1.getRefType(); - boolean _isRef = _refType.isRef(); - boolean _not = (!_isRef); - if (!_not) { - _and = false; - } else { - _and = (!(m.getData().getRefType().getType() instanceof PrimitiveType)); - } - if (_and) { - _builder.append("&"); - } - } - VarDecl _data_2 = m.getData(); - String _name_3 = _data_2.getName(); - _builder.append(_name_3, "\t\t "); - _builder.append("),"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - _builder.append(" "); - _builder.append("sizeof("); - VarDecl _data_3 = m.getData(); - RefableType _refType_1 = _data_3.getRefType(); - DataType _type = _refType_1.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder.append(_typeName, "\t\t "); - _builder.append(")));"); - _builder.newLineIfNotEmpty(); - } - } + _builder.append("\t"); + _builder.append("return m_"); + String _name_9 = msg.getName(); + _builder.append(_name_9, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); } } - _builder.append("}"); _builder.newLine(); + _builder.append("private:"); _builder.newLine(); { - boolean _and_1 = false; - VarDecl _data_4 = m.getData(); - boolean _notEquals_1 = (!Objects.equal(_data_4, null)); - if (!_notEquals_1) { - _and_1 = false; - } else { - VarDecl _data_5 = m.getData(); - RefableType _refType_2 = _data_5.getRefType(); - DataType _type_1 = _refType_2.getType(); - _and_1 = (_type_1 instanceof DataClass); + for(final Message msg_1 : sentMsgs) { + _builder.append("\t"); + VarDecl _data_2 = msg_1.getData(); + RefableType _refType_2 = _data_2.getRefType(); + DataType _type_2 = _refType_2.getType(); + String _typeName_2 = this._typeHelpers.typeName(_type_2); + _builder.append(_typeName_2, "\t"); + _builder.append(" m_"); + String _name_10 = msg_1.getName(); + _builder.append(_name_10, "\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); } - if (_and_1) { - CharSequence _messageSignatureExplicitDefinition = this.messageSignatureExplicitDefinition(m, classPrefix); - _builder.append(_messageSignatureExplicitDefinition, ""); - _builder.append(" {"); + } + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// receive port accesses send port"); + _builder.newLine(); + _builder.append("class "); + String _portClassName_2 = this.roomExt.getPortClassName(pc, false); + _builder.append(_portClassName_2, ""); + _builder.append(" : public etRuntime::DataReceivePort {"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("public:"); + _builder.newLine(); + _builder.append("\t"); + String _portClassName_3 = this.roomExt.getPortClassName(pc, false); + _builder.append(_portClassName_3, "\t"); + _builder.append("(etRuntime::IRTObject* parent, const std::string& name, int localId);"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// getters"); + _builder.newLine(); + { + for(final Message msg_2 : sentMsgs) { + _builder.append("\t"); + VarDecl _data_3 = msg_2.getData(); + RefableType _refType_3 = _data_3.getRefType(); + DataType _type_3 = _refType_3.getType(); + String _typeName_3 = this._typeHelpers.typeName(_type_3); + _builder.append(_typeName_3, "\t"); + _builder.append(" "); + String _name_11 = msg_2.getName(); + _builder.append(_name_11, "\t"); + _builder.append("() const;"); + _builder.newLineIfNotEmpty(); + } + } + _builder.newLine(); + _builder.append("protected:"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("virtual void connect(etRuntime::DataSendPort* dataSendPort);"); + _builder.newLine(); + _builder.newLine(); + _builder.append("private:"); + _builder.newLine(); + _builder.append("\t"); + String _portClassName_4 = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName_4, "\t"); + _builder.append("* m_peer;"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("};"); + _builder.newLine(); + _builder.newLine(); + String _name_12 = pc.getName(); + CharSequence _generateIncludeGuardEnd = this.stdExt.generateIncludeGuardEnd(_name_12); + _builder.append(_generateIncludeGuardEnd, ""); + _builder.newLineIfNotEmpty(); + _xblockexpression = _builder; + } + return _xblockexpression; + } + + protected CharSequence generateDataDrivenSourceFile(final Root root, final ProtocolClass pc) { + CharSequence _xblockexpression = null; + { + List<Message> _allIncomingMessages = this._roomHelpers.getAllIncomingMessages(pc); + final Function1<Message, Boolean> _function = new Function1<Message, Boolean>() { + public Boolean apply(final Message m) { + VarDecl _data = m.getData(); + return Boolean.valueOf((!Objects.equal(_data, null))); + } + }; + final Iterable<Message> sentMsgs = IterableExtensions.<Message>filter(_allIncomingMessages, _function); + final EList<RoomModel> models = root.getReferencedModels(pc); + 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 ProtocolClass "); + String _name = pc.getName(); + _builder.append(_name, " "); + _builder.newLineIfNotEmpty(); + _builder.append(" "); + _builder.append("*"); + _builder.newLine(); + _builder.append(" "); + _builder.append("*/"); + _builder.newLine(); + _builder.newLine(); + _builder.append("#include \""); + String _cppHeaderFileName = this.stdExt.getCppHeaderFileName(pc); + _builder.append(_cppHeaderFileName, ""); + _builder.append("\""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("using namespace etRuntime;"); + _builder.newLine(); + _builder.newLine(); + CharSequence _userCode = this.helpers.userCode(pc, 3); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("// send port holds data"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// constructor"); + _builder.newLine(); + String _portClassName = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName, ""); + _builder.append("::"); + String _portClassName_1 = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName_1, ""); + _builder.append("(IRTObject* parent, const std::string& name, int localId) :"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("DataSendPort(parent, name, localId)"); + _builder.newLine(); + _builder.append("{"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// receive port accesses send port"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// constructor"); + _builder.newLine(); + String _portClassName_2 = this.roomExt.getPortClassName(pc, false); + _builder.append(_portClassName_2, ""); + _builder.append("::"); + String _portClassName_3 = this.roomExt.getPortClassName(pc, false); + _builder.append(_portClassName_3, ""); + _builder.append("(IRTObject* parent, const std::string& name, int localId) :"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("DataReceivePort(parent, name, localId),"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("m_peer(0)"); + _builder.newLine(); + _builder.append("{"); + _builder.newLine(); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("// getters"); + _builder.newLine(); + { + for(final Message msg : sentMsgs) { + VarDecl _data = msg.getData(); + RefableType _refType = _data.getRefType(); + DataType _type = _refType.getType(); + String _typeName = this._typeHelpers.typeName(_type); + _builder.append(_typeName, ""); + _builder.append(" "); + String _portClassName_4 = this.roomExt.getPortClassName(pc, false); + _builder.append(_portClassName_4, ""); + _builder.append("::"); + String _name_1 = msg.getName(); + _builder.append(_name_1, ""); + _builder.append("() const {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - String _name_4 = m.getName(); - _builder.append(_name_4, "\t"); - _builder.append("("); - VarDecl _data_6 = m.getData(); - RefableType _refType_3 = _data_6.getRefType(); - DataType _type_2 = _refType_3.getType(); - String _name_5 = _type_2.getName(); - _builder.append(_name_5, "\t"); - _builder.append("("); - { - VarDecl _data_7 = m.getData(); - RefableType _refType_4 = _data_7.getRefType(); - DataType _type_3 = _refType_4.getType(); - DataClass _base = ((DataClass) _type_3).getBase(); - boolean _notEquals_2 = (!Objects.equal(_base, null)); - if (_notEquals_2) { - _builder.append("_super, "); - } - } - { - VarDecl _data_8 = m.getData(); - RefableType _refType_5 = _data_8.getRefType(); - DataType _type_4 = _refType_5.getType(); - EList<Attribute> _attributes = ((DataClass) _type_4).getAttributes(); - boolean _hasElements = false; - for(final Attribute a : _attributes) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", "\t"); - } - String _name_6 = a.getName(); - _builder.append(_name_6, "\t"); - } - } - _builder.append("));"); + _builder.append("// TODO needs default value"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("//if (m_peer == 0)"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("/*\treturn "); + VarDecl _data_1 = msg.getData(); + RefableType _refType_1 = _data_1.getRefType(); + DataType _type_1 = _refType_1.getType(); + String _defaultValue = this.stdExt.defaultValue(_type_1); + _builder.append(_defaultValue, "\t"); + _builder.append("; */"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("return m_peer->"); + String _name_2 = msg.getName(); + _builder.append(_name_2, "\t"); + _builder.append("();"); _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); } } + _builder.newLine(); + _builder.append("void "); + String _portClassName_5 = this.roomExt.getPortClassName(pc, false); + _builder.append(_portClassName_5, ""); + _builder.append("::connect(DataSendPort* dataSendPort) {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + String _portClassName_6 = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName_6, "\t"); + _builder.append("* peer = dynamic_cast<"); + String _portClassName_7 = this.roomExt.getPortClassName(pc, true); + _builder.append(_portClassName_7, "\t"); + _builder.append("*>(dataSendPort);"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("if (peer != 0)"); + _builder.newLine(); + _builder.append("\t\t"); + _builder.append("m_peer = peer;"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); _xblockexpression = _builder; } return _xblockexpression; @@ -1403,7 +1568,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return "unknown interface item"; } - public String enumInUse(final String namespace, final String member) { + protected String enumInUse(final String namespace, final String member) { return ((namespace + "::") + member); } } diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java index 5120df49e..a8db021f9 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java +++ b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.java @@ -11,28 +11,22 @@ */ package org.eclipse.etrice.generator.cpp.gen; +import com.google.common.base.Objects; import com.google.inject.Inject; import com.google.inject.Singleton; import java.util.ArrayList; import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; -import org.eclipse.etrice.core.fsm.fSM.MessageFromIf; import org.eclipse.etrice.core.fsm.fSM.ModelComponent; import org.eclipse.etrice.core.fsm.fSM.State; import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.generator.cpp.gen.ProtocolClassGen; +import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; +import org.eclipse.etrice.generator.cpp.Main; import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator; import org.eclipse.etrice.generator.generic.RoomExtensions; import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.util.Pair; -import org.eclipse.xtext.util.Tuples; +import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Extension; -/** - * @author Peter Karlitschek - */ @Singleton @SuppressWarnings("all") public class StateMachineGen extends GenericStateMachineGenerator { @@ -40,125 +34,155 @@ public class StateMachineGen extends GenericStateMachineGenerator { @Extension private RoomExtensions _roomExtensions; - @Inject - private ProtocolClassGen cppProtGen; - - public CharSequence genExtraDecl(final ExpandedModelComponent xpac) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("protected:"); - _builder.newLine(); - _builder.append(" \t"); - _builder.append("static std::string s_stateStrings[];"); - _builder.newLine(); - _builder.append(" \t"); - _builder.append("static const int s_numberOfStates;"); - _builder.newLine(); - _builder.newLine(); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("void setState(int new_state);"); - _builder.newLine(); - return _builder; - } - - public CharSequence genExtra(final ExpandedModelComponent xpac) { + public CharSequence genExtra(final ExpandedModelComponent xpac, final boolean generateImplementation) { CharSequence _xblockexpression = null; { + final ArrayList<State> states = CollectionLiterals.<State>newArrayList(); + ModelComponent ac = xpac.getModelComponent(); ModelComponent _modelComponent = xpac.getModelComponent(); - final ActorClass ac = ((ActorClass) _modelComponent); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("std::string "); - String _name = ac.getName(); - _builder.append(_name, ""); - _builder.append("::s_stateStrings[] = {\"<no state>\",\"<top>\","); - { - List<State> _allBaseStatesLeavesLast = this._roomExtensions.getAllBaseStatesLeavesLast(ac); - boolean _hasElements = false; - for(final State state : _allBaseStatesLeavesLast) { - if (!_hasElements) { - _hasElements = true; + final String clsName = _modelComponent.getComponentName(); + while ((!Objects.equal(ac, null))) { + { + List<State> _allBaseStates = this._fSMHelpers.getAllBaseStates(ac); + List<State> _leafStatesLast = this._roomExtensions.getLeafStatesLast(_allBaseStates); + states.addAll(0, _leafStatesLast); + ModelComponent _base = ac.getBase(); + ac = _base; + } + } + CharSequence _xifexpression = null; + if (generateImplementation) { + StringConcatenation _builder = new StringConcatenation(); + { + boolean _or = false; + GlobalGeneratorSettings _settings = Main.getSettings(); + boolean _isGenerateMSCInstrumentation = _settings.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation) { + _or = true; } else { - _builder.appendImmediate(",", ""); + GlobalGeneratorSettings _settings_1 = Main.getSettings(); + boolean _isGenerateWithVerboseOutput = _settings_1.isGenerateWithVerboseOutput(); + _or = _isGenerateWithVerboseOutput; + } + if (_or) { + _builder.append("// state names"); + _builder.newLine(); + _builder.append("const std::string "); + _builder.append(clsName, ""); + _builder.append("::s_stateStrings[] = {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("\"<no state>\","); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\"<top>\","); + _builder.newLine(); + { + boolean _hasElements = false; + for(final State state : states) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(",", "\t"); + } + _builder.append("\t"); + _builder.append("\""); + String _genStatePathName = this._codegenHelpers.getGenStatePathName(state); + _builder.append(_genStatePathName, "\t"); + _builder.append("\""); + _builder.newLineIfNotEmpty(); + } + } + _builder.append("};"); + _builder.newLine(); + } + } + _builder.append("const int "); + _builder.append(clsName, ""); + _builder.append("::s_numberOfStates = "); + int _size = states.size(); + int _plus = (2 + _size); + _builder.append(_plus, ""); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("void "); + _builder.append(clsName, ""); + _builder.append("::setState(int new_state) {"); + _builder.newLineIfNotEmpty(); + { + GlobalGeneratorSettings _settings_2 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_1 = _settings_2.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_1) { + _builder.append("\t"); + _builder.append("DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]);"); + _builder.newLine(); } - _builder.append("\""); - String _genStatePathName = this._codegenHelpers.getGenStatePathName(state); - _builder.append(_genStatePathName, ""); - _builder.append("\""); - _builder.newLineIfNotEmpty(); } + { + GlobalGeneratorSettings _settings_3 = Main.getSettings(); + boolean _isGenerateWithVerboseOutput_1 = _settings_3.isGenerateWithVerboseOutput(); + if (_isGenerateWithVerboseOutput_1) { + _builder.append("\t"); + _builder.append("if (s_stateStrings[new_state] != \"Idle\") {"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("\t"); + _builder.append("std::cout << getInstancePath() << \" -> \" << s_stateStrings[new_state] << std::endl;"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + } + } + _builder.append("\t"); + _builder.append("m_state = new_state;"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + _xifexpression = _builder; + } else { + StringConcatenation _builder_1 = new StringConcatenation(); + { + boolean _or_1 = false; + GlobalGeneratorSettings _settings_4 = Main.getSettings(); + boolean _isGenerateMSCInstrumentation_2 = _settings_4.isGenerateMSCInstrumentation(); + if (_isGenerateMSCInstrumentation_2) { + _or_1 = true; + } else { + GlobalGeneratorSettings _settings_5 = Main.getSettings(); + boolean _isGenerateWithVerboseOutput_2 = _settings_5.isGenerateWithVerboseOutput(); + _or_1 = _isGenerateWithVerboseOutput_2; + } + if (_or_1) { + _builder_1.append("static const std::string s_stateStrings[];"); + _builder_1.newLine(); + } + } + _builder_1.append("static const int s_numberOfStates;"); + _builder_1.newLine(); + _builder_1.newLine(); + _builder_1.append("int history["); + int _size_1 = states.size(); + int _plus_1 = (2 + _size_1); + _builder_1.append(_plus_1, ""); + _builder_1.append("];"); + _builder_1.newLineIfNotEmpty(); + _builder_1.newLine(); + _builder_1.append("void setState(int new_state);"); + _builder_1.newLine(); + _xifexpression = _builder_1; } - _builder.append("};"); - _builder.newLineIfNotEmpty(); - _builder.append("const int "); - String _name_1 = ac.getName(); - _builder.append(_name_1, ""); - _builder.append("::s_numberOfStates = "); - List<State> _allBaseStatesLeavesLast_1 = this._roomExtensions.getAllBaseStatesLeavesLast(ac); - int _size = _allBaseStatesLeavesLast_1.size(); - int _plus = (_size + 2); - _builder.append(_plus, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("void "); - String _name_2 = ac.getName(); - _builder.append(_name_2, ""); - _builder.append("::setState(int new_state) {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]);"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("if (s_stateStrings[new_state]!=\"Idle\") {"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("std::cout << getInstancePath() << \" -> \" << s_stateStrings[new_state] << std::endl;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("m_state = new_state;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _xblockexpression = _builder; + _xblockexpression = _xifexpression; } return _xblockexpression; } - public String genTriggerConstants(final ExpandedModelComponent xpac) { - EList<MessageFromIf> _xifexpression = null; - boolean _usesInheritance = this.langExt.usesInheritance(); - if (_usesInheritance) { - _xifexpression = xpac.getOwnTriggers(); - } else { - _xifexpression = xpac.getTriggers(); - } - final EList<MessageFromIf> triggers = _xifexpression; - final ArrayList<Pair<String, String>> list = new ArrayList<Pair<String, String>>(); - Pair<String, String> _pair = Tuples.<String, String>pair("POLLING", "0"); - list.add(_pair); - for (final MessageFromIf mif : triggers) { - String _triggerCodeName = xpac.getTriggerCodeName(mif); - AbstractInterfaceItem _from = mif.getFrom(); - String _name = _from.getName(); - String _plus = ("IFITEM_" + _name); - String _plus_1 = (_plus + " + EVT_SHIFT*"); - String _messageID = this.cppProtGen.getMessageID(mif); - String _plus_2 = (_plus_1 + _messageID); - Pair<String, String> _pair_1 = Tuples.<String, String>pair(_triggerCodeName, _plus_2); - list.add(_pair_1); - } - return this.langExt.genEnumeration("triggers", list); - } - - public String constPointer(final String classname) { - return (("const " + classname) + "*"); + public String stateType() { + return "etInt16"; } public String boolType() { - return "bool"; + return "etBool"; } } diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.java deleted file mode 100644 index f8f6c1ca2..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemClassGen.java +++ /dev/null @@ -1,939 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; -import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; -import org.eclipse.etrice.core.room.ActorClass; -import org.eclipse.etrice.core.room.LogicalThread; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.base.IDataConfiguration; -import org.eclipse.etrice.generator.cpp.gen.ConfigGenAddon; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.fsm.base.Indexed; -import org.eclipse.etrice.generator.generic.ProcedureHelpers; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * @author Peter Karlitschek - */ -@Singleton -@SuppressWarnings("all") -public class SubSystemClassGen { - @Inject - private JavaIoFileSystemAccess fileAccess; - - @Inject - @Extension - private CppExtensions _cppExtensions; - - @Inject - @Extension - private RoomExtensions _roomExtensions; - - @Inject - @Extension - private ProcedureHelpers _procedureHelpers; - - @Inject - private IDataConfiguration dataConfigExt; - - @Inject - private ConfigGenAddon configGenAddon; - - @Inject - private ConfigGenAddon configAddon; - - @Inject - private ILogger logger; - - public void doGenerate(final Root root) { - EList<SubSystemInstance> _subSystemInstances = root.getSubSystemInstances(); - for (final SubSystemInstance ssi : _subSystemInstances) { - { - SubSystemClass _subSystemClass = ssi.getSubSystemClass(); - String _generationTargetPath = this._roomExtensions.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = ssi.getSubSystemClass(); - String _path = this._roomExtensions.getPath(_subSystemClass_1); - String path = (_generationTargetPath + _path); - SubSystemClass _subSystemClass_2 = ssi.getSubSystemClass(); - String file = this._cppExtensions.getCppHeaderFileName(_subSystemClass_2); - this.logger.logInfo((((("generating SubSystemClass declaration: \'" + file) + "\' in \'") + path) + "\'")); - this.fileAccess.setOutputPath(path); - SubSystemClass _subSystemClass_3 = ssi.getSubSystemClass(); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, ssi, _subSystemClass_3); - this.fileAccess.generateFile(file, _generateHeaderFile); - SubSystemClass _subSystemClass_4 = ssi.getSubSystemClass(); - String _cppSourceFileName = this._cppExtensions.getCppSourceFileName(_subSystemClass_4); - file = _cppSourceFileName; - this.logger.logInfo((((("generating SubSystemClass implementation: \'" + file) + "\' in \'") + path) + "\'")); - this.fileAccess.setOutputPath(path); - SubSystemClass _subSystemClass_5 = ssi.getSubSystemClass(); - CharSequence _generateSourceFile = this.generateSourceFile(root, ssi, _subSystemClass_5); - this.fileAccess.generateFile(file, _generateSourceFile); - } - } - } - - public CharSequence generateHeaderFile(final Root root, final SubSystemInstance comp, final SubSystemClass cc) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @author generated by eTrice"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* Header File of SubSystemClass "); - String _name = cc.getName(); - _builder.append(_name, "\t "); - _builder.newLineIfNotEmpty(); - _builder.append("\t "); - _builder.append("* "); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - String _name_1 = cc.getName(); - CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(_name_1); - _builder.append(_generateIncludeGuardBegin, "\t"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"platforms/generic/etDatatypes.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/IRTObject.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/PortBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/InterfaceItemBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/ActorClassBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/modelbase/SubSystemClassBase.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/Address.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/IMessageReceiver.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include <string>"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include <vector>"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - { - EList<RoomModel> _referencedModels = root.getReferencedModels(cc); - for(final RoomModel model : _referencedModels) { - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode = this._procedureHelpers.userCode(cc, 1, false); - _builder.append(_userCode, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("class "); - String _name_2 = cc.getName(); - _builder.append(_name_2, "\t"); - _builder.append(" : public etRuntime::SubSystemClassBase{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(cc, 2, false); - _builder.append(_userCode_1, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("public:"); - _builder.newLine(); - _builder.append("\t\t\t"); - String _name_3 = cc.getName(); - _builder.append(_name_3, "\t\t\t"); - _builder.append("(IRTObject* parent, std::string name)"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t\t\t"); - _builder.append(": etRuntime::SubSystemClassBase(parent, name)"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("virtual void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* data);"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("virtual void instantiateMessageServices();"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("virtual void instantiateActors();"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("std::vector<etRuntime::MessageService*> m_msgServices;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("};"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - String _name_4 = cc.getName(); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_name_4); - _builder.append(_generateIncludeGuardEnd, "\t"); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public CharSequence generateSourceFile(final Root root, final SubSystemInstance comp, final SubSystemClass cc) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @author generated by eTrice"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* Source File of SubsystemClass "); - String _name = cc.getName(); - _builder.append(_name, "\t "); - _builder.newLineIfNotEmpty(); - _builder.append("\t "); - _builder.append("* "); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \""); - String _cppHeaderFileName = this._cppExtensions.getCppHeaderFileName(cc); - _builder.append(_cppHeaderFileName, "\t"); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("#include \"common/debugging/DebuggingService.h\""); - _builder.newLine(); - _builder.append("\t"); - _builder.append("#include \"common/messaging/RTSystemServicesProtocol.h\""); - _builder.newLine(); - { - EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances(); - for(final ActorInstance ai : _allContainedInstances) { - _builder.append("\t"); - _builder.append("#include \""); - ActorClass _actorClass = ai.getActorClass(); - String _path = this._roomExtensions.getPath(_actorClass); - _builder.append(_path, "\t"); - ActorClass _actorClass_1 = ai.getActorClass(); - String _name_1 = _actorClass_1.getName(); - _builder.append(_name_1, "\t"); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("#include <iostream>"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("using namespace etRuntime;"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("void "); - String _name_2 = cc.getName(); - _builder.append(_name_2, "\t"); - _builder.append("::receiveEvent(InterfaceItemBase* ifitem, int evt, void* data){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("void "); - String _name_3 = cc.getName(); - _builder.append(_name_3, "\t"); - _builder.append("::instantiateMessageServices(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("m_msgServices.push_back( new MessageService(this, Address(0, 0, 0),\"MessageService_Main\") );"); - _builder.newLine(); - { - EList<LogicalThread> _threads = cc.getThreads(); - for(final LogicalThread thread : _threads) { - _builder.append("\t\t"); - _builder.append("m_msgServices.push_back(new MessageService(this, Address(0, "); - EList<LogicalThread> _threads_1 = cc.getThreads(); - int _indexOf = _threads_1.indexOf(thread); - int _plus = (_indexOf + 1); - _builder.append(_plus, "\t\t"); - _builder.append(", 0),\"MessageService_"); - String _name_4 = thread.getName(); - _builder.append(_name_4, "\t\t"); - _builder.append("\", /* threadprio */ 0));"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t\t"); - _builder.append("for (std::vector<MessageService*>::iterator it=m_msgServices.begin(); it != m_msgServices.end(); ++it) {"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("RTServices::getInstance().getMsgSvcCtrl().addMsgSvc( *(*it));"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("void "); - String _name_5 = cc.getName(); - _builder.append(_name_5, "\t"); - _builder.append("::instantiateActors(){"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// all addresses"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// Addresses for the Subsystem Systemport"); - _builder.newLine(); - { - EList<ActorInstance> _allContainedInstances_1 = comp.getAllContainedInstances(); - int _maxObjId = comp.getMaxObjId(); - Iterable<Indexed<ActorInstance>> _indexed = Indexed.<ActorInstance>indexed(_allContainedInstances_1, _maxObjId); - for(final Indexed<ActorInstance> ai_1 : _indexed) { - _builder.append("\t"); - _builder.append("Address addr_item_SystemPort_"); - EList<ActorInstance> _allContainedInstances_2 = comp.getAllContainedInstances(); - ActorInstance _value = ai_1.getValue(); - int _indexOf_1 = _allContainedInstances_2.indexOf(_value); - _builder.append(_indexOf_1, "\t"); - _builder.append("(0,0,"); - int _index1 = ai_1.getIndex1(); - _builder.append(_index1, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.newLine(); - { - EList<ActorInstance> _allContainedInstances_3 = comp.getAllContainedInstances(); - for(final ActorInstance ai_2 : _allContainedInstances_3) { - _builder.append("\t"); - _builder.append("// actor instance "); - String _path_1 = ai_2.getPath(); - _builder.append(_path_1, "\t"); - _builder.append(" itself => Systemport Address"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("Address addr_item_"); - String _path_2 = ai_2.getPath(); - String _pathName = this._roomExtensions.getPathName(_path_2); - _builder.append(_pathName, "\t"); - _builder.append("(0,"); - int _threadId = ai_2.getThreadId(); - _builder.append(_threadId, "\t"); - _builder.append(","); - int _objId = ai_2.getObjId(); - _builder.append(_objId, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("// interface items of "); - String _path_3 = ai_2.getPath(); - _builder.append(_path_3, "\t"); - _builder.newLineIfNotEmpty(); - { - EList<InterfaceItemInstance> _orderedIfItemInstances = ai_2.getOrderedIfItemInstances(); - for(final InterfaceItemInstance pi : _orderedIfItemInstances) { - { - boolean _isReplicated = pi.isReplicated(); - if (_isReplicated) { - { - EList<InterfaceItemInstance> _peers = pi.getPeers(); - for(final InterfaceItemInstance peer : _peers) { - _builder.append("\t"); - EList<InterfaceItemInstance> _peers_1 = pi.getPeers(); - int i = _peers_1.indexOf(peer); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("Address addr_item_"); - String _path_4 = pi.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_4); - _builder.append(_pathName_1, "\t"); - _builder.append("_"); - _builder.append(i, "\t"); - _builder.append("(0,"); - int _threadId_1 = pi.getThreadId(); - _builder.append(_threadId_1, "\t"); - _builder.append(","); - int _objId_1 = pi.getObjId(); - int _plus_1 = (_objId_1 + i); - _builder.append(_plus_1, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } else { - _builder.append("\t"); - _builder.append("Address addr_item_"); - String _path_5 = pi.getPath(); - String _pathName_2 = this._roomExtensions.getPathName(_path_5); - _builder.append(_pathName_2, "\t"); - _builder.append("(0,"); - int _threadId_2 = ai_2.getThreadId(); - _builder.append(_threadId_2, "\t"); - _builder.append(","); - int _objId_2 = pi.getObjId(); - _builder.append(_objId_2, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("// instantiate all actor instances"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("m_instances.reserve("); - EList<ActorInstance> _allContainedInstances_4 = comp.getAllContainedInstances(); - int _size = _allContainedInstances_4.size(); - _builder.append(_size, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - { - EList<ActorInstance> _allContainedInstances_5 = comp.getAllContainedInstances(); - for(final ActorInstance ai_3 : _allContainedInstances_5) { - _builder.append("\t"); - _builder.append("//----------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// addresses for actor instance: "); - String _name_6 = ai_3.getName(); - _builder.append(_name_6, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("//----------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("\t"); - CharSequence _generateOwnInterfaceItemAddresses = this.generateOwnInterfaceItemAddresses(ai_3); - _builder.append(_generateOwnInterfaceItemAddresses, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - CharSequence _generatePeerInterfaceItemAddresses = this.generatePeerInterfaceItemAddresses(ai_3, comp); - _builder.append(_generatePeerInterfaceItemAddresses, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("m_instances["); - EList<ActorInstance> _allContainedInstances_6 = comp.getAllContainedInstances(); - int _indexOf_2 = _allContainedInstances_6.indexOf(ai_3); - _builder.append(_indexOf_2, "\t"); - _builder.append("] = new "); - ActorClass _actorClass_2 = ai_3.getActorClass(); - String _name_7 = _actorClass_2.getName(); - _builder.append(_name_7, "\t"); - _builder.append("("); - _builder.newLineIfNotEmpty(); - { - EObject _eContainer = ai_3.eContainer(); - if ((_eContainer instanceof SubSystemInstance)) { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("this,"); - _builder.newLine(); - } else { - _builder.append("\t"); - _builder.append("\t"); - _builder.append("m_instances["); - EList<ActorInstance> _allContainedInstances_7 = comp.getAllContainedInstances(); - EObject _eContainer_1 = ai_3.eContainer(); - int _indexOf_3 = _allContainedInstances_7.indexOf(_eContainer_1); - _builder.append(_indexOf_3, "\t\t"); - _builder.append("],"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("\t"); - _builder.append("\""); - String _name_8 = ai_3.getName(); - _builder.append(_name_8, "\t\t"); - _builder.append("\","); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - String _name_9 = ai_3.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append("_ownInterfaceItemAddresses,"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t"); - String _name_10 = ai_3.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append("_peerInterfaceItemAddresses"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("); "); - _builder.newLine(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.newLine(); - _builder.append("// apply instance attribute configurations"); - _builder.newLine(); - { - EList<ActorInstance> _allContainedInstances_8 = comp.getAllContainedInstances(); - for(final ActorInstance ai_4 : _allContainedInstances_8) { - final CharSequence cfg = this.configGenAddon.genActorInstanceConfig(ai_4, "inst"); - _builder.newLineIfNotEmpty(); - { - int _length = cfg.length(); - boolean _greaterThan = (_length > 0); - if (_greaterThan) { - _builder.append("{"); - _builder.newLine(); - _builder.append("\t"); - ActorClass _actorClass_3 = ai_4.getActorClass(); - String _name_11 = _actorClass_3.getName(); - _builder.append(_name_11, "\t"); - _builder.append(" inst = ("); - ActorClass _actorClass_4 = ai_4.getActorClass(); - String _name_12 = _actorClass_4.getName(); - _builder.append(_name_12, "\t"); - _builder.append(") instances["); - EList<ActorInstance> _allContainedInstances_9 = comp.getAllContainedInstances(); - int _indexOf_4 = _allContainedInstances_9.indexOf(ai_4); - _builder.append(_indexOf_4, "\t"); - _builder.append("];"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append(cfg, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("}"); - _builder.newLine(); - } - } - } - } - _builder.newLine(); - _builder.append("\t"); - _builder.append("//----------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// addresses for the subsystem system port"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//----------------------------------------------------------------------------------------------"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("std::vector<Address> ownAddresses("); - EList<ActorInstance> _allContainedInstances_10 = comp.getAllContainedInstances(); - int _size_1 = _allContainedInstances_10.size(); - _builder.append(_size_1, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - { - EList<ActorInstance> _allContainedInstances_11 = comp.getAllContainedInstances(); - for(final ActorInstance ai_5 : _allContainedInstances_11) { - _builder.append("\t"); - _builder.append("ownAddresses["); - EList<ActorInstance> _allContainedInstances_12 = comp.getAllContainedInstances(); - int _indexOf_5 = _allContainedInstances_12.indexOf(ai_5); - _builder.append(_indexOf_5, "\t"); - _builder.append("] = addr_item_SystemPort_"); - EList<ActorInstance> _allContainedInstances_13 = comp.getAllContainedInstances(); - int _indexOf_6 = _allContainedInstances_13.indexOf(ai_5); - _builder.append(_indexOf_6, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.append("std::vector<Address> peerAddresses("); - EList<ActorInstance> _allContainedInstances_14 = comp.getAllContainedInstances(); - int _size_2 = _allContainedInstances_14.size(); - _builder.append(_size_2, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - { - EList<ActorInstance> _allContainedInstances_15 = comp.getAllContainedInstances(); - for(final ActorInstance ai_6 : _allContainedInstances_15) { - _builder.append("\t"); - _builder.append("peerAddresses["); - EList<ActorInstance> _allContainedInstances_16 = comp.getAllContainedInstances(); - int _indexOf_7 = _allContainedInstances_16.indexOf(ai_6); - _builder.append(_indexOf_7, "\t"); - _builder.append("] = addr_item_"); - String _path_6 = ai_6.getPath(); - String _pathName_3 = this._roomExtensions.getPathName(_path_6); - _builder.append(_pathName_3, "\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// create the subsystem system port\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("m_RTSystemPort = new RTSystemServicesProtocolConjPortRepl(*this, this, \"RTSystemPort\","); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("0, //local ID"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("ownAddresses,"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.append("peerAddresses);"); - _builder.newLine(); - _builder.append("\t\t\t"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - return _builder; - } - - public CharSequence generateOwnInterfaceItemAddresses(final ActorInstance ai) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("std::vector<std::vector<Address> > "); - String _name = ai.getName(); - _builder.append(_name, ""); - _builder.append("_ownInterfaceItemAddresses;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("std::vector<Address> "); - String _name_1 = ai.getName(); - _builder.append(_name_1, ""); - _builder.append("_actorInstanceAddresses(1);"); - _builder.newLineIfNotEmpty(); - String _name_2 = ai.getName(); - _builder.append(_name_2, ""); - _builder.append("_actorInstanceAddresses[0] = addr_item_"); - String _path = ai.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _name_3 = ai.getName(); - _builder.append(_name_3, ""); - _builder.append("_ownInterfaceItemAddresses.push_back("); - String _name_4 = ai.getName(); - _builder.append(_name_4, ""); - _builder.append("_actorInstanceAddresses);"); - _builder.newLineIfNotEmpty(); - { - EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - for(final InterfaceItemInstance pi : _orderedIfItemInstances) { - { - boolean _isReplicated = pi.isReplicated(); - if (_isReplicated) { - { - EList<InterfaceItemInstance> _peers = pi.getPeers(); - boolean _isEmpty = _peers.isEmpty(); - if (_isEmpty) { - _builder.append("std::vector<Address> "); - String _name_5 = ai.getName(); - _builder.append(_name_5, ""); - _builder.append("_"); - String _name_6 = pi.getName(); - _builder.append(_name_6, ""); - _builder.append("Addresses;"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("std::vector<Address> "); - String _name_7 = ai.getName(); - _builder.append(_name_7, ""); - _builder.append("_"); - String _name_8 = pi.getName(); - _builder.append(_name_8, ""); - _builder.append("Addresses("); - EList<InterfaceItemInstance> _peers_1 = pi.getPeers(); - int _size = _peers_1.size(); - _builder.append(_size, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - { - EList<InterfaceItemInstance> _peers_2 = pi.getPeers(); - for(final InterfaceItemInstance peer : _peers_2) { - String _name_9 = ai.getName(); - _builder.append(_name_9, ""); - _builder.append("_"); - String _name_10 = pi.getName(); - _builder.append(_name_10, ""); - _builder.append("Addresses["); - EList<InterfaceItemInstance> _peers_3 = pi.getPeers(); - int _indexOf = _peers_3.indexOf(peer); - _builder.append(_indexOf, ""); - _builder.append("] = addr_item_"); - String _path_1 = pi.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_1); - _builder.append(_pathName_1, ""); - _builder.append("_"); - EList<InterfaceItemInstance> _peers_4 = pi.getPeers(); - int _indexOf_1 = _peers_4.indexOf(peer); - _builder.append(_indexOf_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } else { - _builder.append("std::vector<Address> "); - String _name_11 = ai.getName(); - _builder.append(_name_11, ""); - _builder.append("_"); - String _name_12 = pi.getName(); - _builder.append(_name_12, ""); - _builder.append("Addresses(1);"); - _builder.newLineIfNotEmpty(); - String _name_13 = ai.getName(); - _builder.append(_name_13, ""); - _builder.append("_"); - String _name_14 = pi.getName(); - _builder.append(_name_14, ""); - _builder.append("Addresses[0] = addr_item_"); - String _path_2 = pi.getPath(); - String _pathName_2 = this._roomExtensions.getPathName(_path_2); - _builder.append(_pathName_2, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - String _name_15 = ai.getName(); - _builder.append(_name_15, ""); - _builder.append("_ownInterfaceItemAddresses.push_back("); - String _name_16 = ai.getName(); - _builder.append(_name_16, ""); - _builder.append("_"); - String _name_17 = pi.getName(); - _builder.append(_name_17, ""); - _builder.append("Addresses);"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - } - } - return _builder; - } - - public CharSequence generatePeerInterfaceItemAddresses(final ActorInstance ai, final SubSystemInstance comp) { - StringConcatenation _builder = new StringConcatenation(); - _builder.append("std::vector<std::vector<Address> > "); - String _name = ai.getName(); - _builder.append(_name, ""); - _builder.append("_peerInterfaceItemAddresses;"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("std::vector<Address> "); - String _name_1 = ai.getName(); - _builder.append(_name_1, ""); - _builder.append("_systemPortAddresses(1);"); - _builder.newLineIfNotEmpty(); - String _name_2 = ai.getName(); - _builder.append(_name_2, ""); - _builder.append("_systemPortAddresses[0] = addr_item_SystemPort_"); - EList<ActorInstance> _allContainedInstances = comp.getAllContainedInstances(); - int _indexOf = _allContainedInstances.indexOf(ai); - _builder.append(_indexOf, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - String _name_3 = ai.getName(); - _builder.append(_name_3, ""); - _builder.append("_peerInterfaceItemAddresses.push_back("); - String _name_4 = ai.getName(); - _builder.append(_name_4, ""); - _builder.append("_systemPortAddresses);"); - _builder.newLineIfNotEmpty(); - { - EList<InterfaceItemInstance> _orderedIfItemInstances = ai.getOrderedIfItemInstances(); - for(final InterfaceItemInstance pi : _orderedIfItemInstances) { - { - boolean _and = false; - boolean _isReplicated = pi.isReplicated(); - if (!_isReplicated) { - _and = false; - } else { - EList<InterfaceItemInstance> _peers = pi.getPeers(); - boolean _isEmpty = _peers.isEmpty(); - _and = _isEmpty; - } - if (_and) { - } else { - { - EList<InterfaceItemInstance> _peers_1 = pi.getPeers(); - boolean _isEmpty_1 = _peers_1.isEmpty(); - if (_isEmpty_1) { - _builder.append("std::vector<Address> "); - String _name_5 = ai.getName(); - _builder.append(_name_5, ""); - _builder.append("_"); - String _name_6 = pi.getName(); - _builder.append(_name_6, ""); - _builder.append("PeerAddresses;"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("std::vector<Address> "); - String _name_7 = ai.getName(); - _builder.append(_name_7, ""); - _builder.append("_"); - String _name_8 = pi.getName(); - _builder.append(_name_8, ""); - _builder.append("PeerAddresses("); - EList<InterfaceItemInstance> _peers_2 = pi.getPeers(); - int _size = _peers_2.size(); - _builder.append(_size, ""); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - { - EList<InterfaceItemInstance> _peers_3 = pi.getPeers(); - for(final InterfaceItemInstance pp : _peers_3) { - { - boolean _isReplicated_1 = pp.isReplicated(); - if (_isReplicated_1) { - String _name_9 = ai.getName(); - _builder.append(_name_9, ""); - _builder.append("_"); - String _name_10 = pi.getName(); - _builder.append(_name_10, ""); - _builder.append("PeerAddresses["); - EList<InterfaceItemInstance> _peers_4 = pi.getPeers(); - int _indexOf_1 = _peers_4.indexOf(pp); - _builder.append(_indexOf_1, ""); - _builder.append("] = addr_item_"); - String _path = pp.getPath(); - String _pathName = this._roomExtensions.getPathName(_path); - _builder.append(_pathName, ""); - _builder.append("_"); - EList<InterfaceItemInstance> _peers_5 = pp.getPeers(); - int _indexOf_2 = _peers_5.indexOf(pi); - _builder.append(_indexOf_2, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - String _name_11 = ai.getName(); - _builder.append(_name_11, ""); - _builder.append("_"); - String _name_12 = pi.getName(); - _builder.append(_name_12, ""); - _builder.append("PeerAddresses["); - EList<InterfaceItemInstance> _peers_6 = pi.getPeers(); - int _indexOf_3 = _peers_6.indexOf(pp); - _builder.append(_indexOf_3, ""); - _builder.append("] = addr_item_"); - String _path_1 = pp.getPath(); - String _pathName_1 = this._roomExtensions.getPathName(_path_1); - _builder.append(_pathName_1, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } - } - } - } - } - String _name_13 = ai.getName(); - _builder.append(_name_13, ""); - _builder.append("_peerInterfaceItemAddresses.push_back("); - String _name_14 = ai.getName(); - _builder.append(_name_14, ""); - _builder.append("_"); - String _name_15 = pi.getName(); - _builder.append(_name_15, ""); - _builder.append("PeerAddresses);"); - _builder.newLineIfNotEmpty(); - } - } - } - } - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.java b/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.java deleted file mode 100644 index 268fe651f..000000000 --- a/plugins/org.eclipse.etrice.generator.cpp/xtend-gen/org/eclipse/etrice/generator/cpp/gen/SubSystemRunnerGen.java +++ /dev/null @@ -1,209 +0,0 @@ -/** - * Copyright (c) 2011 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - */ -package org.eclipse.etrice.generator.cpp.gen; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.genmodel.etricegen.Root; -import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance; -import org.eclipse.etrice.core.room.SubSystemClass; -import org.eclipse.etrice.generator.cpp.gen.CppExtensions; -import org.eclipse.etrice.generator.generic.RoomExtensions; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.generator.JavaIoFileSystemAccess; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * @author Peter Karlitschek - */ -@Singleton -@SuppressWarnings("all") -public class SubSystemRunnerGen { - @Inject - @Extension - private JavaIoFileSystemAccess fileAccess; - - @Inject - @Extension - private CppExtensions _cppExtensions; - - @Inject - @Extension - private RoomExtensions roomExt; - - public void doGenerate(final Root root) { - EList<SubSystemInstance> _subSystemInstances = root.getSubSystemInstances(); - for (final SubSystemInstance sc : _subSystemInstances) { - { - SubSystemClass _subSystemClass = sc.getSubSystemClass(); - String _generationTargetPath = this.roomExt.getGenerationTargetPath(_subSystemClass); - SubSystemClass _subSystemClass_1 = sc.getSubSystemClass(); - String _path = this.roomExt.getPath(_subSystemClass_1); - String _plus = (_generationTargetPath + _path); - this.fileAccess.setOutputPath(_plus); - SubSystemClass _subSystemClass_2 = sc.getSubSystemClass(); - String _name = _subSystemClass_2.getName(); - String _plus_1 = (_name + "_Runner.h"); - SubSystemClass _subSystemClass_3 = sc.getSubSystemClass(); - CharSequence _generateHeaderFile = this.generateHeaderFile(root, sc, _subSystemClass_3); - this.fileAccess.generateFile(_plus_1, _generateHeaderFile); - SubSystemClass _subSystemClass_4 = sc.getSubSystemClass(); - String _generationTargetPath_1 = this.roomExt.getGenerationTargetPath(_subSystemClass_4); - SubSystemClass _subSystemClass_5 = sc.getSubSystemClass(); - String _path_1 = this.roomExt.getPath(_subSystemClass_5); - String _plus_2 = (_generationTargetPath_1 + _path_1); - this.fileAccess.setOutputPath(_plus_2); - SubSystemClass _subSystemClass_6 = sc.getSubSystemClass(); - String _name_1 = _subSystemClass_6.getName(); - String _plus_3 = (_name_1 + "_Runner.cpp"); - SubSystemClass _subSystemClass_7 = sc.getSubSystemClass(); - CharSequence _generateSourceFile = this.generateSourceFile(root, sc, _subSystemClass_7); - this.fileAccess.generateFile(_plus_3, _generateSourceFile); - } - } - } - - public CharSequence generateHeaderFile(final Root root, final SubSystemInstance ssc, final SubSystemClass cc) { - 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("* this class contains the main function running component "); - String _name = cc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* it instantiates "); - String _name_1 = cc.getName(); - _builder.append(_name_1, " "); - _builder.append(" and starts and ends the lifecycle"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - String _name_2 = cc.getName(); - String _plus = (_name_2 + "_Runner"); - CharSequence _generateIncludeGuardBegin = this._cppExtensions.generateIncludeGuardBegin(_plus); - _builder.append(_generateIncludeGuardBegin, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include \"common/modelbase/SubSystemRunnerBase.h\""); - _builder.newLine(); - _builder.newLine(); - _builder.append("class "); - String _name_3 = cc.getName(); - String _plus_1 = (_name_3 + "Runner"); - _builder.append(_plus_1, ""); - _builder.append(" :public etRuntime::SubSystemRunnerBase {"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _builder.newLine(); - String _name_4 = cc.getName(); - String _plus_2 = (_name_4 + "_Runner"); - CharSequence _generateIncludeGuardEnd = this._cppExtensions.generateIncludeGuardEnd(_plus_2); - _builder.append(_generateIncludeGuardEnd, ""); - _builder.newLineIfNotEmpty(); - return _builder; - } - - public CharSequence generateSourceFile(final Root root, final SubSystemInstance ssi, final SubSystemClass ssc) { - 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("* this class contains the main function running component "); - String _name = ssc.getName(); - _builder.append(_name, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("* it instantiates "); - String _name_1 = ssc.getName(); - _builder.append(_name_1, " "); - _builder.append(" and starts and ends the lifecycle"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("#include \""); - String _name_2 = ssc.getName(); - _builder.append(_name_2, ""); - _builder.append(".h\""); - _builder.newLineIfNotEmpty(); - _builder.append("#include \""); - String _name_3 = ssc.getName(); - _builder.append(_name_3, ""); - _builder.append("_Runner.h\""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#include <iostream>"); - _builder.newLine(); - _builder.newLine(); - _builder.newLine(); - _builder.append("/**"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* main function"); - _builder.newLine(); - _builder.append(" "); - _builder.append("* creates component and starts and stops the lifecycle"); - _builder.newLine(); - _builder.append(" "); - _builder.append("*/"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("int main(int argc, char* argv[]) {"); - _builder.newLine(); - _builder.append("\t"); - String _name_4 = ssc.getName(); - _builder.append(_name_4, "\t"); - _builder.append(" mainComponent(0, \""); - String _name_5 = ssc.getName(); - _builder.append(_name_5, "\t"); - _builder.append("\");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - String _name_6 = ssc.getName(); - String _plus = (_name_6 + "Runner"); - _builder.append(_plus, "\t"); - _builder.append("::run(mainComponent, argc, argv);"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("return 0;"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - return _builder; - } -} diff --git a/plugins/org.eclipse.etrice.generator.fsm/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.etrice.generator.fsm/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..42a944b8f --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.fsm/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=Cp1252 diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.xtend b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.xtend index 506732b0e..5c1e7f1e7 100644 --- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.xtend +++ b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.fsm.generic @@ -36,7 +36,7 @@ import static org.eclipse.xtext.util.Tuples.* * */ abstract class AbstractStateMachineGenerator { - + @Inject public extension FSMHelpers @Inject public extension FsmGenUtil @Inject public extension CodegenHelpers @@ -46,32 +46,32 @@ abstract class AbstractStateMachineGenerator { @Inject public IIfItemIdGenerator itemIdGen @Inject public TransitionChainGenerator transitionChainGenerator @Inject public IDetailCodeTranslator translator - + /** * generates trigger IDs. * Inheritance (if available) is used for base class IDs. - * + * * @param xpmc the {@link ExpandedModelComponent} * @return the generated code */ def public String genTriggerConstants(ExpandedModelComponent xpmc) { xpmc.genTriggerConstants(langExt.usesInheritance) } - + /** * generates trigger IDs. * Inheritance (if available) is used for base class IDs. - * + * * @param xpmc the {@link ExpandedModelComponent} * @param omitBase use <code>true</code> if no base class trigger constants are needed - * + * * @return the generated code */ def public String genTriggerConstants(ExpandedModelComponent xpmc, boolean omitBase) { val triggers = if (omitBase) xpmc.modelComponent.ownMessagesFromInterfaces else xpmc.modelComponent.allMessagesFromInterfaces - + val list = new ArrayList<Pair<String, String>>() list.add(pair("POLLING", "0")); for (mif : triggers) { @@ -79,14 +79,14 @@ abstract class AbstractStateMachineGenerator { list.add(pair(xpmc.getTriggerCodeName(mif), itemIdGen.getIfItemId(mif.from)+" + EVT_SHIFT*"+msgIdGen.getMessageID(mif))) } } - + return langExt.genEnumeration("triggers", list) } /** * generates state ID constants. * Inheritance (if available) is used for base class IDs. - * + * * @param xpmc the {@link ExpandedModelComponent} * @return the generated code */ @@ -97,10 +97,10 @@ abstract class AbstractStateMachineGenerator { /** * generates state ID constants. * Inheritance (if available) is used for base class IDs. - * + * * @param xpmc the {@link ExpandedModelComponent} * @param omitBase use <code>true</code> if no base class state constants are needed - * + * * @return the generated code */ def public genStateIdConstants(ExpandedModelComponent xpmc, boolean omitBase) { @@ -110,9 +110,9 @@ abstract class AbstractStateMachineGenerator { mc.getNumberOfInheritedBaseStates() else 0 var baseStates = if (omitBase) mc.stateMachine.getBaseStateList else xpmc.stateMachine.getBaseStateList - + baseStates = baseStates.leafStatesLast - + var list = new ArrayList<Pair<String, String>>() if (!omitBase) { list.add(pair("NO_STATE","0")) @@ -123,29 +123,29 @@ abstract class AbstractStateMachineGenerator { offset = offset+1; } list.add(pair("STATE_MAX", offset.toString)) - + return langExt.genEnumeration("state_ids", list) } - + /** * generates transition chain ID constants. * Inheritance (if available) is used for base class IDs. - * + * * @param xpmc the {@link ExpandedModelComponent} - * + * * @return the generated code */ def public genTransitionChainConstants(ExpandedModelComponent xpmc) { xpmc.genTransitionChainConstants(langExt.usesInheritance) } - + /** * generates transition chain ID constants. * Inheritance (if available) is used for base class IDs. - * + * * @param xpmc the {@link ExpandedModelComponent} * @param omitBase use <code>true</code> if no base class transition chain constants are needed - * + * * @return the generated code */ def public genTransitionChainConstants(ExpandedModelComponent xpmc, boolean omitBase) { @@ -159,72 +159,72 @@ abstract class AbstractStateMachineGenerator { offset = offset+1; list.add(pair(chain.genChainId, offset.toString)) } - + return langExt.genEnumeration("chain_ids", list) } - + /** * generates entry and exit code for states - * + * * @param xpmc the {@link ExpandedModelComponent} * @param generateImplementation if <code>true</code> the implementation is generated, else the declaration - * + * * @return the generated code */ def public String genEntryAndExitCodes(ExpandedModelComponent xpmc, boolean generateImplementation) { xpmc.genEntryAndExitCodes(generateImplementation, langExt.usesInheritance) } - + /** * generates entry and exit code for states - * + * * @param xpmc the {@link ExpandedModelComponent} * @param generateImplementation if <code>true</code> the implementation is generated, else the declaration * @param omitBase use <code>true</code> if no base class entry and exit codes are needed - * + * * @return the generated code */ def public String genEntryAndExitCodes(ExpandedModelComponent xpmc, boolean generateImplementation, boolean omitBase) { ''' - «FOR state : xpmc.stateMachine.getStateList()» - «IF !omitBase || xpmc.isOwnObject(state)» - «xpmc.genActionCodeMethods(state, generateImplementation)» - «ENDIF» - «ENDFOR» + «FOR state : xpmc.stateMachine.getStateList()» + «IF !omitBase || xpmc.isOwnObject(state)» + «xpmc.genActionCodeMethods(state, generateImplementation)» + «ENDIF» + «ENDFOR» ''' } - + /** * generates transition action codes - * + * * @param xpmc the {@link ExpandedModelComponent} * @param generateImplementation if <code>true</code> the implementation is generated, else the declaration - * + * * @return the generated code */ def public String genActionCodes(ExpandedModelComponent xpmc, boolean generateImplementation) { xpmc.genActionCodes(generateImplementation, langExt.usesInheritance) } - + /** * generates transition action codes - * + * * @param xpmc the {@link ExpandedModelComponent} * @param generateImplementation if <code>true</code> the implementation is generated, else the declaration * @param omitBase use <code>true</code> if no base class action codes are needed - * + * * @return the generated code */ def public String genActionCodes(ExpandedModelComponent xpmc, boolean generateImplementation, boolean omitBase) { ''' - «FOR tr : xpmc.stateMachine.allTransitionsRecursive» - «IF (!omitBase || xpmc.isOwnObject(tr)) && tr.action.hasDetailCode» - «xpmc.genActionCodeMethod(tr, generateImplementation)» - «ENDIF» - «ENDFOR» + «FOR tr : xpmc.stateMachine.allTransitionsRecursive» + «IF (!omitBase || xpmc.isOwnObject(tr)) && tr.action.hasDetailCode» + «xpmc.genActionCodeMethod(tr, generateImplementation)» + «ENDIF» + «ENDFOR» ''' } - + def public String genStateSwitchMethods(ExpandedModelComponent xpmc, boolean generateImplementation) { val mc = xpmc.modelComponent val async = mc.commType==ComponentCommunicationType::ASYNCHRONOUS @@ -262,31 +262,31 @@ abstract class AbstractStateMachineGenerator { * parent states while remembering the history * @param current__et - the current state * @param to - the final parent state - «IF usesHdlr» + «IF usesHdlr» * @param handler__et - entry and exit codes are called only if not handler (for handler TransitionPoints) - «ENDIF» + «ENDIF» */ - «IF generateImplementation» - «privAccess»void «opScopePriv»exitTo(«selfPtr»«stateType» current__et, «stateType» to«IF usesHdlr», «boolType» handler__et«ENDIF») { + «IF generateImplementation» + «privAccess»void «opScopePriv»exitTo(«selfPtr»«stateType» current__et, «stateType» to«IF usesHdlr», «boolType» handler__et«ENDIF») { while (current__et!=to) { switch (current__et) { - «FOR state : xpmc.stateMachine.getBaseStateList()» - case «state.getGenStateId()»: - «IF state.hasExitCode(true)»«IF usesHdlr»if (!handler__et) «ENDIF»«state.getExitCodeOperationName()»(«langExt.selfPointer(false)»);«ENDIF» - «setHistory(state.getParentStateId(), state.getGenStateId())»; - current__et = «state.getParentStateId()»; + «FOR state : xpmc.stateMachine.getBaseStateList()» + case «state.getGenStateId()»: + «IF state.hasExitCode(true)»«IF usesHdlr»if (!handler__et) «ENDIF»«state.getExitCodeOperationName()»(«langExt.selfPointer(false)»);«ENDIF» + «setHistory(state.getParentStateId(), state.getGenStateId())»; + current__et = «state.getParentStateId()»; break; - «ENDFOR» + «ENDFOR» default: /* should not occur */ break; } } } - «ELSE» - void exitTo(«selfPtr»«stateType» current__et, «stateType» to«IF usesHdlr», «boolType» handler__et«ENDIF»); - «ENDIF» - + «ELSE» + void exitTo(«selfPtr»«stateType» current__et, «stateType» to«IF usesHdlr», «boolType» handler__et«ENDIF»); + «ENDIF» + /** * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data * matching the trigger of this chain. The ID of the final state is returned @@ -294,174 +294,174 @@ abstract class AbstractStateMachineGenerator { * @param generic_data__et - the generic data pointer * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa */ - «IF generateImplementation» - «privAccess»«stateType» «opScopePriv»executeTransitionChain(«selfPtr»int chain__et«IF handleEvents», «constIfItemPtr» ifitem, «langExt.voidPointer» generic_data__et«ENDIF») { + «IF generateImplementation» + «privAccess»«stateType» «opScopePriv»executeTransitionChain(«selfPtr»int chain__et«IF handleEvents», «constIfItemPtr» ifitem, «langExt.voidPointer» generic_data__et«ENDIF») { switch (chain__et) { - «var allchains = xpmc.getTransitionChains()» - «FOR tc : allchains» - case «tc.genChainId»: + «var allchains = xpmc.getTransitionChains()» + «FOR tc : allchains» + case «tc.genChainId»: { - «transitionChainGenerator.generateExecuteChain(xpmc, tc)» + «transitionChainGenerator.generateExecuteChain(xpmc, tc)» } - «ENDFOR» + «ENDFOR» default: /* should not occur */ break; } return NO_STATE; } - «ELSE» - «stateType» executeTransitionChain(«selfPtr»int chain__et«IF handleEvents», «constIfItemPtr» ifitem, «langExt.voidPointer» generic_data__et«ENDIF»); - «ENDIF» - + «ELSE» + «stateType» executeTransitionChain(«selfPtr»int chain__et«IF handleEvents», «constIfItemPtr» ifitem, «langExt.voidPointer» generic_data__et«ENDIF»); + «ENDIF» + /** * calls entry codes while entering a state's history. The ID of the final leaf state is returned * @param state__et - the state which is entered - «IF usesHdlr» + «IF usesHdlr» * @param handler__et - entry code is executed if not handler - «ENDIF» + «ENDIF» * @return - the ID of the final leaf state */ - «IF generateImplementation» - «privAccess»«stateType» «opScopePriv»enterHistory(«selfPtr»«stateType» state__et«IF usesHdlr», «boolType» handler__et«ENDIF») { - «val baseStateList = xpmc.stateMachine.baseStateList» - «val needsSkipVar = !baseStateList.filter(s|s.hasEntryCode(true)).empty» - «IF needsSkipVar» - «boolType» skip_entry__et = «langExt.booleanConstant(false)»; - «ENDIF» + «IF generateImplementation» + «privAccess»«stateType» «opScopePriv»enterHistory(«selfPtr»«stateType» state__et«IF usesHdlr», «boolType» handler__et«ENDIF») { + «val baseStateList = xpmc.stateMachine.baseStateList» + «val needsSkipVar = !baseStateList.filter(s|s.hasEntryCode(true)).empty» + «IF needsSkipVar» + «boolType» skip_entry__et = «langExt.booleanConstant(false)»; + «ENDIF» if (state__et >= STATE_MAX) { - state__et = «IF !langExt.usesInheritance»(«stateType»)«ENDIF» (state__et - STATE_MAX); - «IF needsSkipVar» - skip_entry__et = «langExt.booleanConstant(true)»; - «ENDIF» + state__et = «IF !langExt.usesInheritance»(«stateType»)«ENDIF» (state__et - STATE_MAX); + «IF needsSkipVar» + skip_entry__et = «langExt.booleanConstant(true)»; + «ENDIF» } - while («langExt.booleanConstant(true)») { + while («langExt.booleanConstant(true)») { switch (state__et) { - «FOR state : baseStateList» - case «state.getGenStateId()»: - «IF state.hasEntryCode(true)»if (!(skip_entry__et«IF usesHdlr» || handler__et«ENDIF»)) «state.getEntryCodeOperationName()»(«langExt.selfPointer(false)»);«ENDIF» - «IF state.isLeaf()» + «FOR state : baseStateList» + case «state.getGenStateId()»: + «IF state.hasEntryCode(true)»if (!(skip_entry__et«IF usesHdlr» || handler__et«ENDIF»)) «state.getEntryCodeOperationName()»(«langExt.selfPointer(false)»);«ENDIF» + «IF state.isLeaf()» /* in leaf state: return state id */ - return «state.getGenStateId()»; - «ELSE» + return «state.getGenStateId()»; + «ELSE» /* state has a sub graph */ - «IF state.subgraph.hasInitTransition()» + «IF state.subgraph.hasInitTransition()» /* with init transition */ - if («getHistory(state.getGenStateId())»==NO_STATE) { - «var sub_initt = state.subgraph.getInitTransition()» - state__et = executeTransitionChain(«langExt.selfPointer(true)»«xpmc.getChain(sub_initt).genChainId»«IF handleEvents», «langExt.nullPointer», «langExt.nullPointer»«ENDIF»); + if («getHistory(state.getGenStateId())»==NO_STATE) { + «var sub_initt = state.subgraph.getInitTransition()» + state__et = executeTransitionChain(«langExt.selfPointer(true)»«xpmc.getChain(sub_initt).genChainId»«IF handleEvents», «langExt.nullPointer», «langExt.nullPointer»«ENDIF»); } else { - state__et = «getHistory(state.getGenStateId())»; + state__et = «getHistory(state.getGenStateId())»; } - «ELSE» + «ELSE» /* without init transition */ - state__et = «getHistory(state.getGenStateId())»; - «ENDIF» + state__et = «getHistory(state.getGenStateId())»; + «ENDIF» break; - «ENDIF» - «ENDFOR» + «ENDIF» + «ENDFOR» case STATE_TOP: - state__et = «getHistory("STATE_TOP")»; + state__et = «getHistory("STATE_TOP")»; break; default: /* should not occur */ break; } - «IF needsSkipVar» - skip_entry__et = «langExt.booleanConstant(false)»; - «ENDIF» + «IF needsSkipVar» + skip_entry__et = «langExt.booleanConstant(false)»; + «ENDIF» } - «unreachableReturn» + «unreachableReturn» } - «ELSE» - «stateType» enterHistory(«selfPtr»«stateType» state__et«IF usesHdlr», «boolType» handler__et«ENDIF»); - «ENDIF» - - «IF generateImplementation» - «publicIf»void «opScope»executeInitTransition(«selfOnly») { - «var initt = xpmc.stateMachine.getInitTransition()» - int chain__et = «xpmc.getChain(initt).genChainId»; - «stateType» next__et = «opScopePriv»executeTransitionChain(«langExt.selfPointer(true)»chain__et«IF handleEvents», «langExt.nullPointer», «langExt.nullPointer»«ENDIF»); - next__et = «opScopePriv»enterHistory(«langExt.selfPointer(true)»next__et«IF usesHdlr», «langExt.booleanConstant(false)»«ENDIF»); - setState(«langExt.selfPointer(true)»next__et); + «ELSE» + «stateType» enterHistory(«selfPtr»«stateType» state__et«IF usesHdlr», «boolType» handler__et«ENDIF»); + «ENDIF» + + «IF generateImplementation» + «publicIf»void «opScope»executeInitTransition(«selfOnly») { + «var initt = xpmc.stateMachine.getInitTransition()» + int chain__et = «xpmc.getChain(initt).genChainId»; + «stateType» next__et = «opScopePriv»executeTransitionChain(«langExt.selfPointer(true)»chain__et«IF handleEvents», «langExt.nullPointer», «langExt.nullPointer»«ENDIF»); + next__et = «opScopePriv»enterHistory(«langExt.selfPointer(true)»next__et«IF usesHdlr», «langExt.booleanConstant(false)»«ENDIF»); + setState(«langExt.selfPointer(true)»next__et); } - «ELSE» - void «opScope»executeInitTransition(«selfOnly»); - «ENDIF» - + «ELSE» + void «opScope»executeInitTransition(«selfOnly»); + «ENDIF» + /* receiveEvent contains the main implementation of the FSM */ - «IF generateImplementation» - «publicIf»void «opScope»receiveEventInternal(«langExt.selfPointer(mc.className, handleEvents)»«IF handleEvents»«ifItemPtr» ifitem, int localId, int evt, «langExt.voidPointer» generic_data__et«ENDIF») { - «IF async» - int trigger__et = (ifitem==«langExt.nullPointer»)? POLLING : localId + EVT_SHIFT*evt; - «ELSEIF eventDriven» + «IF generateImplementation» + «publicIf»void «opScope»receiveEventInternal(«langExt.selfPointer(mc.className, handleEvents)»«IF handleEvents»«ifItemPtr» ifitem, int localId, int evt, «langExt.voidPointer» generic_data__et«ENDIF») { + «IF async» + int trigger__et = (ifitem==«langExt.nullPointer»)? POLLING : localId + EVT_SHIFT*evt; + «ELSEIF eventDriven» int trigger__et = localId + EVT_SHIFT*evt; - «ENDIF» + «ENDIF» int chain__et = NOT_CAUGHT; - «stateType» catching_state__et = NO_STATE; - «IF usesHdlr» - «boolType» is_handler__et = «langExt.booleanConstant(false)»; - «ENDIF» - «IF async || eventDriven» - «markVariableUsed("trigger__et")» - «ENDIF» - - «IF handleEvents» + «stateType» catching_state__et = NO_STATE; + «IF usesHdlr» + «boolType» is_handler__et = «langExt.booleanConstant(false)»; + «ENDIF» + «IF async || eventDriven» + «markVariableUsed("trigger__et")» + «ENDIF» + + «IF handleEvents» if (!handleSystemEvent(ifitem, evt, generic_data__et)) { - «genStateSwitch(xpmc, usesHdlr)» + «genStateSwitch(xpmc, usesHdlr)» } - «ELSE» - «genStateSwitch(xpmc, usesHdlr)» - «ENDIF» + «ELSE» + «genStateSwitch(xpmc, usesHdlr)» + «ENDIF» if (chain__et != NOT_CAUGHT) { - «opScopePriv»exitTo(«langExt.selfPointer(true)»getState(«langExt.selfPointer(false)»), catching_state__et«IF usesHdlr», is_handler__et«ENDIF»); + «opScopePriv»exitTo(«langExt.selfPointer(true)»getState(«langExt.selfPointer(false)»), catching_state__et«IF usesHdlr», is_handler__et«ENDIF»); { - «stateType» next__et = «opScopePriv»executeTransitionChain(«langExt.selfPointer(true)»chain__et«IF handleEvents», ifitem, generic_data__et«ENDIF»); - next__et = «opScopePriv»enterHistory(«langExt.selfPointer(true)»next__et«IF usesHdlr», is_handler__et«ENDIF»); - setState(«langExt.selfPointer(true)»next__et); - «finalAction()» + «stateType» next__et = «opScopePriv»executeTransitionChain(«langExt.selfPointer(true)»chain__et«IF handleEvents», ifitem, generic_data__et«ENDIF»); + next__et = «opScopePriv»enterHistory(«langExt.selfPointer(true)»next__et«IF usesHdlr», is_handler__et«ENDIF»); + setState(«langExt.selfPointer(true)»next__et); + «finalAction()» } } } - «ELSE» - void «opScope»receiveEventInternal(«langExt.selfPointer(mc.className, handleEvents)»«IF handleEvents»«ifItemPtr» ifitem, int localId, int evt, «langExt.voidPointer» generic_data__et«ENDIF»); - «ENDIF» - «IF handleEvents» - «IF generateImplementation» - «publicIf»void «opScope»receiveEvent(«langExt.selfPointer(mc.className, true)»«ifItemPtr» ifitem, int evt, «langExt.voidPointer» generic_data__et) { - int localId = (ifitem==«langExt.nullPointer»)? 0 : ifitem«getLocalId»; - «opScope»receiveEventInternal(«langExt.selfPointer(true)»ifitem, localId, evt, generic_data__et); + «ELSE» + void «opScope»receiveEventInternal(«langExt.selfPointer(mc.className, handleEvents)»«IF handleEvents»«ifItemPtr» ifitem, int localId, int evt, «langExt.voidPointer» generic_data__et«ENDIF»); + «ENDIF» + «IF handleEvents» + «IF generateImplementation» + «publicIf»void «opScope»receiveEvent(«langExt.selfPointer(mc.className, true)»«ifItemPtr» ifitem, int evt, «langExt.voidPointer» generic_data__et) { + int localId = (ifitem==«langExt.nullPointer»)? 0 : ifitem«getLocalId»; + «opScope»receiveEventInternal(«langExt.selfPointer(true)»ifitem, localId, evt, generic_data__et); } - «ELSE» - void «opScope»receiveEvent(«langExt.selfPointer(true)»«ifItemPtr» ifitem, int evt, «langExt.voidPointer» generic_data__et); - «ENDIF» - «ENDIF» + «ELSE» + void «opScope»receiveEvent(«langExt.selfPointer(true)»«ifItemPtr» ifitem, int evt, «langExt.voidPointer» generic_data__et); + «ENDIF» + «ENDIF» ''' } - + /** * generate the do code calls for a given state - * + * * @param state the {@link State} * @return the generated code */ def public String genDoCodes(State state) {''' - «IF state.hasDoCode(true)» - «state.getDoCodeOperationName()»(«langExt.selfPointer(false)»); - «ENDIF» - «IF state.eContainer.eContainer instanceof State» - «genDoCodes(state.eContainer.eContainer as State)» - «ENDIF» + «IF state.hasDoCode(true)» + «state.getDoCodeOperationName()»(«langExt.selfPointer(false)»); + «ENDIF» + «IF state.eContainer.eContainer instanceof State» + «genDoCodes(state.eContainer.eContainer as State)» + «ENDIF» '''} - + /** * helper method which generates the state switch. * Asynchronous, data driven and event driven state machines are distinguished - * + * * @param xpmc the {@link ExpandedModelComponent} * @param usesHdlr if the state machine uses no handler {@link TransitionPoint}s - * at all then unused variables can be avoided by passing <code>true</code> + * at all then unused variables can be avoided by passing <code>true</code> * @return the generated code */ def public genStateSwitch(ExpandedModelComponent xpmc, boolean usesHdlr) { @@ -469,117 +469,117 @@ abstract class AbstractStateMachineGenerator { var eventDriven = xpmc.modelComponent.commType==ComponentCommunicationType::EVENT_DRIVEN var dataDriven = xpmc.modelComponent.commType==ComponentCommunicationType::DATA_DRIVEN ''' - switch (getState(«langExt.selfPointer(false)»)) { - «FOR state : xpmc.stateMachine.getLeafStateList()» - case «state.getGenStateId()»: - «IF async» - «var atlist = xpmc.getActiveTriggers(state)» - «IF !atlist.isEmpty» + switch (getState(«langExt.selfPointer(false)»)) { + «FOR state : xpmc.stateMachine.getLeafStateList()» + case «state.getGenStateId()»: + «IF async» + «var atlist = xpmc.getActiveTriggers(state)» + «IF !atlist.isEmpty» switch(trigger__et) { case POLLING: - «genDataDrivenTriggers(xpmc, state, usesHdlr)» + «genDataDrivenTriggers(xpmc, state, usesHdlr)» break; - «genEventDrivenTriggers(xpmc, state, atlist, usesHdlr)» + «genEventDrivenTriggers(xpmc, state, atlist, usesHdlr)» } - «ELSE» - «genDataDrivenTriggers(xpmc, state, usesHdlr)» - «ENDIF» - «ELSEIF dataDriven» - «genDataDrivenTriggers(xpmc, state, usesHdlr)» - «ELSEIF eventDriven» - «var atlist = xpmc.getActiveTriggers(state)» - «IF !atlist.isEmpty» + «ELSE» + «genDataDrivenTriggers(xpmc, state, usesHdlr)» + «ENDIF» + «ELSEIF dataDriven» + «genDataDrivenTriggers(xpmc, state, usesHdlr)» + «ELSEIF eventDriven» + «var atlist = xpmc.getActiveTriggers(state)» + «IF !atlist.isEmpty» switch(trigger__et) { - «genEventDrivenTriggers(xpmc, state, atlist, usesHdlr)» + «genEventDrivenTriggers(xpmc, state, atlist, usesHdlr)» } - «ENDIF» - «ENDIF» + «ENDIF» + «ENDIF» break; - «ENDFOR» + «ENDFOR» default: /* should not occur */ break; } ''' } - + /** * helper method which generates the data driven triggers - * + * * @param xpmc the {@link ExpandedModelComponent} * @param state the {@link State} for which the trigger if-else switch should be generated * @param usesHdlr if the state machine uses no handler {@link TransitionPoints} - * at all then unused variables can be avoided by passing <code>true</code> + * at all then unused variables can be avoided by passing <code>true</code> * @return the generated code */ def public genDataDrivenTriggers(ExpandedModelComponent xpmc, State state, boolean usesHdlr) { ''' - «genDoCodes(state)» - «var transitions = xpmc.getOutgoingTransitionsHierarchical(state).filter(t|t instanceof GuardedTransition)» - «FOR tr : transitions» - if («guard((tr as GuardedTransition), "", xpmc)») + «genDoCodes(state)» + «var transitions = xpmc.getOutgoingTransitionsHierarchical(state).filter(t|t instanceof GuardedTransition)» + «FOR tr : transitions» + if («guard((tr as GuardedTransition), "", xpmc)») { - «var chain = xpmc.getChain(tr)» - chain__et = «chain.genChainId»; - catching_state__et = «chain.stateContext.genStateId»; - «IF chain.isHandler() && usesHdlr» + «var chain = xpmc.getChain(tr)» + chain__et = «chain.genChainId»; + catching_state__et = «chain.stateContext.genStateId»; + «IF chain.isHandler() && usesHdlr» is_handler__et = TRUE; - «ENDIF» + «ENDIF» } - «IF tr!=transitions.last» - else - «ENDIF» - «ENDFOR» + «IF tr!=transitions.last» + else + «ENDIF» + «ENDFOR» ''' } - + /** * helper method which generates the event driven triggers - * + * * @param xpmc the {@link ExpandedModelComponent} * @param state the {@link State} for which the trigger switch should be generated * @param atlist the list of {@link ActiveTrigger}s of this state * @param usesHdlr if the state machine uses no handler {@link TransitionPoints} - * at all then unused variables can be avoided by passing <code>true</code> + * at all then unused variables can be avoided by passing <code>true</code> * @return the generated code */ def public genEventDrivenTriggers(ExpandedModelComponent xpmc, State state, List<ActiveTrigger> atlist, boolean usesHdlr) { ''' - «FOR at : atlist» - case «xpmc.getTriggerCodeName(at)»: - «var needData = at.hasGuard» - «IF needData»{ «langExt.getTypedDataDefinition(at.msg)»«ENDIF» - «FOR tt : at.transitions SEPARATOR " else "» - «var chain = xpmc.getChain(tt)» - «guard(chain.getTransition as TriggeredTransition, at.trigger, xpmc)» + «FOR at : atlist» + case «xpmc.getTriggerCodeName(at)»: + «var needData = at.hasGuard» + «IF needData»{ «langExt.getTypedDataDefinition(at.msg)»«ENDIF» + «FOR tt : at.transitions SEPARATOR " else "» + «var chain = xpmc.getChain(tt)» + «guard(chain.getTransition as TriggeredTransition, at.trigger, xpmc)» { - chain__et = «chain.genChainId»; - catching_state__et = «chain.stateContext.genStateId»; - «IF chain.isHandler() && usesHdlr» - is_handler__et = «langExt.booleanConstant(true)»; - «ENDIF» + chain__et = «chain.genChainId»; + catching_state__et = «chain.stateContext.genStateId»; + «IF chain.isHandler() && usesHdlr» + is_handler__et = «langExt.booleanConstant(true)»; + «ENDIF» } - «ENDFOR» - «IF needData»}«ENDIF» + «ENDFOR» + «IF needData»}«ENDIF» break; - «ENDFOR» + «ENDFOR» default: /* should not occur */ break; ''' } - + def public getClassName(ExpandedModelComponent xpmc) { xpmc.modelComponent.className } - + def public getClassName(ModelComponent mc) { mc.componentName } - + /** * getter for history array - * + * * @param state the ID of the history state * @return the generated code */ @@ -589,7 +589,7 @@ abstract class AbstractStateMachineGenerator { /** * setter for history array - * + * * @param state the ID of the state whose history should be set * @param historyState the ID of the state that should be assigned * @return the generated code @@ -597,7 +597,7 @@ abstract class AbstractStateMachineGenerator { def public setHistory(String state, String historyState) { langExt.memberAccess+"history["+state+"] = "+historyState } - + /** * @return the type of (temporary) state variables (defaults to "int") * and has to be signed @@ -610,7 +610,7 @@ abstract class AbstractStateMachineGenerator { * allow target language dependent generation of unreachable return in generated enterHistory method. * The default is just a comment. * @return the generated code - */ + */ def public unreachableReturn() { "/* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */" } @@ -622,14 +622,14 @@ abstract class AbstractStateMachineGenerator { def public boolType() { return "boolean" } - + /** * empty, but may be overridden */ def public finalAction() { '''''' } - + /** * the type of the interface item passed into the receiveEvent() method */ @@ -643,27 +643,11 @@ abstract class AbstractStateMachineGenerator { def markVariableUsed(String varname) { '''''' } - - /** - * let derived class add extra code after definition of constants - * - * @param xpmc an expanded actor class - * @return the generated code - */ - def public genExtra(ExpandedModelComponent xpmc) {''''''} - - /** - * let derived class add extra code after definition of constants in header (if applicable) - * - * @param xpmc an expanded actor class - * @return the generated code - */ - def public genExtraDecl(ExpandedModelComponent xpmc) {''''''} - + /** * helper method to determine whether this state machine uses handler transitions * points at all - * + * * @param xpax the {@link ExpandedModelComponent} * @return <code>true</code> if the state machine uses handler transition points */ diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/ILanguageExtensionBase.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/ILanguageExtensionBase.java index f922edeb5..5ef06e6ea 100644 --- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/ILanguageExtensionBase.java +++ b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/generic/ILanguageExtensionBase.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.fsm.generic; @@ -30,56 +30,56 @@ public interface ILanguageExtensionBase { * code that defines a typed local variable holding the data passed with * the message (if applicable). The name of the local variable should * be that of the message parameter. - * + * * @param msg the {@link Message} * @return the variable definition */ String getTypedDataDefinition(EObject msg); - /** - * unification of access level for all Languages before each member - * @return e.g. "private " for Java, nothing for C and C++ (no access level before the individual member) + /** + * unification of access level for all Languages before each member + * @return e.g. "private " for Java, nothing for C and C++ (no access level before the individual member) */ String accessLevelPrivate(); - - /** - * unification of access level for all Languages before each member - * @return e.g. "protected " for Java, nothing for C and C++ (no access level before the individual member) + + /** + * unification of access level for all Languages before each member + * @return e.g. "protected " for Java, nothing for C and C++ (no access level before the individual member) */ String accessLevelProtected(); - - /** - * unification of access level for all Languages before each member + + /** + * unification of access level for all Languages before each member * @return e.g. "public " for Java, nothing for C and C++ (no access level before the individual member) */ String accessLevelPublic(); - - + + // Strings for member access - - /** + + /** * unification of member access for different languages * @return e.g. "this." for Java and C++ or "self->" for C */ - String memberAccess(); - - /** - * self pointer for building class mechanism in C, + String memberAccess(); + + /** + * self pointer for building class mechanism in C, * e.g. MyClass_function1(MyClass *self, int32 argument1) * @param classname the class name * @param hasArgs true if functions has further arguments * @return "classname *self, " for C / for Java and C++ nothing */ String selfPointer(String classname, boolean hasArgs); - + /** * self pointer for function calls * @param hasArgs true if functions has further arguments * @return "self, " for C / for Java and C++ nothing */ String selfPointer(boolean hasArgs); - - /** + + /** * language specific scoping string for operations * e.g. nothing in Java (only inside class declaration), nothing and classname:: for C++ and classname_ for C * @param classname the class name @@ -90,36 +90,36 @@ public interface ILanguageExtensionBase { /** * member declaration - * + * * @param namespace the namespace or class name * @param member the member name * @return for C: namespace_member, for Java namespace.member */ String memberInDeclaration(String namespace, String member); - + /** * member usage - * + * * @param namespace the namespace or class name * @param member the member name * @return for C: namespace_member, for Java namespace.member */ String memberInUse(String namespace, String member); - + /** * does the target language offer inheritance - * + * * @return true for C++ and Java, false for C */ boolean usesInheritance(); - + /** * does the target language use pointers - * + * * @return true for C++ and C, false for Java */ boolean usesPointers(); - + /** * generate an enumeration (enum in C, int constants in Java) * @param name the enumeration name @@ -127,37 +127,43 @@ public interface ILanguageExtensionBase { * @return a string defining the enumeration in the target language */ String genEnumeration(String name, List<Pair<String, String>> entries); - + /** * literals for boolean constants * @param b the boolean value * @return TRUE/FALSE for C/C++, true/false for Java */ String booleanConstant(boolean b); - + /** - * literal for pointer - * + * literal for pointer + * * @return * for C/C++, nothing for Java */ String pointerLiteral(); - - + /** * a literal for the null pointer - * + * * @return NULL for C/C++, null for Java */ String nullPointer(); - + /** * a generic pointer - * + * * @return void* for C/C++, Object for Java */ String voidPointer(); - + + /** + * a literal turn a type into an array + * + * @return * for C/C++, [] for Java + */ + String typeArrayModifier(); + /** * array declarations differ in Java and C/C++ * @param type @@ -166,33 +172,7 @@ public interface ILanguageExtensionBase { * @return a string that represents the declaration */ String arrayDeclaration(String type, int size, String name, boolean isRef); - - /** - * name for the constructor (without namespace if applicable) - * - * @param cls the class name - * @return the constructor name - */ - String constructorName(String cls); - - /** - * name for the destructor (without namespace if applicable) - * - * @param cls the class name - * @return the destructor name - */ - String destructorName(String cls); - - /** - * @return a typename for the return type (might be empty) - */ - String constructorReturnType(); - - /** - * @return a typename for the return type (might be empty) - */ - String destructorReturnType(); - + /** * @param baseClassName the name of the base class * @param method the method to be called @@ -200,10 +180,10 @@ public interface ILanguageExtensionBase { * @return super.method for Java, baseClassName::method for C++, empty for C */ String superCall(String baseClassName, String method, String arguments); - + /** * return three strings used by the generator - * + * * @param data the variable declaration * @return an array of three strings * <ol> diff --git a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java index aea0fdf27..6c1f30f01 100644 --- a/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java +++ b/plugins/org.eclipse.etrice.generator.fsm/xtend-gen/org/eclipse/etrice/generator/fsm/generic/AbstractStateMachineGenerator.java @@ -1119,7 +1119,6 @@ public abstract class AbstractStateMachineGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); { if (handleEvents) { @@ -1531,7 +1530,7 @@ public abstract class AbstractStateMachineGenerator { Transition _last = IterableExtensions.<Transition>last(transitions); boolean _notEquals = (!Objects.equal(tr, _last)); if (_notEquals) { - _builder.append("else "); + _builder.append("else"); _builder.newLine(); } } @@ -1739,28 +1738,6 @@ public abstract class AbstractStateMachineGenerator { } /** - * let derived class add extra code after definition of constants - * - * @param xpmc an expanded actor class - * @return the generated code - */ - public CharSequence genExtra(final ExpandedModelComponent xpmc) { - StringConcatenation _builder = new StringConcatenation(); - return _builder; - } - - /** - * let derived class add extra code after definition of constants in header (if applicable) - * - * @param xpmc an expanded actor class - * @return the generated code - */ - public CharSequence genExtraDecl(final ExpandedModelComponent xpmc) { - StringConcatenation _builder = new StringConcatenation(); - return _builder; - } - - /** * helper method to determine whether this state machine uses handler transitions * points at all * diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend index 151c96bfc..459042a82 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.java.gen @@ -15,18 +15,17 @@ package org.eclipse.etrice.generator.java.gen import com.google.inject.Inject import com.google.inject.Singleton import java.util.HashMap +import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass import org.eclipse.etrice.core.genmodel.etricegen.Root import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass import org.eclipse.etrice.core.room.ActorClass -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType import org.eclipse.etrice.core.room.Attribute import org.eclipse.etrice.core.room.EnumerationType import org.eclipse.etrice.core.room.ReferenceType -import org.eclipse.etrice.generator.base.AbstractGenerator -import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers import org.eclipse.etrice.generator.base.IDataConfiguration +import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo import org.eclipse.etrice.generator.generic.GenericActorClassGenerator import org.eclipse.etrice.generator.generic.ProcedureHelpers @@ -36,24 +35,24 @@ import org.eclipse.etrice.generator.java.Main @Singleton class ActorClassGen extends GenericActorClassGenerator { - + @Inject IGeneratorFileIo fileIO @Inject extension JavaExtensions @Inject extension RoomExtensions @Inject IDataConfiguration dataConfigExt final ConfigGenAddon configGenAddon - + @Inject extension ProcedureHelpers @Inject extension Initialization @Inject extension StateMachineGen @Inject extension TypeHelpers @Inject extension FileSystemHelpers - + @Inject new (ConfigGenAddon configGenAddon) { this.configGenAddon = configGenAddon } - + def doGenerate(Root root) { val HashMap<ActorClass, WiredActorClass> ac2wired = new HashMap<ActorClass, WiredActorClass> root.wiredInstances.filter(w|w instanceof WiredActorClass).forEach[w|ac2wired.put((w as WiredActorClass).actorClass, w as WiredActorClass)] @@ -68,12 +67,10 @@ class ActorClassGen extends GenericActorClassGenerator { fileIO.generateFile("generating ActorClass implementation", path, infopath, file, root.generate(xpac, wired, manualBehavior)) } } - + def generate(Root root, ExpandedActorClass xpac, WiredActorClass wired, boolean manualBehavior) { val ac = xpac.actorClass val clsname = if (manualBehavior) "Abstract"+ac.name else ac.name - val ctor = ac.structors.findFirst[isConstructor] - val dtor = ac.structors.findFirst[!isConstructor] val models = root.getReferencedModels(ac) val impPersist = if (Main::settings.generatePersistenceInterface) "implements IPersistable " else "" val dataObjClass = ac.name+"_DataObject" @@ -81,10 +78,10 @@ class ActorClassGen extends GenericActorClassGenerator { else if (!ac.getAttribute("ActorBaseClass", "class").empty) ac.getAttribute("ActorBaseClass", "class") else if (Main::settings.generateStoreDataObj) "ActorClassFinalActionBase" else "ActorClassBase" - + ''' package «ac.getPackage»; - + «IF !dataConfigExt.getDynConfigReadAttributes(ac).empty» import org.eclipse.etrice.runtime.java.config.DynConfigLock; «ENDIF» @@ -100,9 +97,9 @@ class ActorClassGen extends GenericActorClassGenerator { import org.eclipse.etrice.runtime.java.messaging.*; import org.eclipse.etrice.runtime.java.modelbase.*; import org.eclipse.etrice.runtime.java.debugging.*; - + import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*; - + «FOR model : models» import «model.name».*; «ENDFOR» @@ -112,72 +109,68 @@ class ActorClassGen extends GenericActorClassGenerator { «FOR sub : ac.actorRefs.filter(r|r.refType==ReferenceType.OPTIONAL)» import «sub.type.package».«sub.type.name»Interface; «ENDFOR» - + «ac.userCode(1, true)» - - + + public «IF manualBehavior || ac.^abstract»abstract «ENDIF»class «clsname» extends «baseClass» «impPersist»{ - + «ac.userCode(2, false)» - + //--------------------- ports «FOR ep : ac.getEndPorts()» protected «ep.getPortClassName()» «ep.name» = null; «ENDFOR» - + //--------------------- saps «FOR sap : ac.serviceAccessPoints» protected «sap.getPortClassName()» «sap.name» = null; «ENDFOR» - + //--------------------- services «FOR svc : ac.serviceImplementations» protected «svc.getPortClassName()» «svc.spp.name» = null; «ENDFOR» - + //--------------------- optional actors «FOR sub : ac.actorRefs.filter(r|r.refType==ReferenceType.OPTIONAL)» protected «sub.type.name»«IF sub.multiplicity!=1»Replicated«ENDIF»Interface «sub.name» = null; «ENDFOR» - + //--------------------- interface item IDs «xpac.genInterfaceItemConstants» - + «configGenAddon.genMinMaxConstants(ac)» «ac.attributes.attributes» «FOR a : dataConfigExt.getDynConfigReadAttributes(ac)» private DynConfigLock lock_«a.name»; «ENDFOR» + «operationsImplementation(ac.operations, ac.name)» - - // user defined destructor - «getDestructorSignature(ac.name)»{ - «IF ac.base != null»super.dtor();«ENDIF» - «IF dtor != null»«AbstractGenerator::getInstance().getTranslatedCode(dtor.detailCode)»«ENDIF» - } - + + //--------------------- construction public «clsname»(IRTObject parent, String name) { super(parent, name); setClassName("«ac.name»"); - + «ac.attributes.attributeInitialization(ac, false)» - + // own ports «FOR ep : ac.getEndPorts()» «ep.name» = new «ep.getPortClassName()»(this, "«ep.name»", «ep.ifItemId»); «ENDFOR» - + // own saps «FOR sap : ac.serviceAccessPoints» «sap.name» = new «sap.getPortClassName()»(this, "«sap.name»", «sap.ifItemId», 0); «ENDFOR» - + // own service implementations «FOR svc : ac.serviceImplementations» «svc.spp.name» = new «svc.getPortClassName()»(this, "«svc.spp.name»", «svc.spp.ifItemId»); «ENDFOR» - + // sub actors «FOR sub : ac.actorRefs» «IF sub.refType==ReferenceType.OPTIONAL» @@ -196,23 +189,18 @@ class ActorClassGen extends GenericActorClassGenerator { new «sub.type.name»(this, "«sub.name»"); «ENDIF» «ENDFOR» - + // wiring «FOR wire: wired.wires» «if (wire.dataDriven) "DataPortBase" else "InterfaceItemBase"».connect(this, "«wire.path1.join('/')»", "«wire.path2.join('/')»"); «ENDFOR» - + «IF ac.commType == ComponentCommunicationType::ASYNCHRONOUS || ac.commType == ComponentCommunicationType::DATA_DRIVEN» // activate polling for data-driven communication RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(getThread()).addPollingMessageReceiver(this); «ENDIF» - - «IF ctor!=null» - { - // user defined constructor body - «AbstractGenerator::getInstance().getTranslatedCode(ctor.detailCode)» - } - «ENDIF» + + «ac.userStructorBody(true)» «IF !dataConfigExt.getDynConfigReadAttributes(ac).empty || !dataConfigExt.getDynConfigWriteAttributes(ac).empty» «FOR a : dataConfigExt.getDynConfigReadAttributes(ac)» @@ -220,11 +208,11 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDFOR» «ENDIF» } - + «attributeSettersGettersImplementation(ac.attributes.minus(dataConfigExt.getDynConfigReadAttributes(ac)), ac.name)» - + «configGenAddon.genDynConfigGetterSetter(ac)» - + //--------------------- port getters «FOR ep : ac.getEndPorts()» «ep.portClassName.getterImplementation(ep.name, ac.name)» @@ -235,7 +223,7 @@ class ActorClassGen extends GenericActorClassGenerator { «FOR svc : ac.serviceImplementations» «svc.portClassName.getterImplementation(svc.spp.name, ac.name)» «ENDFOR» - + //--------------------- lifecycle functions «IF !ac.overridesStop()» «IF manualBehavior» @@ -247,13 +235,12 @@ class ActorClassGen extends GenericActorClassGenerator { } «ENDIF» «ENDIF» - + «IF manualBehavior» public abstract void destroy(); «ELSE» public void destroy(){ - if(this.getClass() == «clsname».class) - dtor(); + «ac.userStructorBody(false)» «IF Main::settings.generateMSCInstrumentation» DebuggingService.getInstance().addMessageActorDestroy(this); «ENDIF» @@ -263,7 +250,7 @@ class ActorClassGen extends GenericActorClassGenerator { super.destroy(); } «ENDIF» - + «IF manualBehavior» public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) { «FOR ifitem : ac.allInterfaceItems SEPARATOR "else "» @@ -289,7 +276,7 @@ class ActorClassGen extends GenericActorClassGenerator { protected void on_«ifitem.name»_«msg.name»(InterfaceItemBase ifitem«IF msg.data!=null»«msg.data.generateArglistAndTypedData.get(2)»«ENDIF») {} «ENDFOR» «ENDFOR» - + public abstract void executeInitTransition(); «ELSE» «IF ac.hasNonEmptyStateMachine» @@ -310,66 +297,66 @@ class ActorClassGen extends GenericActorClassGenerator { } «ENDIF» «ELSEIF xpac.stateMachine.empty» -««« no state machine in the super classes +««« no state machine in the super classes //--------------------- no state machine public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data) { handleSystemEvent(ifitem, evt, data); } - + public void executeInitTransition() {} «ENDIF» «ENDIF» - + «IF Main::settings.generatePersistenceInterface» - + @Override public void saveObject(ObjectOutput output) throws IOException { «IF xpac.hasStateMachine()» // state and history output.writeInt(getState()); for (int h: history) output.writeInt(h); - + «ENDIF» saveAttributes(output); } - + protected void saveAttributes(ObjectOutput output) throws IOException { «xpac.genSaveImpl» } - + @Override public void loadObject(ObjectInput input) throws IOException, ClassNotFoundException { «IF xpac.hasStateMachine()» // state and history setState(input.readInt()); for (int i=0; i<history.length; ++i) history[i] = input.readInt(); - + «ENDIF» loadAttributes(input); } - + protected void loadAttributes(ObjectInput input) throws IOException, ClassNotFoundException { «xpac.genLoadImpl» } «ENDIF» «IF Main::settings.isGenerateStoreDataObj» - + protected void store(IActorClassDataObject obj) { if (!(obj instanceof «dataObjClass»)) return; - + «dataObjClass» dataObject = («dataObjClass») obj; «IF ac.actorBase!=null» - + super.store(dataObject); «ENDIF» «IF ac.hasNonEmptyStateMachine» - + dataObject.setState(getState()); dataObject.setHistory(Arrays.copyOf(history, history.length)); «ENDIF» «IF !ac.attributes.empty» - + «FOR att : ac.attributes» «IF att.type.type.enumerationOrPrimitive» «IF att.size>1» @@ -392,23 +379,23 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDFOR» «ENDIF» } - + protected void restore(IActorClassDataObject obj) { if (!(obj instanceof «dataObjClass»)) return; - + «dataObjClass» dataObject = («dataObjClass») obj; «IF ac.actorBase!=null» - + super.restore(dataObject); «ENDIF» «IF ac.hasNonEmptyStateMachine» - + setState(dataObject.getState()); history = Arrays.copyOf(dataObject.getHistory(), dataObject.getHistory().length); «ENDIF» «IF !ac.attributes.empty» - + «FOR att : ac.attributes» «IF att.type.type.enumerationOrPrimitive» «IF att.size>1» @@ -431,7 +418,7 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDFOR» «ENDIF» } - + protected «dataObjClass» newDataObject() { return new «dataObjClass»(); } @@ -439,13 +426,13 @@ class ActorClassGen extends GenericActorClassGenerator { }; ''' } - + private def genSaveImpl(ExpandedActorClass xpac) { val ac = xpac.actorClass ''' «IF ac.actorBase!=null» super.saveAttributes(output); - + «ENDIF» «IF !ac.attributes.empty» «FOR att : ac.attributes» @@ -463,13 +450,13 @@ class ActorClassGen extends GenericActorClassGenerator { «ENDIF» ''' } - + private def genLoadImpl(ExpandedActorClass xpac) { val ac = xpac.actorClass ''' «IF ac.actorBase!=null» super.loadAttributes(input); - + «ENDIF» «IF !ac.attributes.empty» «FOR att : ac.attributes» @@ -494,13 +481,13 @@ class ActorClassGen extends GenericActorClassGenerator { else att.type.type.typeName val method = type.saveMethod - + if (att.size>0) "for ("+type+" v: "+att.name+") output."+method+"(v);" else "output."+method+"("+att.name+");" - } - + } + private def getSaveMethod(String type) { switch (type) { case "boolean": "writeBoolean" @@ -521,13 +508,13 @@ class ActorClassGen extends GenericActorClassGenerator { else att.type.type.typeName val method = type.loadMethod - + if (att.size>0) "for (int i=0; i<"+att.name+".length; ++i) "+att.name+"[i] = input."+method+"();" else att.name+" = input."+method+"();" - } - + } + private def getLoadMethod(String type) { switch (type) { case "boolean": "readBoolean" diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend index 4a3316ead..4928d7b16 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.java.gen @@ -19,12 +19,11 @@ import org.eclipse.etrice.core.genmodel.etricegen.Root import org.eclipse.etrice.core.room.Attribute import org.eclipse.etrice.core.room.ComplexType import org.eclipse.etrice.core.room.DataClass -import org.eclipse.etrice.generator.base.AbstractGenerator +import org.eclipse.etrice.core.room.util.RoomHelpers import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo import org.eclipse.etrice.generator.generic.ProcedureHelpers import org.eclipse.etrice.generator.generic.RoomExtensions -import org.eclipse.etrice.core.room.util.RoomHelpers @Singleton class DataClassGen { @@ -36,7 +35,7 @@ class DataClassGen { @Inject extension Initialization @Inject extension FileSystemHelpers @Inject RoomHelpers roomHelpers - + def doGenerate(Root root) { for (dc: root.usedDataClasses.filter(cl|cl.isValidGenerationLocation)) { var path = dc.generationTargetPath+dc.getPath @@ -45,56 +44,43 @@ class DataClassGen { fileIO.generateFile("generating DataClass implementation", path, infopath, file, root.generate(dc)) } } - + def generate(Root root, DataClass dc) { - val ctor = dc.structors.findFirst[isConstructor] - val dtor = dc.structors.findFirst[!isConstructor] - ''' package «dc.getPackage()»; - + import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*; import java.io.Serializable; - + «var models = root.getReferencedModels(dc)» «FOR model : models» import «model.name».*; «ENDFOR» - + «dc.userCode(1)» - - + + public class «dc.name»«IF dc.base!=null» extends «dc.base.name»«ENDIF» implements Serializable { - + private static final long serialVersionUID = «(dc.package+dc.name).hashCode»L; - + «dc.userCode(2)» - + «dc.attributes.attributes» - + «dc.attributes.attributeSettersGettersImplementation(dc.name)» - + «dc.operations.operationsImplementation(dc.name)» - - //--------------------- destruction - «getDestructorSignature(dc.name)» { - «IF dc.base != null»super.dtor();«ENDIF» - «IF dtor != null»«AbstractGenerator::getInstance().getTranslatedCode(dtor.detailCode)»«ENDIF» - } - + // default constructor public «dc.name»() { super(); - + «dc.attributes.attributeInitialization(dc, true)» - «IF ctor!=null» - { - // user defined constructor body - «AbstractGenerator::getInstance().getTranslatedCode(ctor.detailCode)» - } - «ENDIF» + + «dc.userStructorBody(true)» } - + // constructor using fields public «dc.name»(«dc.argList») { «IF dc.base!=null» @@ -102,12 +88,14 @@ class DataClassGen { «ELSE» super(); «ENDIF» - + «FOR a : dc.attributes» this.«a.name» = «a.name»; «ENDFOR» + + «dc.userStructorBody(true)» } - + // deep copy public «dc.name» deepCopy() { «dc.name» copy = new «dc.name»(); @@ -117,7 +105,7 @@ class DataClassGen { }; ''' } - + def paramList(DataClass _dc) { var result = "" var dc = _dc @@ -129,15 +117,15 @@ class DataClassGen { } return result } - + def private paramList(List<Attribute> attributes) { '''«FOR a: attributes SEPARATOR ", "»«a.name»«ENDFOR»''' } - + def argList(DataClass dc) { roomHelpers.getAllAttributes(dc).argList } - + def private deepCopy(DataClass _dc) { var result = "" var dc = _dc @@ -147,7 +135,7 @@ class DataClassGen { } return result } - + def private deepCopy(List<Attribute> attributes) { ''' «FOR a : attributes» diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend index 687fcf27c..49636d733 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ /* @@ -53,7 +53,7 @@ class JavaExtensions implements ILanguageExtension { } def String getJavaFileName(RoomClass rc) {rc.name+".java"} - + def String getJavaFactoryName(ActorClass rc) {rc.name+"Factory"} def String getJavaFactoryFileName(ActorClass rc) {rc.javaFactoryName+".java"} def String getJavaScalarInterfaceName(ActorClass rc) {rc.name+"Interface"} @@ -80,7 +80,7 @@ class JavaExtensions implements ILanguageExtension { def String getJavaFileName(NodeRef nr, SubSystemInstance ssi) { nr.getJavaClassName(ssi)+".java"; } - + def String toWrapper(String type){ switch(type){ case "int": "Integer" @@ -88,83 +88,71 @@ class JavaExtensions implements ILanguageExtension { default: type.toFirstUpper } } - + def boolean needsInitialization(Attribute a){ a.size > 0 || !typeHelpers.isEnumerationOrPrimitive(a.type.type) || typeHelpers.typeName(a.type.type).equals("String") } - + override String accessLevelPrivate() {"private "} override String accessLevelProtected() {"protected "} override String accessLevelPublic() {"public "} - - override String memberAccess() {"this."} + + override String memberAccess() {"this."} override String selfPointer(String classname, boolean hasArgs) {""} override String selfPointer(boolean hasArgs) { "" } - + override String operationScope(String classname, boolean isDeclaration) {""} - + override String memberInDeclaration(String namespace, String member) { return member } - + override String memberInUse(String namespace, String member) { return namespace+"."+member } - + override boolean usesInheritance() { return true } - + override boolean usesPointers() { return false } - + override String genEnumeration(String name, List<Pair<String, String>> entries) { ''' «FOR entry: entries» public static final int «entry.first» = «entry.second»; «ENDFOR» - '''.toString + ''' } override String booleanConstant(boolean b) { b.toString } - + override String pointerLiteral() { "" } override String nullPointer() { "null" } override String voidPointer() { "Object" } + override String typeArrayModifier() { "[]" } override String arrayDeclaration(String type, int size, String name, boolean isRef) { type+" "+name+"[]" } - - override String constructorName(String cls) { - cls - } - override String destructorName(String cls) { - 'dtor' - } - override String constructorReturnType() { - 'void' - } - override String destructorReturnType() { - 'void' - } - + override String superCall(String baseClassName, String method, String args) { "super."+method+"("+args+");" } - + override toValueLiteral(PrimitiveType type, String value){ if(!typeHelpers.isCharacterType(type) && (value.contains(',') || value.contains('{'))) { var singleValues = value.replace('{', '').replace('}', '').trim.split(',') '''{ «FOR v: singleValues SEPARATOR ', '»«castValue(type, v.trim)»«ENDFOR» }'''.toString }else - castValue(type, value) + castValue(type, value) } - + override toEnumLiteral(EnumerationType type, String value){ if(value.contains(',') || value.contains('{')) { var singleValues = value.replace('{', '').replace('}', '').trim.split(',') @@ -172,7 +160,7 @@ class JavaExtensions implements ILanguageExtension { } else convertStringEnumLiteral(type, value) } - + def private convertStringEnumLiteral(EnumerationType type, String value){ var v = value if (v.startsWith(type.name)) @@ -181,7 +169,7 @@ class JavaExtensions implements ILanguageExtension { if(l.name.equals(v)) return type.getName()+"."+l.getName() } - + def private castValue(PrimitiveType type, String value){ switch(type.targetName){ case "boolean": @@ -224,7 +212,7 @@ class JavaExtensions implements ILanguageExtension { "new "+dt.name+"()" } } - + def String getDefaultValue(EnumerationType type) { if (type.getLiterals().isEmpty()) "" @@ -252,7 +240,7 @@ class JavaExtensions implements ILanguageExtension { override generateArglistAndTypedData(EObject d) { if (d==null || !(d instanceof VarDecl)) return newArrayList("", "", "") - + val data = d as VarDecl var typeName = data.refType.type.getName(); var castTypeName = typeName; @@ -266,36 +254,36 @@ class JavaExtensions implements ILanguageExtension { typeName = (data.refType.type as EnumerationType).targetType castTypeName = (data.refType.type as EnumerationType).castType } - + val typedData = typeName+" "+data.getName() + " = ("+castTypeName+") generic_data__et;\n"; val dataArg = ", "+data.getName(); val typedArgList = ", "+typeName+" "+data.getName(); - + return newArrayList(dataArg, typedData, typedArgList); } - + override getTargetType(EnumerationType type) { if (type.getPrimitiveType()!=null) type.getPrimitiveType().getTargetName() else "int" } - + override getCastedValue(EnumLiteral literal) { val type = literal.eContainer() as EnumerationType val cast = type.targetType - + if (type.primitiveType==null) Long.toString(literal.getLiteralValue()) else "(("+cast+")"+Long.toString(literal.getLiteralValue())+")" } - + override getCastType(EnumerationType type) { if (type.getPrimitiveType()!=null) type.getPrimitiveType().getCastName() else "int" } - + } diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend index 5d7e3e4e1..ef86670fd 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.java.gen @@ -42,10 +42,11 @@ import org.eclipse.etrice.generator.java.Main import static extension org.eclipse.etrice.generator.fsm.base.Indexed.* import com.google.common.collect.Lists import com.google.common.collect.Sets +import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants @Singleton class NodeGen { - + @Inject extension JavaExtensions @Inject extension RoomExtensions @Inject IDataConfiguration dataConfigExt @@ -56,7 +57,7 @@ class NodeGen { @Inject IGeneratorFileIo fileIO @Inject VariableServiceGen varService @Inject IDiagnostician diagnostician - + def doGenerate(Root root) { val HashMap<SubSystemClass, WiredSubSystemClass> sscc2wired = new HashMap<SubSystemClass, WiredSubSystemClass> root.wiredInstances.filter(w|w instanceof WiredSubSystemClass).forEach[w|sscc2wired.put((w as WiredSubSystemClass).subSystemClass, w as WiredSubSystemClass)] @@ -68,11 +69,11 @@ class NodeGen { val path = ssi.subSystemClass.generationTargetPath+ssi.subSystemClass.getPath val infopath = ssi.subSystemClass.generationInfoPath+ssi.subSystemClass.getPath val file = nr.getJavaFileName(ssi) - + checkDataPorts(ssi) - + val usedThreads = ETMapUtil::getUsedThreads(nr, ssi) - + fileIO.generateFile("generating Node implementation", path, infopath, file, root.generate(ssi, wired, usedThreads)) if (dataConfigExt.hasVariableService(ssi)) varService.doGenerate(root, ssi); @@ -80,7 +81,7 @@ class NodeGen { } } } - + /** * Recursively collect all possible interface instances below a given structure instance. */ @@ -92,10 +93,10 @@ class NodeGen { result.addAll(root.getOptionalActorClasses(oi)) } } - + return result } - + def generate(Root root, SubSystemInstance comp, WiredSubSystemClass wired, Collection<PhysicalThread> usedThreads) { val cc = comp.subSystemClass val models = root.getReferencedModels(cc) @@ -103,10 +104,10 @@ class NodeGen { val clsname = nr.getJavaClassName(comp) val threads = nr.type.threads.filter(t|usedThreads.contains(t)) val opt = root.getOptionalActorClasses(comp) - + ''' package «cc.getPackage()»; - + import org.eclipse.etrice.runtime.java.config.IVariableService; «IF Main::settings.generateMSCInstrumentation» import org.eclipse.etrice.runtime.java.debugging.DebuggingService; @@ -123,32 +124,32 @@ class NodeGen { import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase; import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase; import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBroker; - + «FOR model : models» import «model.name».*; «ENDFOR» - + «cc.userCode(1, false)» - + public class «clsname» extends SubSystemClassBase { - + «FOR thread : threads.indexed» public static final int «thread.value.threadId» = «thread.index0»; «ENDFOR» - + «cc.userCode(2, false)» - + public «clsname»(IRTObject parent, String name) { super(parent, name); } - + @Override public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data){ } - - @Override + + @Override public void instantiateMessageServices() { - + IMessageService msgService; «FOR thread: threads» «IF thread.execmode==ExecMode::POLLED || thread.execmode==ExecMode::MIXED» @@ -159,10 +160,10 @@ class NodeGen { RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(msgService); «ENDFOR» } - + @Override public void instantiateActors() { - + // thread mappings «FOR ai : comp.allContainedInstances» «val mapped = ETMapUtil::getMappedThread(ai)» @@ -170,24 +171,24 @@ class NodeGen { addPathToThread("«ai.path»", «mapped.thread.threadId»); «ENDIF» «ENDFOR» - + // sub actors «FOR sub : cc.actorRefs» «IF sub.multiplicity>1» for (int i=0; i<«sub.multiplicity»; ++i) { «IF Main::settings.generateMSCInstrumentation» - DebuggingService.getInstance().addMessageActorCreate(this, "«sub.name»_"+i); + DebuggingService.getInstance().addMessageActorCreate(this, "«sub.name»«GenmodelConstants::INDEX_SEP»"+i); «ENDIF» - new «sub.type.name»(this, "«sub.name»_"+i); + new «sub.type.name»(this, "«sub.name»«GenmodelConstants::INDEX_SEP»"+i); } «ELSE» «IF Main::settings.generateMSCInstrumentation» DebuggingService.getInstance().addMessageActorCreate(this, "«sub.name»"); «ENDIF» - new «sub.type.name»(this, "«sub.name»"); + new «sub.type.name»(this, "«sub.name»"); «ENDIF» «ENDFOR» - + // create service brokers in optional actor interfaces «FOR aii: comp.allSubInstances.filter(inst|inst instanceof ActorInterfaceInstance).map(inst|inst as ActorInterfaceInstance)» { @@ -198,12 +199,12 @@ class NodeGen { «ENDFOR» } «ENDFOR» - + // wiring «FOR wire: wired.wires» «if (wire.dataDriven) "DataPortBase" else "InterfaceItemBase"».connect(this, "«wire.path1.join('/')»", "«wire.path2.join('/')»"); «ENDFOR» - + // apply instance attribute configurations «FOR ai: comp.allContainedInstances» «val cfg = configGenAddon.genActorInstanceConfig(ai, "inst")» @@ -217,7 +218,7 @@ class NodeGen { «ENDIF» «ENDFOR» } - + @Override public void init(){ «IF Main::settings.generateMSCInstrumentation» @@ -234,7 +235,7 @@ class NodeGen { DebuggingService.getInstance().addVisibleComment("done sub system initialization"); «ENDIF» } - + @Override public void stop(){ super.stop(); @@ -243,12 +244,12 @@ class NodeGen { «ENDIF» } «IF Main::settings.generateMSCInstrumentation» - + @Override public boolean hasGeneratedMSCInstrumentation() { return true; } - + @Override public void destroy() { DebuggingService.getInstance().addVisibleComment("begin sub system destruction"); @@ -256,7 +257,7 @@ class NodeGen { DebuggingService.getInstance().addVisibleComment("done sub system destruction"); } «ENDIF» - + public IOptionalActorFactory getFactory(String optionalActorClass, String actorClass) { «val else1 = new IntelligentSeparator("else ")» «FOR oa : opt» @@ -269,7 +270,7 @@ class NodeGen { «ENDFOR» } «ENDFOR» - + return null; } }; @@ -279,7 +280,7 @@ class NodeGen { def private getThreadId(PhysicalThread thread) { "THREAD_"+thread.name.toUpperCase } - + def private checkDataPorts(SubSystemInstance comp) { val found = new HashSet<String>() for (ai: comp.allContainedInstances) { diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend index 0282f5bf8..6bdb49beb 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.java.gen @@ -40,7 +40,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { @Inject extension DataClassGen @Inject extension FileSystemHelpers @Inject ILogger logger - + def doGenerate(Root root) { for (pc: root.usedProtocolClasses.filter(cl|cl.isValidGenerationLocation)) { val path = pc.generationTargetPath+pc.getPath @@ -61,10 +61,10 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { fileIO.generateFile("generating ProtocolClass implementation", path, infopath, file, contents) } } - + def generate(Root root, ProtocolClass pc) {''' package «pc.getPackage()»; - + import org.eclipse.etrice.runtime.java.messaging.Message; import org.eclipse.etrice.runtime.java.modelbase.EventMessage; import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage; @@ -76,22 +76,22 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { import org.eclipse.etrice.runtime.java.debugging.DebuggingService; «ENDIF» import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*; - + «pc.userCode(1)» - + «var models = root.getReferencedModels(pc)» «FOR model : models» import «model.name».*; «ENDFOR» - + public class «pc.name» { // message IDs «genMessageIDs(pc)» - + «pc.userCode(2)» - + private static String messageStrings[] = {"MIN", «FOR m : pc.getAllOutgoingMessages()»"«m.name»",«ENDFOR» «FOR m : pc.getAllIncomingMessages()»"«m.name»",«ENDFOR»"MAX"}; - + public String getMessageString(int msg_id) { if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){ // id out of range @@ -101,19 +101,19 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { return messageStrings[msg_id]; } } - + «portClass(pc, false)» «portClass(pc, true)» } ''' } - - def portClass(ProtocolClass pc, Boolean conj) { + + def portClass(ProtocolClass pc, boolean conj) { var pclass = pc.getPortClass(conj) var portClassName = pc.getPortClassName(conj) var replPortClassName = pc.getPortClassName(conj, true) ''' - + // port class static public class «portClassName» extends PortBase { «IF pclass!=null» @@ -133,13 +133,13 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «ENDIF» } «IF Main::settings.generateMSCInstrumentation» - + public void destroy() { DebuggingService.getInstance().removePortInstance(this); super.destroy(); } «ENDIF» - + @Override public void receive(Message m) { if (!(m instanceof EventMessage)) @@ -171,43 +171,43 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «ENDIF» } } - + «IF pclass!=null» «pclass.attributes.attributes» ««« // TODO JH: Avoid collision attr getters/setter <-> user operations «attributeSettersGettersImplementation(pclass.attributes, null)» «pclass.operations.operationsImplementation(portClassName)» «ENDIF» - + // sent messages «FOR m : pc.getAllMessages(conj)» «sendMessage(m, conj)» «ENDFOR» } - + // replicated port class static public class «replPortClassName» extends ReplicatedPortBase { - + public «replPortClassName»(IInterfaceItemOwner actor, String name, int localId) { super(actor, name, localId); } - + public int getReplication() { return getNInterfaceItems(); } - + public int getIndexOf(InterfaceItemBase ifitem){ return ifitem.getIdx(); - } - + } + public «portClassName» get(int idx) { return («portClassName») getInterfaceItem(idx); } - + protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) { return new «portClassName»(rcv, name, lid, idx); } - + «IF conj» // incoming messages «FOR m : pc.getAllIncomingMessages()» @@ -228,7 +228,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «ENDFOR» «ENDIF» } - + ««« // interface for port class ««« public interface I«name»{ ««« «IF conj» @@ -256,7 +256,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { def messageCall(Message m) { '''«m.name»(«IF m.data!=null» «m.data.name»«ENDIF»)''' } - + def sendMessage(Message m, boolean conj) { var dir = if (conj) "IN" else "OUT" var hdlr = m.getSendHandler(conj) @@ -284,39 +284,39 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { «ENDIF» ''' } - + def generateDataDriven(Root root, ProtocolClass pc) { val sentMsgs = pc.allIncomingMessages.filter(m|m.data!=null) val models = root.getReferencedModels(pc) ''' package «pc.getPackage()»; - + import org.eclipse.etrice.runtime.java.messaging.IRTObject; import org.eclipse.etrice.runtime.java.modelbase.DataReceivePort; import org.eclipse.etrice.runtime.java.modelbase.DataSendPort; import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*; - + «pc.userCode(1)» - + «FOR model : models» import «model.name».*; «ENDFOR» - + public class «pc.name» { - + «pc.userCode(2)» - + // send port holds data static public class «pc.getPortClassName(true)» extends DataSendPort { «FOR msg : sentMsgs» private «msg.data.refType.type.typeName» «msg.name»; «ENDFOR» - + // constructor public «pc.getPortClassName(true)»(IRTObject parent, String name, int localId) { super(parent, name, localId); } - + // getters and setters «FOR msg : sentMsgs» public void «msg.name»(«msg.data.refType.type.typeName» «msg.name») { @@ -327,16 +327,16 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { } «ENDFOR» } - + // receive port accesses send port static public class «pc.getPortClassName(false)» extends DataReceivePort { private «pc.getPortClassName(true)» peer; - + // constructor public «pc.getPortClassName(false)»(IRTObject parent, String name, int localId) { super(parent, name, localId); } - + // getters «FOR msg : sentMsgs» public «msg.data.refType.type.typeName» «msg.name»() { @@ -345,7 +345,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator { return peer.«msg.name»(); } «ENDFOR» - + protected void connect(DataSendPort dataSendPort) { if (dataSendPort instanceof «pc.getPortClassName(true)») peer = («pc.getPortClassName(true)»)dataSendPort; diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend index ca73c5612..f2e971d2c 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.java.gen @@ -22,11 +22,14 @@ import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedModelComponent @Singleton class StateMachineGen extends GenericStateMachineGenerator { - - override genExtra(ExpandedModelComponent xpac) { + + /** + * @param generateImplementation NOT used + */ + override genExtra(ExpandedModelComponent xpac, boolean generateImplementation) { val states = new ArrayList<State>() var ac = xpac.modelComponent - + // it is crucial that we obey the order that is used for state IDs // that means we have to collect base classes first and each base class list with leaf states last while (ac!=null) { @@ -43,7 +46,7 @@ class StateMachineGen extends GenericStateMachineGenerator { "«state.genStatePathName»" «ENDFOR» }; - + «ENDIF» ««« TODOHRR: history defined in ActorClassBase, init in constructor ««« history = new int[5]; @@ -52,7 +55,7 @@ class StateMachineGen extends GenericStateMachineGenerator { ««« } // history protected int history[] = {NO_STATE, NO_STATE«FOR state : states», NO_STATE«ENDFOR»}; - + private void setState(int new_state) { «IF Main::settings.generateMSCInstrumentation» DebuggingService.getInstance().addActorState(this,stateStrings[new_state]); @@ -61,12 +64,12 @@ class StateMachineGen extends GenericStateMachineGenerator { if (stateStrings[new_state]!="Idle") { System.out.println("state switch of "+getInstancePath() + ": " + stateStrings[this.state] + " -> " + stateStrings[new_state]); - } + } «ENDIF» this.state = new_state; } '''} - + /** * if {@code -storeDataObj} is set then a call to {@code finalAction()} is generated */ @@ -77,7 +80,7 @@ class StateMachineGen extends GenericStateMachineGenerator { «ENDIF» ''' } - + def getHistorySize(ExpandedActorClass xpac) { xpac.actorClass.getAllBaseStates().size+2 } diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java index 6caf26649..9dcad33ab 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.java.setup; @@ -18,11 +18,15 @@ import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule; import org.eclipse.etrice.generator.base.GlobalGeneratorSettings; import org.eclipse.etrice.generator.base.IDataConfiguration; import org.eclipse.etrice.generator.base.ITranslationProvider; +import org.eclipse.etrice.generator.generic.GenericActorClassGenerator; +import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator; import org.eclipse.etrice.generator.generic.ILanguageExtension; import org.eclipse.etrice.generator.java.Main; +import org.eclipse.etrice.generator.java.gen.ActorClassGen; import org.eclipse.etrice.generator.java.gen.GlobalSettings; import org.eclipse.etrice.generator.java.gen.JavaExtensions; import org.eclipse.etrice.generator.java.gen.JavaTranslationProvider; +import org.eclipse.etrice.generator.java.gen.ProtocolClassGen; import org.eclipse.xtext.scoping.impl.ImportUriResolver; import com.google.inject.Binder; @@ -32,12 +36,15 @@ public class GeneratorModule extends AbstractGeneratorBaseModule { // @Override public void configure(Binder binder) { super.configure(binder); - + binder.bind(AbstractGenerator.class).to(Main.class); + binder.bind(GenericProtocolClassGenerator.class).to(ProtocolClassGen.class); + binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class); binder.bind(ImportUriResolver.class).to(ModelLocatorUriResolver.class); - + binder.bind(GlobalGeneratorSettings.class).to(GlobalSettings.class); + } @Override diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java index 4337138b5..12e802c8b 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ActorClassGen.java @@ -17,8 +17,6 @@ import java.util.HashMap; 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.fsm.fSM.ModelComponent; import org.eclipse.etrice.core.fsm.fSM.StateGraph; import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants; import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass; @@ -29,7 +27,6 @@ import org.eclipse.etrice.core.genmodel.etricegen.WiredStructureClass; import org.eclipse.etrice.core.room.ActorClass; import org.eclipse.etrice.core.room.ActorRef; import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ClassStructor; import org.eclipse.etrice.core.room.DataType; import org.eclipse.etrice.core.room.EnumerationType; import org.eclipse.etrice.core.room.InterfaceItem; @@ -45,7 +42,6 @@ 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.core.room.VarDecl; -import org.eclipse.etrice.generator.base.AbstractGenerator; import org.eclipse.etrice.generator.base.IDataConfiguration; import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; @@ -173,21 +169,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _xifexpression = ac.getName(); } final String clsname = _xifexpression; - EList<ClassStructor> _structors = ac.getStructors(); - final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - return Boolean.valueOf(it.isConstructor()); - } - }; - final ClassStructor ctor = IterableExtensions.<ClassStructor>findFirst(_structors, _function); - EList<ClassStructor> _structors_1 = ac.getStructors(); - final Function1<ClassStructor, Boolean> _function_1 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((!_isConstructor)); - } - }; - final ClassStructor dtor = IterableExtensions.<ClassStructor>findFirst(_structors_1, _function_1); final EList<RoomModel> models = root.getReferencedModels(ac); String _xifexpression_1 = null; GlobalSettings _settings = Main.getSettings(); @@ -299,13 +280,13 @@ public class ActorClassGen extends GenericActorClassGenerator { } { EList<ActorRef> _actorRefs = ac.getActorRefs(); - final Function1<ActorRef, Boolean> _function_2 = new Function1<ActorRef, Boolean>() { + final Function1<ActorRef, Boolean> _function = new Function1<ActorRef, Boolean>() { public Boolean apply(final ActorRef r) { ReferenceType _refType = r.getRefType(); return Boolean.valueOf(Objects.equal(_refType, ReferenceType.OPTIONAL)); } }; - Iterable<ActorRef> _filter = IterableExtensions.<ActorRef>filter(_actorRefs, _function_2); + Iterable<ActorRef> _filter = IterableExtensions.<ActorRef>filter(_actorRefs, _function); for(final ActorRef sub : _filter) { _builder.append("import "); ActorClass _type = sub.getType(); @@ -351,7 +332,6 @@ public class ActorClassGen extends GenericActorClassGenerator { CharSequence _userCode_1 = this._procedureHelpers.userCode(ac, 2, false); _builder.append(_userCode_1, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("//--------------------- ports"); @@ -370,7 +350,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("//--------------------- saps"); @@ -389,7 +368,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("//--------------------- services"); @@ -409,20 +387,19 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("//--------------------- optional actors"); _builder.newLine(); { EList<ActorRef> _actorRefs_1 = ac.getActorRefs(); - final Function1<ActorRef, Boolean> _function_3 = new Function1<ActorRef, Boolean>() { + final Function1<ActorRef, Boolean> _function_1 = new Function1<ActorRef, Boolean>() { public Boolean apply(final ActorRef r) { ReferenceType _refType = r.getRefType(); return Boolean.valueOf(Objects.equal(_refType, ReferenceType.OPTIONAL)); } }; - Iterable<ActorRef> _filter_1 = IterableExtensions.<ActorRef>filter(_actorRefs_1, _function_3); + Iterable<ActorRef> _filter_1 = IterableExtensions.<ActorRef>filter(_actorRefs_1, _function_1); for(final ActorRef sub_1 : _filter_1) { _builder.append("\t"); _builder.append("protected "); @@ -443,7 +420,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("//--------------------- interface item IDs"); @@ -452,7 +428,6 @@ public class ActorClassGen extends GenericActorClassGenerator { String _genInterfaceItemConstants = this.genInterfaceItemConstants(xpac); _builder.append(_genInterfaceItemConstants, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); String _genMinMaxConstants = this.configGenAddon.genMinMaxConstants(ac); @@ -474,45 +449,13 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } + _builder.newLine(); _builder.append("\t"); EList<StandardOperation> _operations = ac.getOperations(); String _name_11 = ac.getName(); CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_11); _builder.append(_operationsImplementation, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// user defined destructor"); - _builder.newLine(); - _builder.append("\t"); - String _name_12 = ac.getName(); - CharSequence _destructorSignature = this._procedureHelpers.getDestructorSignature(_name_12); - _builder.append(_destructorSignature, "\t"); - _builder.append("{"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - { - ModelComponent _base = ac.getBase(); - boolean _notEquals_2 = (!Objects.equal(_base, null)); - if (_notEquals_2) { - _builder.append("super.dtor();"); - } - } - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - { - boolean _notEquals_3 = (!Objects.equal(dtor, null)); - if (_notEquals_3) { - AbstractGenerator _instance = AbstractGenerator.getInstance(); - DetailCode _detailCode = dtor.getDetailCode(); - String _translatedCode = _instance.getTranslatedCode(_detailCode); - _builder.append(_translatedCode, "\t\t"); - } - } - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); _builder.newLine(); _builder.newLine(); _builder.append("\t"); @@ -528,11 +471,10 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.append("\t\t"); _builder.append("setClassName(\""); - String _name_13 = ac.getName(); - _builder.append(_name_13, "\t\t"); + String _name_12 = ac.getName(); + _builder.append(_name_12, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); EList<Attribute> _attributes_2 = ac.getAttributes(); @@ -547,14 +489,14 @@ public class ActorClassGen extends GenericActorClassGenerator { List<Port> _endPorts_1 = this._roomHelpers.getEndPorts(ac); for(final Port ep_1 : _endPorts_1) { _builder.append("\t\t"); - String _name_14 = ep_1.getName(); - _builder.append(_name_14, "\t\t"); + String _name_13 = ep_1.getName(); + _builder.append(_name_13, "\t\t"); _builder.append(" = new "); String _portClassName_3 = this._roomExtensions.getPortClassName(ep_1); _builder.append(_portClassName_3, "\t\t"); _builder.append("(this, \""); - String _name_15 = ep_1.getName(); - _builder.append(_name_15, "\t\t"); + String _name_14 = ep_1.getName(); + _builder.append(_name_14, "\t\t"); _builder.append("\", "); String _ifItemId = this.getIfItemId(ep_1); _builder.append(_ifItemId, "\t\t"); @@ -562,7 +504,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// own saps"); @@ -571,14 +512,14 @@ public class ActorClassGen extends GenericActorClassGenerator { EList<SAP> _serviceAccessPoints_1 = ac.getServiceAccessPoints(); for(final SAP sap_1 : _serviceAccessPoints_1) { _builder.append("\t\t"); - String _name_16 = sap_1.getName(); - _builder.append(_name_16, "\t\t"); + String _name_15 = sap_1.getName(); + _builder.append(_name_15, "\t\t"); _builder.append(" = new "); String _portClassName_4 = this._roomExtensions.getPortClassName(sap_1); _builder.append(_portClassName_4, "\t\t"); _builder.append("(this, \""); - String _name_17 = sap_1.getName(); - _builder.append(_name_17, "\t\t"); + String _name_16 = sap_1.getName(); + _builder.append(_name_16, "\t\t"); _builder.append("\", "); String _ifItemId_1 = this.getIfItemId(sap_1); _builder.append(_ifItemId_1, "\t\t"); @@ -586,7 +527,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// own service implementations"); @@ -596,15 +536,15 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final ServiceImplementation svc_1 : _serviceImplementations_1) { _builder.append("\t\t"); SPP _spp_1 = svc_1.getSpp(); - String _name_18 = _spp_1.getName(); - _builder.append(_name_18, "\t\t"); + String _name_17 = _spp_1.getName(); + _builder.append(_name_17, "\t\t"); _builder.append(" = new "); String _portClassName_5 = this._roomExtensions.getPortClassName(svc_1); _builder.append(_portClassName_5, "\t\t"); _builder.append("(this, \""); SPP _spp_2 = svc_1.getSpp(); - String _name_19 = _spp_2.getName(); - _builder.append(_name_19, "\t\t"); + String _name_18 = _spp_2.getName(); + _builder.append(_name_18, "\t\t"); _builder.append("\", "); SPP _spp_3 = svc_1.getSpp(); String _ifItemId_2 = this.getIfItemId(_spp_3); @@ -613,7 +553,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// sub actors"); @@ -626,22 +565,22 @@ public class ActorClassGen extends GenericActorClassGenerator { boolean _equals = Objects.equal(_refType, ReferenceType.OPTIONAL); if (_equals) { _builder.append("\t\t"); - String _name_20 = sub_2.getName(); - _builder.append(_name_20, "\t\t"); + String _name_19 = sub_2.getName(); + _builder.append(_name_19, "\t\t"); _builder.append(" = new "); ActorClass _type_3 = sub_2.getType(); - String _name_21 = _type_3.getName(); - _builder.append(_name_21, "\t\t"); + String _name_20 = _type_3.getName(); + _builder.append(_name_20, "\t\t"); { int _multiplicity_1 = sub_2.getMultiplicity(); - boolean _notEquals_4 = (_multiplicity_1 != 1); - if (_notEquals_4) { + boolean _notEquals_2 = (_multiplicity_1 != 1); + if (_notEquals_2) { _builder.append("Replicated"); } } _builder.append("Interface(this, \""); - String _name_22 = sub_2.getName(); - _builder.append(_name_22, "\t\t"); + String _name_21 = sub_2.getName(); + _builder.append(_name_21, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); } else { @@ -661,8 +600,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); _builder.append("\t"); _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); - String _name_23 = sub_2.getName(); - _builder.append(_name_23, "\t\t\t"); + String _name_22 = sub_2.getName(); + _builder.append(_name_22, "\t\t\t"); _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); _builder.append("\"+i);"); _builder.newLineIfNotEmpty(); @@ -672,11 +611,11 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("new "); ActorClass _type_4 = sub_2.getType(); - String _name_24 = _type_4.getName(); - _builder.append(_name_24, "\t\t\t"); + String _name_23 = _type_4.getName(); + _builder.append(_name_23, "\t\t\t"); _builder.append("(this, \""); - String _name_25 = sub_2.getName(); - _builder.append(_name_25, "\t\t\t"); + String _name_24 = sub_2.getName(); + _builder.append(_name_24, "\t\t\t"); _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); _builder.append("\"+i);"); _builder.newLineIfNotEmpty(); @@ -690,8 +629,8 @@ public class ActorClassGen extends GenericActorClassGenerator { if (_isGenerateMSCInstrumentation_1) { _builder.append("\t\t"); _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); - String _name_26 = sub_2.getName(); - _builder.append(_name_26, "\t\t"); + String _name_25 = sub_2.getName(); + _builder.append(_name_25, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); } @@ -699,11 +638,11 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); _builder.append("new "); ActorClass _type_5 = sub_2.getType(); - String _name_27 = _type_5.getName(); - _builder.append(_name_27, "\t\t"); + String _name_26 = _type_5.getName(); + _builder.append(_name_26, "\t\t"); _builder.append("(this, \""); - String _name_28 = sub_2.getName(); - _builder.append(_name_28, "\t\t"); + String _name_27 = sub_2.getName(); + _builder.append(_name_27, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); } @@ -711,7 +650,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// wiring"); @@ -740,7 +678,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); { boolean _or_1 = false; @@ -762,30 +699,11 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); } } - _builder.append("\t\t"); _builder.newLine(); - { - boolean _notEquals_5 = (!Objects.equal(ctor, null)); - if (_notEquals_5) { - _builder.append("\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("// user defined constructor body"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - AbstractGenerator _instance_1 = AbstractGenerator.getInstance(); - DetailCode _detailCode_1 = ctor.getDetailCode(); - String _translatedCode_1 = _instance_1.getTranslatedCode(_detailCode_1); - _builder.append(_translatedCode_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } - } + _builder.append("\t\t"); + String _userStructorBody = this._procedureHelpers.userStructorBody(ac, true); + _builder.append(_userStructorBody, "\t\t"); + _builder.newLineIfNotEmpty(); _builder.newLine(); { boolean _or_2 = false; @@ -806,8 +724,8 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final Attribute a_1 : _dynConfigReadAttributes_3) { _builder.append("\t\t"); _builder.append("lock_"); - String _name_29 = a_1.getName(); - _builder.append(_name_29, "\t\t"); + String _name_28 = a_1.getName(); + _builder.append(_name_28, "\t\t"); _builder.append(" = new DynConfigLock();"); _builder.newLineIfNotEmpty(); } @@ -817,23 +735,20 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); EList<Attribute> _attributes_3 = ac.getAttributes(); List<Attribute> _dynConfigReadAttributes_4 = this.dataConfigExt.getDynConfigReadAttributes(ac); List<Attribute> _minus = this._roomExtensions.<Attribute>minus(_attributes_3, _dynConfigReadAttributes_4); - String _name_30 = ac.getName(); - CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_minus, _name_30); + String _name_29 = ac.getName(); + CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_minus, _name_29); _builder.append(_attributeSettersGettersImplementation, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); CharSequence _genDynConfigGetterSetter = this.configGenAddon.genDynConfigGetterSetter(ac); _builder.append(_genDynConfigGetterSetter, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("//--------------------- port getters"); @@ -843,9 +758,9 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final Port ep_2 : _endPorts_2) { _builder.append("\t"); String _portClassName_6 = this._roomExtensions.getPortClassName(ep_2); - String _name_31 = ep_2.getName(); - String _name_32 = ac.getName(); - CharSequence _terImplementation = this._procedureHelpers.getterImplementation(_portClassName_6, _name_31, _name_32); + String _name_30 = ep_2.getName(); + String _name_31 = ac.getName(); + CharSequence _terImplementation = this._procedureHelpers.getterImplementation(_portClassName_6, _name_30, _name_31); _builder.append(_terImplementation, "\t"); _builder.newLineIfNotEmpty(); } @@ -855,9 +770,9 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final SAP sap_2 : _serviceAccessPoints_2) { _builder.append("\t"); String _portClassName_7 = this._roomExtensions.getPortClassName(sap_2); - String _name_33 = sap_2.getName(); - String _name_34 = ac.getName(); - CharSequence _terImplementation_1 = this._procedureHelpers.getterImplementation(_portClassName_7, _name_33, _name_34); + String _name_32 = sap_2.getName(); + String _name_33 = ac.getName(); + CharSequence _terImplementation_1 = this._procedureHelpers.getterImplementation(_portClassName_7, _name_32, _name_33); _builder.append(_terImplementation_1, "\t"); _builder.newLineIfNotEmpty(); } @@ -868,9 +783,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); String _portClassName_8 = this._roomExtensions.getPortClassName(svc_2); SPP _spp_4 = svc_2.getSpp(); - String _name_35 = _spp_4.getName(); - String _name_36 = ac.getName(); - CharSequence _terImplementation_2 = this._procedureHelpers.getterImplementation(_portClassName_8, _name_35, _name_36); + String _name_34 = _spp_4.getName(); + String _name_35 = ac.getName(); + CharSequence _terImplementation_2 = this._procedureHelpers.getterImplementation(_portClassName_8, _name_34, _name_35); _builder.append(_terImplementation_2, "\t"); _builder.newLineIfNotEmpty(); } @@ -907,7 +822,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); { if (manualBehavior) { @@ -920,14 +834,9 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); _builder.append("\t"); _builder.append("\t"); - _builder.append("if(this.getClass() == "); - _builder.append(clsname, "\t\t"); - _builder.append(".class)"); + String _userStructorBody_1 = this._procedureHelpers.userStructorBody(ac, false); + _builder.append(_userStructorBody_1, "\t\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("\t\t"); - _builder.append("dtor();"); - _builder.newLine(); { GlobalSettings _settings_6 = Main.getSettings(); boolean _isGenerateMSCInstrumentation_2 = _settings_6.isGenerateMSCInstrumentation(); @@ -983,8 +892,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("if (ifitem=="); - String _name_37 = ifitem.getName(); - _builder.append(_name_37, "\t\t"); + String _name_36 = ifitem.getName(); + _builder.append(_name_36, "\t\t"); _builder.append(") {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -1000,8 +909,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); _builder.append("case "); ProtocolClass _protocolClass = this._roomHelpers.getProtocolClass(msg); - String _name_38 = _protocolClass.getName(); - _builder.append(_name_38, "\t\t\t\t"); + String _name_37 = _protocolClass.getName(); + _builder.append(_name_37, "\t\t\t\t"); _builder.append("."); String _xifexpression_6 = null; boolean _isIncoming = this._roomExtensions.isIncoming(msg); @@ -1011,14 +920,14 @@ public class ActorClassGen extends GenericActorClassGenerator { _xifexpression_6 = "OUT_"; } _builder.append(_xifexpression_6, "\t\t\t\t"); - String _name_39 = msg.getName(); - _builder.append(_name_39, "\t\t\t\t"); + String _name_38 = msg.getName(); + _builder.append(_name_38, "\t\t\t\t"); _builder.append(":"); _builder.newLineIfNotEmpty(); { VarDecl _data = msg.getData(); - boolean _notEquals_6 = (!Objects.equal(_data, null)); - if (_notEquals_6) { + boolean _notEquals_3 = (!Objects.equal(_data, null)); + if (_notEquals_3) { _builder.append("\t"); _builder.append("\t"); _builder.append("\t\t"); @@ -1034,20 +943,20 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); _builder.append("\t"); _builder.append("on_"); - String _name_40 = ifitem.getName(); - _builder.append(_name_40, "\t\t\t\t\t"); + String _name_39 = ifitem.getName(); + _builder.append(_name_39, "\t\t\t\t\t"); _builder.append("_"); - String _name_41 = msg.getName(); - _builder.append(_name_41, "\t\t\t\t\t"); + String _name_40 = msg.getName(); + _builder.append(_name_40, "\t\t\t\t\t"); _builder.append("(ifitem"); { VarDecl _data_1 = msg.getData(); - boolean _notEquals_7 = (!Objects.equal(_data_1, null)); - if (_notEquals_7) { + boolean _notEquals_4 = (!Objects.equal(_data_1, null)); + if (_notEquals_4) { _builder.append(", "); VarDecl _data_2 = msg.getData(); - String _name_42 = _data_2.getName(); - _builder.append(_name_42, "\t\t\t\t\t"); + String _name_41 = _data_2.getName(); + _builder.append(_name_41, "\t\t\t\t\t"); } } _builder.append(");"); @@ -1060,8 +969,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLine(); { VarDecl _data_3 = msg.getData(); - boolean _notEquals_8 = (!Objects.equal(_data_3, null)); - if (_notEquals_8) { + boolean _notEquals_5 = (!Objects.equal(_data_3, null)); + if (_notEquals_5) { _builder.append("\t"); _builder.append("\t"); _builder.append("\t\t"); @@ -1094,16 +1003,16 @@ public class ActorClassGen extends GenericActorClassGenerator { for(final Message msg_1 : _incoming_1) { _builder.append("\t"); _builder.append("protected void on_"); - String _name_43 = ifitem_1.getName(); - _builder.append(_name_43, "\t"); + String _name_42 = ifitem_1.getName(); + _builder.append(_name_42, "\t"); _builder.append("_"); - String _name_44 = msg_1.getName(); - _builder.append(_name_44, "\t"); + String _name_43 = msg_1.getName(); + _builder.append(_name_43, "\t"); _builder.append("(InterfaceItemBase ifitem"); { VarDecl _data_4 = msg_1.getData(); - boolean _notEquals_9 = (!Objects.equal(_data_4, null)); - if (_notEquals_9) { + boolean _notEquals_6 = (!Objects.equal(_data_4, null)); + if (_notEquals_6) { VarDecl _data_5 = msg_1.getData(); String[] _generateArglistAndTypedData = this._javaExtensions.generateArglistAndTypedData(_data_5); String _get = _generateArglistAndTypedData[2]; @@ -1116,7 +1025,6 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public abstract void executeInitTransition();"); @@ -1200,7 +1108,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public void executeInitTransition() {}"); @@ -1210,13 +1117,11 @@ public class ActorClassGen extends GenericActorClassGenerator { } } } - _builder.append("\t"); _builder.newLine(); { GlobalSettings _settings_7 = Main.getSettings(); boolean _isGeneratePersistenceInterface_2 = _settings_7.isGeneratePersistenceInterface(); if (_isGeneratePersistenceInterface_2) { - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -1239,8 +1144,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("for (int h: history) output.writeInt(h);"); _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); } } @@ -1251,7 +1154,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("protected void saveAttributes(ObjectOutput output) throws IOException {"); @@ -1264,7 +1166,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -1287,8 +1188,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("for (int i=0; i<history.length; ++i) history[i] = input.readInt();"); _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); } } @@ -1299,7 +1198,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("protected void loadAttributes(ObjectInput input) throws IOException, ClassNotFoundException {"); @@ -1318,7 +1216,6 @@ public class ActorClassGen extends GenericActorClassGenerator { GlobalSettings _settings_8 = Main.getSettings(); boolean _isGenerateStoreDataObj_2 = _settings_8.isGenerateStoreDataObj(); if (_isGenerateStoreDataObj_2) { - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("protected void store(IActorClassDataObject obj) {"); @@ -1333,8 +1230,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); _builder.append("return;"); _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("\t"); @@ -1345,10 +1240,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); { ActorClass _actorBase_2 = ac.getActorBase(); - boolean _notEquals_10 = (!Objects.equal(_actorBase_2, null)); - if (_notEquals_10) { - _builder.append("\t"); - _builder.append("\t"); + boolean _notEquals_7 = (!Objects.equal(_actorBase_2, null)); + if (_notEquals_7) { _builder.newLine(); _builder.append("\t"); _builder.append("\t"); @@ -1359,8 +1252,6 @@ public class ActorClassGen extends GenericActorClassGenerator { { boolean _hasNonEmptyStateMachine_1 = this._roomHelpers.hasNonEmptyStateMachine(ac); if (_hasNonEmptyStateMachine_1) { - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("\t"); @@ -1377,8 +1268,6 @@ public class ActorClassGen extends GenericActorClassGenerator { boolean _isEmpty_5 = _attributes_4.isEmpty(); boolean _not_5 = (!_isEmpty_5); if (_not_5) { - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); { EList<Attribute> _attributes_5 = ac.getAttributes(); @@ -1395,27 +1284,27 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("dataObject.set"); - String _name_45 = att.getName(); - String _firstUpper = StringExtensions.toFirstUpper(_name_45); + String _name_44 = att.getName(); + String _firstUpper = StringExtensions.toFirstUpper(_name_44); _builder.append(_firstUpper, "\t\t"); _builder.append("(Arrays.copyOf("); + String _name_45 = att.getName(); + _builder.append(_name_45, "\t\t"); + _builder.append(", "); String _name_46 = att.getName(); _builder.append(_name_46, "\t\t"); - _builder.append(", "); - String _name_47 = att.getName(); - _builder.append(_name_47, "\t\t"); _builder.append(".length));"); _builder.newLineIfNotEmpty(); } else { _builder.append("\t"); _builder.append("\t"); _builder.append("dataObject.set"); - String _name_48 = att.getName(); - String _firstUpper_1 = StringExtensions.toFirstUpper(_name_48); + String _name_47 = att.getName(); + String _firstUpper_1 = StringExtensions.toFirstUpper(_name_47); _builder.append(_firstUpper_1, "\t\t"); _builder.append("("); - String _name_49 = att.getName(); - _builder.append(_name_49, "\t\t"); + String _name_48 = att.getName(); + _builder.append(_name_48, "\t\t"); _builder.append(");"); _builder.newLineIfNotEmpty(); } @@ -1434,14 +1323,14 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); RefableType _type_8 = att.getType(); DataType _type_9 = _type_8.getType(); - String _name_50 = _type_9.getName(); - _builder.append(_name_50, "\t\t\t"); + String _name_49 = _type_9.getName(); + _builder.append(_name_49, "\t\t\t"); _builder.append("[] arr = Arrays.copyOf("); + String _name_50 = att.getName(); + _builder.append(_name_50, "\t\t\t"); + _builder.append(", "); String _name_51 = att.getName(); _builder.append(_name_51, "\t\t\t"); - _builder.append(", "); - String _name_52 = att.getName(); - _builder.append(_name_52, "\t\t\t"); _builder.append(".length);"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -1453,8 +1342,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("dataObject.set"); - String _name_53 = att.getName(); - String _firstUpper_2 = StringExtensions.toFirstUpper(_name_53); + String _name_52 = att.getName(); + String _firstUpper_2 = StringExtensions.toFirstUpper(_name_52); _builder.append(_firstUpper_2, "\t\t\t"); _builder.append("(arr);"); _builder.newLineIfNotEmpty(); @@ -1466,12 +1355,12 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("dataObject.set"); - String _name_54 = att.getName(); - String _firstUpper_3 = StringExtensions.toFirstUpper(_name_54); + String _name_53 = att.getName(); + String _firstUpper_3 = StringExtensions.toFirstUpper(_name_53); _builder.append(_firstUpper_3, "\t\t"); _builder.append("("); - String _name_55 = att.getName(); - _builder.append(_name_55, "\t\t"); + String _name_54 = att.getName(); + _builder.append(_name_54, "\t\t"); _builder.append(".deepCopy());"); _builder.newLineIfNotEmpty(); } @@ -1485,7 +1374,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("protected void restore(IActorClassDataObject obj) {"); @@ -1500,8 +1388,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t\t"); _builder.append("return;"); _builder.newLine(); - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("\t"); @@ -1512,10 +1398,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.newLineIfNotEmpty(); { ActorClass _actorBase_3 = ac.getActorBase(); - boolean _notEquals_11 = (!Objects.equal(_actorBase_3, null)); - if (_notEquals_11) { - _builder.append("\t"); - _builder.append("\t"); + boolean _notEquals_8 = (!Objects.equal(_actorBase_3, null)); + if (_notEquals_8) { _builder.newLine(); _builder.append("\t"); _builder.append("\t"); @@ -1526,8 +1410,6 @@ public class ActorClassGen extends GenericActorClassGenerator { { boolean _hasNonEmptyStateMachine_2 = this._roomHelpers.hasNonEmptyStateMachine(ac); if (_hasNonEmptyStateMachine_2) { - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("\t"); @@ -1544,8 +1426,6 @@ public class ActorClassGen extends GenericActorClassGenerator { boolean _isEmpty_6 = _attributes_6.isEmpty(); boolean _not_6 = (!_isEmpty_6); if (_not_6) { - _builder.append("\t"); - _builder.append("\t"); _builder.newLine(); { EList<Attribute> _attributes_7 = ac.getAttributes(); @@ -1562,28 +1442,28 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("set"); - String _name_56 = att_1.getName(); - String _firstUpper_4 = StringExtensions.toFirstUpper(_name_56); + String _name_55 = att_1.getName(); + String _firstUpper_4 = StringExtensions.toFirstUpper(_name_55); _builder.append(_firstUpper_4, "\t\t"); _builder.append("(Arrays.copyOf(dataObject.get"); - String _name_57 = att_1.getName(); - String _firstUpper_5 = StringExtensions.toFirstUpper(_name_57); + String _name_56 = att_1.getName(); + String _firstUpper_5 = StringExtensions.toFirstUpper(_name_56); _builder.append(_firstUpper_5, "\t\t"); _builder.append("(), "); - String _name_58 = att_1.getName(); - _builder.append(_name_58, "\t\t"); + String _name_57 = att_1.getName(); + _builder.append(_name_57, "\t\t"); _builder.append(".length));"); _builder.newLineIfNotEmpty(); } else { _builder.append("\t"); _builder.append("\t"); _builder.append("set"); - String _name_59 = att_1.getName(); - String _firstUpper_6 = StringExtensions.toFirstUpper(_name_59); + String _name_58 = att_1.getName(); + String _firstUpper_6 = StringExtensions.toFirstUpper(_name_58); _builder.append(_firstUpper_6, "\t\t"); _builder.append("(dataObject.get"); - String _name_60 = att_1.getName(); - String _firstUpper_7 = StringExtensions.toFirstUpper(_name_60); + String _name_59 = att_1.getName(); + String _firstUpper_7 = StringExtensions.toFirstUpper(_name_59); _builder.append(_firstUpper_7, "\t\t"); _builder.append("());"); _builder.newLineIfNotEmpty(); @@ -1603,15 +1483,15 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); RefableType _type_12 = att_1.getType(); DataType _type_13 = _type_12.getType(); - String _name_61 = _type_13.getName(); - _builder.append(_name_61, "\t\t\t"); + String _name_60 = _type_13.getName(); + _builder.append(_name_60, "\t\t\t"); _builder.append("[] arr = Arrays.copyOf(dataObject.get"); - String _name_62 = att_1.getName(); - String _firstUpper_8 = StringExtensions.toFirstUpper(_name_62); + String _name_61 = att_1.getName(); + String _firstUpper_8 = StringExtensions.toFirstUpper(_name_61); _builder.append(_firstUpper_8, "\t\t\t"); _builder.append("(), "); - String _name_63 = att_1.getName(); - _builder.append(_name_63, "\t\t\t"); + String _name_62 = att_1.getName(); + _builder.append(_name_62, "\t\t\t"); _builder.append(".length);"); _builder.newLineIfNotEmpty(); _builder.append("\t"); @@ -1623,8 +1503,8 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("set"); - String _name_64 = att_1.getName(); - String _firstUpper_9 = StringExtensions.toFirstUpper(_name_64); + String _name_63 = att_1.getName(); + String _firstUpper_9 = StringExtensions.toFirstUpper(_name_63); _builder.append(_firstUpper_9, "\t\t\t"); _builder.append("(arr);"); _builder.newLineIfNotEmpty(); @@ -1636,12 +1516,12 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("\t"); _builder.append("set"); - String _name_65 = att_1.getName(); - String _firstUpper_10 = StringExtensions.toFirstUpper(_name_65); + String _name_64 = att_1.getName(); + String _firstUpper_10 = StringExtensions.toFirstUpper(_name_64); _builder.append(_firstUpper_10, "\t\t"); _builder.append("(dataObject.get"); - String _name_66 = att_1.getName(); - String _firstUpper_11 = StringExtensions.toFirstUpper(_name_66); + String _name_65 = att_1.getName(); + String _firstUpper_11 = StringExtensions.toFirstUpper(_name_65); _builder.append(_firstUpper_11, "\t\t"); _builder.append("().deepCopy());"); _builder.newLineIfNotEmpty(); @@ -1656,7 +1536,6 @@ public class ActorClassGen extends GenericActorClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("protected "); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java index d00f25742..b54bc5873 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java @@ -15,10 +15,8 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import java.util.List; import org.eclipse.emf.common.util.EList; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; import org.eclipse.etrice.core.genmodel.etricegen.Root; import org.eclipse.etrice.core.room.Attribute; -import org.eclipse.etrice.core.room.ClassStructor; import org.eclipse.etrice.core.room.ComplexType; import org.eclipse.etrice.core.room.DataClass; import org.eclipse.etrice.core.room.DataType; @@ -26,7 +24,6 @@ import org.eclipse.etrice.core.room.RefableType; import org.eclipse.etrice.core.room.RoomModel; import org.eclipse.etrice.core.room.StandardOperation; import org.eclipse.etrice.core.room.util.RoomHelpers; -import org.eclipse.etrice.generator.base.AbstractGenerator; import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers; import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo; import org.eclipse.etrice.generator.generic.ProcedureHelpers; @@ -91,271 +88,196 @@ public class DataClassGen { } public CharSequence generate(final Root root, final DataClass dc) { - CharSequence _xblockexpression = null; + StringConcatenation _builder = new StringConcatenation(); + _builder.append("package "); + String _package = this._roomExtensions.getPackage(dc); + _builder.append(_package, ""); + _builder.append(";"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;"); + _builder.newLine(); + _builder.append("import java.io.Serializable;"); + _builder.newLine(); + _builder.newLine(); + EList<RoomModel> models = root.getReferencedModels(dc); + _builder.newLineIfNotEmpty(); { - EList<ClassStructor> _structors = dc.getStructors(); - final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - return Boolean.valueOf(it.isConstructor()); - } - }; - final ClassStructor ctor = IterableExtensions.<ClassStructor>findFirst(_structors, _function); - EList<ClassStructor> _structors_1 = dc.getStructors(); - final Function1<ClassStructor, Boolean> _function_1 = new Function1<ClassStructor, Boolean>() { - public Boolean apply(final ClassStructor it) { - boolean _isConstructor = it.isConstructor(); - return Boolean.valueOf((!_isConstructor)); - } - }; - final ClassStructor dtor = IterableExtensions.<ClassStructor>findFirst(_structors_1, _function_1); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("package "); - String _package = this._roomExtensions.getPackage(dc); - _builder.append(_package, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;"); - _builder.newLine(); - _builder.append("import java.io.Serializable;"); - _builder.newLine(); - _builder.newLine(); - EList<RoomModel> models = root.getReferencedModels(dc); - _builder.newLineIfNotEmpty(); - { - for(final RoomModel model : models) { - _builder.append("import "); - String _name = model.getName(); - _builder.append(_name, ""); - _builder.append(".*;"); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _userCode = this._procedureHelpers.userCode(dc, 1); - _builder.append(_userCode, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.newLine(); - _builder.append("public class "); - String _name_1 = dc.getName(); - _builder.append(_name_1, ""); - { - DataClass _base = dc.getBase(); - boolean _notEquals = (!Objects.equal(_base, null)); - if (_notEquals) { - _builder.append(" extends "); - DataClass _base_1 = dc.getBase(); - String _name_2 = _base_1.getName(); - _builder.append(_name_2, ""); - } - } - _builder.append(" implements Serializable {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("private static final long serialVersionUID = "); - String _package_1 = this._roomExtensions.getPackage(dc); - String _name_3 = dc.getName(); - String _plus = (_package_1 + _name_3); - int _hashCode = _plus.hashCode(); - _builder.append(_hashCode, "\t"); - _builder.append("L;"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - CharSequence _userCode_1 = this._procedureHelpers.userCode(dc, 2); - _builder.append(_userCode_1, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - EList<Attribute> _attributes = dc.getAttributes(); - CharSequence _attributes_1 = this._procedureHelpers.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_4 = dc.getName(); - CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_attributes_2, _name_4); - _builder.append(_attributeSettersGettersImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - EList<StandardOperation> _operations = dc.getOperations(); - String _name_5 = dc.getName(); - CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_5); - _builder.append(_operationsImplementation, "\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("//--------------------- destruction"); - _builder.newLine(); - _builder.append("\t"); - String _name_6 = dc.getName(); - CharSequence _destructorSignature = this._procedureHelpers.getDestructorSignature(_name_6); - _builder.append(_destructorSignature, "\t"); - _builder.append(" {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - { - DataClass _base_2 = dc.getBase(); - boolean _notEquals_1 = (!Objects.equal(_base_2, null)); - if (_notEquals_1) { - _builder.append("super.dtor();"); - } - } - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - { - boolean _notEquals_2 = (!Objects.equal(dtor, null)); - if (_notEquals_2) { - AbstractGenerator _instance = AbstractGenerator.getInstance(); - DetailCode _detailCode = dtor.getDetailCode(); - String _translatedCode = _instance.getTranslatedCode(_detailCode); - _builder.append(_translatedCode, "\t\t"); - } + for(final RoomModel model : models) { + _builder.append("import "); + String _name = model.getName(); + _builder.append(_name, ""); + _builder.append(".*;"); + _builder.newLineIfNotEmpty(); } - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// default constructor"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_7 = dc.getName(); - _builder.append(_name_7, "\t"); - _builder.append("() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("super();"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.newLine(); - _builder.append("\t\t"); - EList<Attribute> _attributes_3 = dc.getAttributes(); - CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes_3, dc, true); - _builder.append(_attributeInitialization, "\t\t"); - _builder.newLineIfNotEmpty(); - { - boolean _notEquals_3 = (!Objects.equal(ctor, null)); - if (_notEquals_3) { - _builder.append("\t\t"); - _builder.append("{"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - _builder.append("// user defined constructor body"); - _builder.newLine(); - _builder.append("\t\t"); - _builder.append("\t"); - AbstractGenerator _instance_1 = AbstractGenerator.getInstance(); - DetailCode _detailCode_1 = ctor.getDetailCode(); - String _translatedCode_1 = _instance_1.getTranslatedCode(_detailCode_1); - _builder.append(_translatedCode_1, "\t\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("}"); - _builder.newLine(); - } + } + _builder.newLine(); + CharSequence _userCode = this._procedureHelpers.userCode(dc, 1); + _builder.append(_userCode, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.newLine(); + _builder.append("public class "); + String _name_1 = dc.getName(); + _builder.append(_name_1, ""); + { + DataClass _base = dc.getBase(); + boolean _notEquals = (!Objects.equal(_base, null)); + if (_notEquals) { + _builder.append(" extends "); + DataClass _base_1 = dc.getBase(); + String _name_2 = _base_1.getName(); + _builder.append(_name_2, ""); } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// constructor using fields"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_8 = dc.getName(); - _builder.append(_name_8, "\t"); - _builder.append("("); - CharSequence _argList = this.argList(dc); - _builder.append(_argList, "\t"); - _builder.append(") {"); - _builder.newLineIfNotEmpty(); - { + } + _builder.append(" implements Serializable {"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("private static final long serialVersionUID = "); + String _package_1 = this._roomExtensions.getPackage(dc); + String _name_3 = dc.getName(); + String _plus = (_package_1 + _name_3); + int _hashCode = _plus.hashCode(); + _builder.append(_hashCode, "\t"); + _builder.append("L;"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + CharSequence _userCode_1 = this._procedureHelpers.userCode(dc, 2); + _builder.append(_userCode_1, "\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + EList<Attribute> _attributes = dc.getAttributes(); + CharSequence _attributes_1 = this._procedureHelpers.attributes(_attributes); + _builder.append(_attributes_1, "\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + EList<Attribute> _attributes_2 = dc.getAttributes(); + String _name_4 = dc.getName(); + CharSequence _attributeSettersGettersImplementation = this._procedureHelpers.attributeSettersGettersImplementation(_attributes_2, _name_4); + _builder.append(_attributeSettersGettersImplementation, "\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + EList<StandardOperation> _operations = dc.getOperations(); + String _name_5 = dc.getName(); + CharSequence _operationsImplementation = this._procedureHelpers.operationsImplementation(_operations, _name_5); + _builder.append(_operationsImplementation, "\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// default constructor"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("public "); + String _name_6 = dc.getName(); + _builder.append(_name_6, "\t"); + _builder.append("() {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("super();"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t\t"); + EList<Attribute> _attributes_3 = dc.getAttributes(); + CharSequence _attributeInitialization = this._initialization.attributeInitialization(_attributes_3, dc, true); + _builder.append(_attributeInitialization, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("\t\t"); + String _userStructorBody = this._procedureHelpers.userStructorBody(dc, true); + _builder.append(_userStructorBody, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// constructor using fields"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("public "); + String _name_7 = dc.getName(); + _builder.append(_name_7, "\t"); + _builder.append("("); + CharSequence _argList = this.argList(dc); + _builder.append(_argList, "\t"); + _builder.append(") {"); + _builder.newLineIfNotEmpty(); + { + DataClass _base_2 = dc.getBase(); + boolean _notEquals_1 = (!Objects.equal(_base_2, null)); + if (_notEquals_1) { + _builder.append("\t\t"); + _builder.append("super("); DataClass _base_3 = dc.getBase(); - boolean _notEquals_4 = (!Objects.equal(_base_3, null)); - if (_notEquals_4) { - _builder.append("\t\t"); - _builder.append("super("); - DataClass _base_4 = dc.getBase(); - String _paramList = this.paramList(_base_4); - _builder.append(_paramList, "\t\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - } else { - _builder.append("\t\t"); - _builder.append("super();"); - _builder.newLine(); - } + String _paramList = this.paramList(_base_3); + _builder.append(_paramList, "\t\t"); + _builder.append(");"); + _builder.newLineIfNotEmpty(); + } else { + _builder.append("\t\t"); + _builder.append("super();"); + _builder.newLine(); } - _builder.append("\t\t"); - _builder.newLine(); - { - EList<Attribute> _attributes_4 = dc.getAttributes(); - for(final Attribute a : _attributes_4) { - _builder.append("\t\t"); - _builder.append("this."); - String _name_9 = a.getName(); - _builder.append(_name_9, "\t\t"); - _builder.append(" = "); - String _name_10 = a.getName(); - _builder.append(_name_10, "\t\t"); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } + } + _builder.newLine(); + { + EList<Attribute> _attributes_4 = dc.getAttributes(); + for(final Attribute a : _attributes_4) { + _builder.append("\t\t"); + _builder.append("this."); + String _name_8 = a.getName(); + _builder.append(_name_8, "\t\t"); + _builder.append(" = "); + String _name_9 = a.getName(); + _builder.append(_name_9, "\t\t"); + _builder.append(";"); + _builder.newLineIfNotEmpty(); } - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("// deep copy"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("public "); - String _name_11 = dc.getName(); - _builder.append(_name_11, "\t"); - _builder.append(" deepCopy() {"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - String _name_12 = dc.getName(); - _builder.append(_name_12, "\t\t"); - _builder.append(" copy = new "); - String _name_13 = dc.getName(); - _builder.append(_name_13, "\t\t"); - _builder.append("();"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - String _deepCopy = this.deepCopy(dc); - _builder.append(_deepCopy, "\t\t"); - _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); - _builder.append("return copy;"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("}"); - _builder.newLine(); - _builder.append("};"); - _builder.newLine(); - _xblockexpression = _builder; } - return _xblockexpression; + _builder.newLine(); + _builder.append("\t\t"); + String _userStructorBody_1 = this._procedureHelpers.userStructorBody(dc, true); + _builder.append(_userStructorBody_1, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.newLine(); + _builder.append("\t"); + _builder.append("// deep copy"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("public "); + String _name_10 = dc.getName(); + _builder.append(_name_10, "\t"); + _builder.append(" deepCopy() {"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + String _name_11 = dc.getName(); + _builder.append(_name_11, "\t\t"); + _builder.append(" copy = new "); + String _name_12 = dc.getName(); + _builder.append(_name_12, "\t\t"); + _builder.append("();"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + String _deepCopy = this.deepCopy(dc); + _builder.append(_deepCopy, "\t\t"); + _builder.newLineIfNotEmpty(); + _builder.append("\t\t"); + _builder.append("return copy;"); + _builder.newLine(); + _builder.append("\t"); + _builder.append("}"); + _builder.newLine(); + _builder.append("};"); + _builder.newLine(); + return _builder; } public String paramList(final DataClass _dc) { diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java index 2dac29771..f63cf8fdb 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/JavaExtensions.java @@ -247,24 +247,12 @@ public class JavaExtensions implements ILanguageExtension { return "Object"; } - public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) { - return (((type + " ") + name) + "[]"); - } - - public String constructorName(final String cls) { - return cls; - } - - public String destructorName(final String cls) { - return "dtor"; - } - - public String constructorReturnType() { - return "void"; + public String typeArrayModifier() { + return "[]"; } - public String destructorReturnType() { - return "void"; + public String arrayDeclaration(final String type, final int size, final String name, final boolean isRef) { + return (((type + " ") + name) + "[]"); } public String superCall(final String baseClassName, final String method, final String args) { diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java index b1c0871e0..554b404f6 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/NodeGen.java @@ -32,6 +32,7 @@ import org.eclipse.etrice.core.etphys.eTPhys.ExecMode; import org.eclipse.etrice.core.etphys.eTPhys.NodeClass; import org.eclipse.etrice.core.etphys.eTPhys.NodeRef; import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread; +import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants; import org.eclipse.etrice.core.genmodel.etricegen.AbstractInstance; import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance; import org.eclipse.etrice.core.genmodel.etricegen.ActorInterfaceInstance; @@ -278,7 +279,6 @@ public class NodeGen { _builder.append(clsname, ""); _builder.append(" extends SubSystemClassBase {"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); { Iterable<Indexed<PhysicalThread>> _indexed = Indexed.<PhysicalThread>indexed(threads); @@ -300,7 +300,6 @@ public class NodeGen { CharSequence _userCode_1 = this._procedureHelpers.userCode(cc, 2, false); _builder.append(_userCode_1, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public "); @@ -313,7 +312,6 @@ public class NodeGen { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -324,15 +322,13 @@ public class NodeGen { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); - _builder.append("@Override\t"); + _builder.append("@Override"); _builder.newLine(); _builder.append("\t"); _builder.append("public void instantiateMessageServices() {"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("IMessageService msgService;"); @@ -398,7 +394,6 @@ public class NodeGen { _builder.append("\t"); _builder.append("public void instantiateActors() {"); _builder.newLine(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// thread mappings"); @@ -460,7 +455,8 @@ public class NodeGen { _builder.append("DebuggingService.getInstance().addMessageActorCreate(this, \""); String _name_5 = sub.getName(); _builder.append(_name_5, "\t\t\t"); - _builder.append("_\"+i);"); + _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); + _builder.append("\"+i);"); _builder.newLineIfNotEmpty(); } } @@ -473,7 +469,8 @@ public class NodeGen { _builder.append("(this, \""); String _name_7 = sub.getName(); _builder.append(_name_7, "\t\t\t"); - _builder.append("_\"+i);"); + _builder.append(GenmodelConstants.INDEX_SEP, "\t\t\t"); + _builder.append("\"+i);"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("}"); @@ -499,13 +496,12 @@ public class NodeGen { _builder.append("(this, \""); String _name_10 = sub.getName(); _builder.append(_name_10, "\t\t"); - _builder.append("\"); "); + _builder.append("\");"); _builder.newLineIfNotEmpty(); } } } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// create service brokers in optional actor interfaces"); @@ -567,7 +563,6 @@ public class NodeGen { _builder.newLine(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// wiring"); @@ -596,7 +591,6 @@ public class NodeGen { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// apply instance attribute configurations"); @@ -650,7 +644,6 @@ public class NodeGen { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -700,7 +693,6 @@ public class NodeGen { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -726,7 +718,6 @@ public class NodeGen { GlobalSettings _settings_5 = Main.getSettings(); boolean _isGenerateMSCInstrumentation_5 = _settings_5.isGenerateMSCInstrumentation(); if (_isGenerateMSCInstrumentation_5) { - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -741,7 +732,6 @@ public class NodeGen { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); @@ -766,7 +756,6 @@ public class NodeGen { _builder.newLine(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public IOptionalActorFactory getFactory(String optionalActorClass, String actorClass) {"); @@ -825,7 +814,6 @@ public class NodeGen { _builder.newLine(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("return null;"); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java index cf2893be6..7f7aa2ff9 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.java @@ -249,11 +249,11 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLine(); _builder.newLine(); _builder.append("\t"); - CharSequence _portClass = this.portClass(pc, Boolean.valueOf(false)); + CharSequence _portClass = this.portClass(pc, false); _builder.append(_portClass, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); - CharSequence _portClass_1 = this.portClass(pc, Boolean.valueOf(true)); + CharSequence _portClass_1 = this.portClass(pc, true); _builder.append(_portClass_1, "\t"); _builder.newLineIfNotEmpty(); _builder.append("}"); @@ -261,12 +261,12 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { return _builder; } - public CharSequence portClass(final ProtocolClass pc, final Boolean conj) { + public CharSequence portClass(final ProtocolClass pc, final boolean conj) { CharSequence _xblockexpression = null; { - PortClass pclass = this._roomExtensions.getPortClass(pc, (conj).booleanValue()); - String portClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue()); - String replPortClassName = this._roomExtensions.getPortClassName(pc, (conj).booleanValue(), true); + PortClass pclass = this._roomExtensions.getPortClass(pc, conj); + String portClassName = this._roomExtensions.getPortClassName(pc, conj); + String replPortClassName = this._roomExtensions.getPortClassName(pc, conj, true); StringConcatenation _builder = new StringConcatenation(); _builder.newLine(); _builder.append("// port class"); @@ -333,7 +333,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { GlobalSettings _settings_1 = Main.getSettings(); boolean _isGenerateMSCInstrumentation_1 = _settings_1.isGenerateMSCInstrumentation(); if (_isGenerateMSCInstrumentation_1) { - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public void destroy() {"); @@ -380,13 +379,13 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { } } { - boolean _handlesReceive = this._roomExtensions.handlesReceive(pc, (conj).booleanValue()); + boolean _handlesReceive = this._roomExtensions.handlesReceive(pc, conj); if (_handlesReceive) { _builder.append("\t\t\t"); _builder.append("switch (msg.getEvtId()) {"); _builder.newLine(); { - List<MessageHandler> _receiveHandlers = this._roomExtensions.getReceiveHandlers(pc, (conj).booleanValue()); + List<MessageHandler> _receiveHandlers = this._roomExtensions.getReceiveHandlers(pc, conj); for(final MessageHandler hdlr : _receiveHandlers) { _builder.append("\t\t\t"); _builder.append("\t"); @@ -440,7 +439,7 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("getActor().receiveEvent(this, msg.getEvtId(), null);"); _builder.newLine(); { - boolean _handlesReceive_1 = this._roomExtensions.handlesReceive(pc, (conj).booleanValue()); + boolean _handlesReceive_1 = this._roomExtensions.handlesReceive(pc, conj); if (_handlesReceive_1) { _builder.append("\t\t\t"); _builder.append("}"); @@ -473,16 +472,15 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("// sent messages"); _builder.newLine(); { - List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, (conj).booleanValue()); + List<Message> _allMessages = this._roomHelpers.getAllMessages(pc, conj); for(final Message m : _allMessages) { _builder.append("\t"); - CharSequence _sendMessage = this.sendMessage(m, (conj).booleanValue()); + CharSequence _sendMessage = this.sendMessage(m, conj); _builder.append(_sendMessage, "\t"); _builder.newLineIfNotEmpty(); } @@ -508,7 +506,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public int getReplication() {"); @@ -519,7 +516,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public int getIndexOf(InterfaceItemBase ifitem){"); @@ -527,10 +523,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t\t\t"); _builder.append("return ifitem.getIdx();"); _builder.newLine(); - _builder.append("\t\t"); + _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("public "); @@ -545,7 +540,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {"); @@ -558,10 +552,9 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); { - if ((conj).booleanValue()) { + if (conj) { _builder.append("\t"); _builder.append("// incoming messages"); _builder.newLine(); @@ -901,13 +894,11 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(_name_1, ""); _builder.append(" {"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); CharSequence _userCode_1 = this._procedureHelpers.userCode(pc, 2); _builder.append(_userCode_1, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("// send port holds data"); @@ -934,7 +925,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLineIfNotEmpty(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// constructor"); @@ -951,7 +941,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// getters and setters"); @@ -1013,7 +1002,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("// receive port accesses send port"); @@ -1030,7 +1018,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append(_portClassName_3, "\t\t"); _builder.append(" peer;"); _builder.newLineIfNotEmpty(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// constructor"); @@ -1047,7 +1034,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("// getters"); @@ -1092,7 +1078,6 @@ public class ProtocolClassGen extends GenericProtocolClassGenerator { _builder.newLine(); } } - _builder.append("\t\t"); _builder.newLine(); _builder.append("\t\t"); _builder.append("protected void connect(DataSendPort dataSendPort) {"); diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java index 28ca43689..b7118385d 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/StateMachineGen.java @@ -27,7 +27,10 @@ import org.eclipse.xtend2.lib.StringConcatenation; @Singleton @SuppressWarnings("all") public class StateMachineGen extends GenericStateMachineGenerator { - public CharSequence genExtra(final ExpandedModelComponent xpac) { + /** + * @param generateImplementation NOT used + */ + public CharSequence genExtra(final ExpandedModelComponent xpac, final boolean generateImplementation) { CharSequence _xblockexpression = null; { final ArrayList<State> states = new ArrayList<State>(); @@ -82,7 +85,6 @@ public class StateMachineGen extends GenericStateMachineGenerator { } _builder.append("};"); _builder.newLine(); - _builder.append("\t"); _builder.newLine(); } } @@ -124,7 +126,7 @@ public class StateMachineGen extends GenericStateMachineGenerator { _builder.append("+ stateStrings[this.state] + \" -> \" + stateStrings[new_state]);"); _builder.newLine(); _builder.append("\t"); - _builder.append("}\t"); + _builder.append("}"); _builder.newLine(); } } diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java index 1435447aa..6220d4813 100644 --- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java +++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorConfigTab.java @@ -4,22 +4,15 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.launch.cpp; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.etrice.generator.launch.GeneratorConfigTab; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; /** * @author Henrik Rentz-Reichert @@ -27,10 +20,6 @@ import org.eclipse.swt.widgets.Composite; */ public class CppGeneratorConfigTab extends GeneratorConfigTab { - public static final String ETUNIT = "etUnit"; - - private Button useEtUnit; - /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ @@ -39,29 +28,4 @@ public class CppGeneratorConfigTab extends GeneratorConfigTab { return "C++ Generator"; } - protected void addFurtherControls(Composite mainComposite) { - - useEtUnit = createCheckButton(mainComposite, "use etUnit"); - useEtUnit.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1)); - useEtUnit.addSelectionListener(new UpdateConfig()); - } - - @Override - public void initializeFrom(ILaunchConfiguration configuration) { - super.initializeFrom(configuration); - - try { - useEtUnit.setSelection(configuration.getAttribute(ETUNIT, false)); - } - catch (CoreException e) { - e.printStackTrace(); - } - } - - @Override - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - super.performApply(configuration); - - configuration.setAttribute(ETUNIT, useEtUnit.getSelection()); - } } diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java index 4b85ff46a..e39c69920 100644 --- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java +++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java @@ -4,14 +4,15 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.launch.cpp; +import org.eclipse.etrice.generator.cpp.Main; import org.eclipse.etrice.generator.fsm.base.ILineOutput; import org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate; @@ -26,9 +27,9 @@ public class CppGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConf */ @Override protected void runGenerator(String[] args, ILineOutput out) { - org.eclipse.etrice.generator.cpp.Main.setOutput(out); - org.eclipse.etrice.generator.cpp.Main.setTerminateOnError(false); - org.eclipse.etrice.generator.cpp.Main.main(args); + Main.setOutput(out); + Main.setTerminateOnError(false); + Main.main(args); } /* (non-Javadoc) diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java index 8648d8c60..c33255324 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DefaultTranslationProvider.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.base; @@ -31,23 +31,23 @@ import com.google.inject.Inject; /** * A default implementation of an {@link ITranslationProvider}. - * + * * @author Henrik Rentz-Reichert * */ public class DefaultTranslationProvider extends DefaultFSMTranslationProvider implements ITranslationProvider { - + /** * the name provider for model objects */ @Inject - RoomNameProvider roomNameProvider; - + protected RoomNameProvider roomNameProvider; + /** * utility methods */ @Inject - RoomHelpers roomHelpers; + protected RoomHelpers roomHelpers; /** * @return the original String @@ -93,11 +93,11 @@ public class DefaultTranslationProvider extends DefaultFSMTranslationProvider im if (tag.equals("MODEL_LOCATION")) { return roomNameProvider.getDetailCodeLocation(code); } - + logger.logInfo("unrecognized tag '"+tag+"' in " +roomNameProvider.getDetailCodeLocation(code)+" of " +roomNameProvider.getClassLocation(roomHelpers.getRoomClass(code))); - + return super.translateTag(tag, code); } /* (non-Javadoc) @@ -125,5 +125,5 @@ public class DefaultTranslationProvider extends DefaultFSMTranslationProvider im PortOperation op, ArrayList<String> args, String orig) { return orig; } - + }
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend index 2d3a461c8..de3f0b749 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.xtend @@ -4,15 +4,14 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.generic -import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType import org.eclipse.etrice.core.fsm.fSM.GuardedTransition import org.eclipse.etrice.core.fsm.fSM.NonInitialTransition import org.eclipse.etrice.core.fsm.fSM.State @@ -23,64 +22,64 @@ import org.eclipse.etrice.core.genmodel.fsm.fsmgen.ExpandedRefinedState import org.eclipse.etrice.generator.fsm.generic.AbstractStateMachineGenerator /** - * A target language independent generator of the state machine implementation- + * A target language independent generator of the state machine implementation */ class GenericStateMachineGenerator extends AbstractStateMachineGenerator { - + /** - * generates the code of the whole state machine - * + * generates the code of the whole state machine, consisting of constants + methods + * * @param xpmc the {@link ExpandedModelComponent} * @return the generated code - * - * @see #genStateMachine */ - def genStateMachine(ExpandedModelComponent xpmc) { - xpmc.genStateMachine(true) - } - + def genStateMachine(ExpandedModelComponent xpmc) ''' + «genStateMachineConstants(xpmc)» + + «genStateMachineMethods(xpmc, true)» + ''' + + /** + * generates the constants for the state machine + */ + def genStateMachineConstants(ExpandedModelComponent xpmc) ''' + /* state IDs */ + «xpmc.genStateIdConstants» + + /* transition chains */ + «xpmc.genTransitionChainConstants» + + /* triggers */ + «xpmc.genTriggerConstants» + ''' + /** - * generates the code of the whole state machine - * + * generates the methods for the state machine codes and state switching + * * @param xpmc the {@link ExpandedModelComponent} - * @param shallGenerateOneFile if <code>true</code> the generation of state IDs and - * other constants is skipped (and left for the header file) + * @param generateImplemenation or declaration only * @return the generated code */ - def genStateMachine(ExpandedModelComponent xpmc, boolean shallGenerateOneFile) { - - ''' - «IF shallGenerateOneFile» - /* state IDs */ - «xpmc.genStateIdConstants» - - /* transition chains */ - «xpmc.genTransitionChainConstants» - - /* triggers */ - «xpmc.genTriggerConstants» - «ENDIF» + def genStateMachineMethods(ExpandedModelComponent xpmc, boolean generateImplementation) ''' + «genExtra(xpmc, generateImplementation)» - «genExtra(xpmc)» - /* Entry and Exit Codes */ - «xpmc.genEntryAndExitCodes(true)» - + «xpmc.genEntryAndExitCodes(generateImplementation)» + /* Action Codes */ - «xpmc.genActionCodes(true)» - + «xpmc.genActionCodes(generateImplementation)» + /* State Switch Methods */ - «xpmc.genStateSwitchMethods(true)» - '''} + «xpmc.genStateSwitchMethods(generateImplementation)» + ''' /** * generate a transition guard if applicable - * + * * @param tt a {@link TriggeredTransition} * @param trigger a trigger string * @param xpmc an expanded actor class * @return the generated code - */ + */ override String guard(TriggeredTransition tt, String trigger, ExpandedModelComponent mc) { val tr = tt.triggers.findFirst(e|mc.isMatching(e, trigger)) ''' @@ -89,27 +88,24 @@ class GenericStateMachineGenerator extends AbstractStateMachineGenerator { «ENDIF» ''' } - + override String guard(GuardedTransition tt, String trigger, ExpandedModelComponent mc) { ''' «translator.getTranslatedCode(tt.guard)» ''' } - + override String genActionCodeMethod(ExpandedModelComponent xpmc, Transition tr, boolean generateImplementation) { var chain = xpmc.getChains(tr) var hasArgs = !chain.empty && chain.forall[it.transition instanceof NonInitialTransition && !(it.transition instanceof GuardedTransition)] val opScope = langExt.operationScope(xpmc.getClassName, false) - val opScopePriv = if (langExt.usesInheritance) - opScope - else - "" + val opScopePriv = if (langExt.usesInheritance) opScope else "" val ifItemPtr = "InterfaceItemBase"+langExt.pointerLiteral() val constIfItemPtr = if (langExt.usesPointers) "const "+ifItemPtr else ifItemPtr - + if (generateImplementation) { ''' «langExt.accessLevelProtected»void «opScopePriv»«tr.getActionCodeOperationName()»(«langExt.selfPointer(xpmc.className, hasArgs)»«IF hasArgs»«constIfItemPtr» ifitem«transitionChainGenerator.generateArgumentList(xpmc, tr)»«ENDIF») { @@ -126,7 +122,7 @@ class GenericStateMachineGenerator extends AbstractStateMachineGenerator { /** * generate action code method implementations or declarations - * + * * @param xpax the {@link ExpandedModelComponent} * @param state the {@link State} * @param generateImplementation if only declarations should be generated then <code>false</code> has to be passed @@ -198,88 +194,13 @@ class GenericStateMachineGenerator extends AbstractStateMachineGenerator { «ENDIF» ''' } - - // TODO: move the next two methods to the C++ generator - - /** - * @param classname the name of the type - * @return the type name for a constant pointer - */ - def constPointer(String classname) { - return classname - } - /** - * generate all method declarations - * - * @param xpax the {@link ExpandedModelComponent} - * @return the generated code - */ - def genStateMachineMethodDeclarations(ExpandedModelComponent xpmc) - { - val mc = xpmc.modelComponent - val async = mc.commType==ComponentCommunicationType::ASYNCHRONOUS - val eventDriven = mc.commType==ComponentCommunicationType::EVENT_DRIVEN - val handleEvents = async || eventDriven - val selfPtr = langExt.selfPointer(mc.className, true) - val usesHdlr = usesHandlerTrPoints(xpmc) - - ''' - - /* state IDs */ - «xpmc.genStateIdConstants» - - /* transition chains */ - «xpmc.genTransitionChainConstants» - - /* triggers */ - «xpmc.genTriggerConstants» - - «genExtraDecl(xpmc)» - - /* Entry and Exit Codes */ - «xpmc.genEntryAndExitCodes(false)» - - /* Action Codes */ - «xpmc.genActionCodes(false)» - - private: - /** - * calls exit codes while exiting from the current state to one of its - * parent states while remembering the history - * @param current - the current state - * @param to - the final parent state - «IF usesHdlr» - * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints) - «ENDIF» - */ - void exitTo(«selfPtr»int current, int to«IF usesHdlr», «boolType» handler«ENDIF»); - - /** - * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data - * matching the trigger of this chain. The ID of the final state is returned - * @param chain - the chain ID - * @param generic_data__et - the generic data pointer - * @return the ID of the final state - */ - int executeTransitionChain(«selfPtr»int chain«IF handleEvents», «constPointer("etRuntime::InterfaceItemBase")» ifitem, «langExt.voidPointer» generic_data__et«ENDIF»); - - /** - * calls entry codes while entering a state's history. The ID of the final leaf state is returned - * @param state - the state which is entered - «IF usesHdlr» - * @param handler - entry code is executed if not handler - «ENDIF» - * @return - the ID of the final leaf state - */ - int enterHistory(«selfPtr»int state«IF usesHdlr», «boolType» handler«ENDIF»); - - public: - - void executeInitTransition(«langExt.selfPointer(mc.className, false)»); - - /* receiveEvent contains the main implementation of the FSM */ - void receiveEvent(«langExt.selfPointer(mc.className, handleEvents)»«IF handleEvents»etRuntime::InterfaceItemBase* ifitem, int evt, «langExt.voidPointer» generic_data__et«ENDIF»); - ''' - } + /** + * let derived class add extra code after definition of constants + * + * @param xpmc an expanded actor class + * @param generateImplementation or declaration only + * @return the generated code + */ + def public genExtra(ExpandedModelComponent xpmc, boolean generateImplementation) {''''''} } diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend index 9c46af3b6..ed0b3a532 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend @@ -4,11 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) * Thomas Schuetz (refactoring, adapted for other target languages) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.generic @@ -16,16 +16,16 @@ package org.eclipse.etrice.generator.generic import com.google.inject.Inject import com.google.inject.Singleton import java.util.List -import org.eclipse.emf.common.util.EList import org.eclipse.etrice.core.fsm.fSM.DetailCode import org.eclipse.etrice.core.genmodel.fsm.base.ILogger +import org.eclipse.etrice.core.room.ActorClass import org.eclipse.etrice.core.room.ActorContainerClass import org.eclipse.etrice.core.room.Attribute import org.eclipse.etrice.core.room.DataClass import org.eclipse.etrice.core.room.Operation 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.RoomClass import org.eclipse.etrice.core.room.util.RoomHelpers import org.eclipse.etrice.generator.base.AbstractGenerator @@ -36,6 +36,8 @@ import org.eclipse.etrice.generator.base.AbstractGenerator @Singleton class ProcedureHelpers { + protected val NEWLINE = System.getProperty("line.separator") + @Inject protected extension RoomHelpers @Inject protected extension TypeHelpers @Inject protected ILanguageExtension languageExt @@ -86,7 +88,7 @@ class ProcedureHelpers { case 3: userCode(ac.userCode3) } } - + /** * @param dc some {@link DetailCode} * @return a string containing the expanded code surrounded by @@ -95,7 +97,7 @@ class ProcedureHelpers { def userCode(DetailCode dc) { userCode(getDetailCode(dc)) } - + def private userCode(String code) { ''' «IF code!=null && !code.empty» @@ -105,37 +107,29 @@ class ProcedureHelpers { «ENDIF» ''' } - + // Attributes - + /** * @param EnumTest a list of {@link Attribute}s * @return code declaring the attributes */ - def attributes(List<Attribute> EnumTest) { + def attributes(List<Attribute> attributes) { ''' /*--------------------- attributes ---------------------*/ - «FOR attribute : EnumTest» - «attributeDeclaration(attribute)» + «FOR it : attributes» + «attributeDeclaration» «ENDFOR» ''' } - + /** - * Attributes will be public. Should be protected, but not supported in C. - * * @param attribute an {@link Attribute} * @return the code declaring the attribute */ - def attributeDeclaration(Attribute attribute){ + def attributeDeclaration(Attribute attribute) ''' + «languageExt.accessLevelPublic» «attribute.declarationString»; ''' - «IF attribute.size==0» - «languageExt.accessLevelPublic» «attribute.type.type.typeName»«IF attribute.type.ref»«languageExt.pointerLiteral()»«ENDIF» «attribute.name»; - «ELSE» - «languageExt.accessLevelPublic» «languageExt.arrayDeclaration(attribute.type.type.typeName, attribute.size, attribute.name, attribute.type.ref)»; - «ENDIF» - ''' - } /** * @param attribute an {@link Attribute} @@ -147,7 +141,7 @@ class ProcedureHelpers { if (dflt.startsWith("{")) { if (dflt.split(",").size!=att.size) logger.logInfo("WARNING: array size determined by initializer differs from attribute size ("+att.name+"["+att.size+"] <-> "+dflt+")") - + return dflt } @@ -161,18 +155,18 @@ class ProcedureHelpers { } return result+"}" } - + // Attribute setters & getters - + /** * @param EnumTest a list of {@link Attribute}s * @param classname the name of the defining class * @return code declaring setters and getters for the attributes - */ - def attributeSettersGettersDeclaration(List<Attribute> EnumTest, String classname) { + */ + def attributeSettersGettersDeclaration(List<Attribute> attributes, String classname) { ''' /* --------------------- attribute setters and getters */ - «FOR attribute : EnumTest» + «FOR attribute : attributes» «setterHeader(attribute, classname)»; «getterHeader(attribute, classname)»; «ENDFOR» @@ -183,11 +177,11 @@ class ProcedureHelpers { * @param EnumTest a list of {@link Attribute}s * @param classname the name of the defining class * @return code defining setters and getters for the attributes - */ - def attributeSettersGettersImplementation(List<Attribute> EnumTest, String classname) { + */ + def attributeSettersGettersImplementation(List<Attribute> attributes, String classname) { ''' /* --------------------- attribute setters and getters */ - «FOR attribute : EnumTest»«setterHeader(attribute, classname)» { + «FOR attribute : attributes»«setterHeader(attribute, classname)» { «languageExt.memberAccess()»«attribute.name» = «attribute.name»; } «getterHeader(attribute, classname)» { @@ -196,44 +190,46 @@ class ProcedureHelpers { «ENDFOR» ''' } - + /** * @param attribute an {@link Attribute} * @param classname the name of the defining class * @return code for the attribute setter declaration - */ + */ def private setterHeader(Attribute attribute, String classname){ - '''«languageExt.accessLevelPublic()»void set«attribute.name.toFirstUpper()» («languageExt.selfPointer(classname, true)»«attribute.type.type.typeName»«IF attribute.size!=0»[]«ENDIF» «attribute.name»)''' + '''«languageExt.accessLevelPublic()»void set«attribute.name.toFirstUpper()»(«languageExt.selfPointer(classname, true)»«attribute.declarationString»)''' } - + /** * @param attribute an {@link Attribute} * @param classname the name of the defining class * @return code for the attribute getter declaration - */ + */ def private getterHeader(Attribute attribute, String classname){ - '''«languageExt.accessLevelPublic()»«attribute.type.type.typeName»«IF attribute.size!=0»[]«ENDIF» get«attribute.name.toFirstUpper()» («languageExt.selfPointer(classname, false)»)''' + '''«languageExt.accessLevelPublic()»«attribute.signatureReturnString» get«attribute.name.toFirstUpper()»(«languageExt.selfPointer(classname, false)»)''' } - + + + /** * @param attributes a list of {@link Attribute}s * @return an argument list for the attributes */ def argList(List<Attribute> attributes) { - '''«FOR a : attributes SEPARATOR ", "»«a.type.type.typeName»«IF a.size>0»[]«ENDIF» «a.name»«ENDFOR»''' + '''«FOR a : attributes SEPARATOR ", "»«a.declarationString»«ENDFOR»''' } - + /** * @param EnumTest an iterable of {@link Attribute}s representing a path * @param classname the name of the defining class * @return the invocation code for the call of a setter - */ + */ def invokeGetters(Iterable<Attribute> path, String classname){ '''«FOR a : path SEPARATOR '.'»«invokeGetter(a.name, classname)»«ENDFOR»''' } // generic setters & getters - + /** * @param typeName the type name of the attribute * @param name the name of the attribute @@ -247,7 +243,7 @@ class ProcedureHelpers { } ''' } - + /** * @param name the name of the attribute * @param classname the name of the type defining the getter @@ -256,7 +252,7 @@ class ProcedureHelpers { def invokeGetter(String name, String classname){ '''get«name.toFirstUpper»(«languageExt.selfPointer(classname, true)»)''' } - + /** * @param name the name of the attribute * @param classname the name of the type defining the getter @@ -266,9 +262,9 @@ class ProcedureHelpers { def invokeSetter(String name, String classname, String value){ '''set«name.toFirstUpper»(«languageExt.selfPointer(classname, true)»«value»)''' } - + // Operations - + /** * @param operations a list of {@link Operation}s * @param classname the name of the type defining the getter @@ -277,10 +273,10 @@ class ProcedureHelpers { def operationsDeclaration(List<? extends Operation> operations, String classname) ''' /*--------------------- operations ---------------------*/ «FOR operation : operations» - «operationSignature(operation, classname)»; + «operationSignature(operation, classname, true)»; «ENDFOR» ''' - + /** * @param operations a list of {@link Operation}s @@ -290,67 +286,142 @@ class ProcedureHelpers { def operationsImplementation(List<? extends Operation> operations, String classname) ''' /*--------------------- operations ---------------------*/ «FOR operation : operations» - «operationSignature(operation, classname)» { + «operationSignature(operation, classname, false)» { «AbstractGenerator::getInstance().getTranslatedCode(operation.detailCode)» } «ENDFOR» ''' - + def asBlock(CharSequence str)''' { «str» } ''' - - def getConstructorSignature(String classname){ - classOperationSignature(classname, languageExt.constructorName(classname), "", languageExt.constructorReturnType) + + /** + * invoke user structor, if (inherited) present - <b>C only</b> + * + * @param cls {@link ActorClass} or {@link DataClass} + * @param args self pointer to instance + */ + def invokeUserStructor(RoomClass cls, String args, boolean ctor) { + if (cls.getStructors(!languageExt.usesInheritance).exists[isConstructor == ctor]) + return '''«languageExt.memberInDeclaration(cls.name, if(ctor) 'ctor' else 'dtor')»(«args»);''' + + return '' } - - def getDestructorSignature(String classname){ - classOperationSignature(classname, languageExt.destructorName(classname), "", languageExt.destructorReturnType) + + + /** + * declaration of user constructor + destructor, if (inherited) present - <b>C only</b> + * + * @param cls {@link ActorClass} or {@link DataClass} + */ + def userStructorsDeclaration(RoomClass cls) { + val namePrefix = languageExt.operationScope(cls.name, true) + val declBlock = newArrayList + + declBlock += '/*--------------------- user constructor/destructor ---------------------*/' + if (cls.getStructors(!languageExt.usesInheritance).exists[constructor]) + declBlock += functionSignature(cls.name, namePrefix + 'ctor', 'void', '') + ';' + if (cls.getStructors(!languageExt.usesInheritance).exists[!constructor]) + declBlock += functionSignature(cls.name, namePrefix + 'dtor', 'void', '') + ';' + + declBlock.join(NEWLINE) + } + + /** + * implementation of user constructor + destructor, if (inherited) present - <b>C only</b> + * + * @param cls {@link ActorClass} or {@link DataClass} + */ + def userStructorsImplementation(RoomClass cls){ + val declBlock = newArrayList + + declBlock += '/*--------------------- user constructor/destructor ---------------------*/' + declBlock += cls.userStuctorImplementation(true) + declBlock += cls.userStuctorImplementation(false) + + declBlock.filterNull.join(NEWLINE) + } + + def private String userStuctorImplementation(RoomClass cls, boolean ctor) { + val namePrefix = languageExt.operationScope(cls.name, false) + if(!cls.getStructors(!languageExt.usesInheritance).exists[isConstructor == ctor]) + return null + + ''' + «functionSignature(cls.name, namePrefix + if(ctor) 'ctor' else 'dtor', 'void', '')»{ + «cls.userStructorBody(ctor)» + } + ''' } - + /** - * @param classname the name of a class - * @return code calling the destructor of the class + * implementation of user structor, if (inherited) present */ - def destructorCall(String classname) { - languageExt.destructorName(classname)+"()" + def userStructorBody(RoomClass cls, boolean ctor){ + val comment = '''// user defined «IF ctor»con«ELSE»de«ENDIF»structor body''' + + val implementedStructors = cls.getStructors(!languageExt.usesInheritance).filter[isConstructor == ctor] + val translatedCodes = implementedStructors.map[detailCode].map[ + AbstractGenerator::getInstance().getTranslatedCode(it)] + + return comment + NEWLINE + translatedCodes.map[if(translatedCodes.size > 1) asBlock else it].join + } + + def private getStructors(RoomClass cls, boolean inherited) { + switch it : cls { + ActorClass case !inherited: structors + DataClass case !inherited: structors + ActorClass case inherited: allStructors + DataClass case inherited: allStructors + } } - + /** * @param operation an {@link Operation} * @return the operation signature (with special care for * constructor and destructor */ - def private operationSignature(Operation operation, String classname) { - classOperationSignature(classname, operation.name, BuildArgumentList(operation.arguments).toString, dataTypeToString(operation.returnType)) + def private operationSignature(Operation operation, String classname, boolean isDeclaration) { + val arguments = '''«FOR argument : operation.arguments SEPARATOR ", "»«argument.refType.signatureString» «argument.name»«ENDFOR»''' + val returnType = operation.returnType.signatureString + functionSignature(classname, languageExt.operationScope(classname, isDeclaration)+operation.name, returnType, arguments) } /** * @param type a {@link RefableType} * @return a string for the type (also for pointers) */ - def private dataTypeToString(RefableType type) { - return if (type==null) - "void" - else - if (type.isRef){ - type.type.typeName+languageExt.pointerLiteral(); - }else{ - type.type.typeName - } + def private String signatureString(RefableType type) { + switch it : type { + case null: 'void' + case isRef: type.type.typeName + languageExt.pointerLiteral + default: type.type.typeName + } } - - /* - * builds comma separated argument list as string from EList<VarDecl> arguments + + def private String signatureReturnString(Attribute attribute){ + switch it : attribute { + case size > 0: type.signatureString + languageExt.typeArrayModifier + default: type.signatureString + } + } + + /** + * @param attribute a {@link Attribute} + * @return a string for <code>type name</code> */ - def private BuildArgumentList(EList<VarDecl> arguments){ - '''«FOR argument : arguments SEPARATOR ", "»«argument.refType.type.typeName»«IF argument.refType.ref»«languageExt.pointerLiteral()»«ENDIF» «argument.name»«ENDFOR»''' + def private String declarationString(Attribute attribute){ + switch it : attribute { + case size > 0: languageExt.arrayDeclaration(type.type.typeName, size, name, type.isRef) + default: type.signatureString + ' ' + name + } } - - def private classOperationSignature(String classname, String operationname, String argumentList, String returnType){ - '''«languageExt.accessLevelPublic()»«returnType» «languageExt.memberInDeclaration(classname, operationname)»(«languageExt.selfPointer(classname, !argumentList.empty)»«argumentList»)''' + + def private functionSignature(String className, String fullFctName, String returnType, String arguments){ + '''«languageExt.accessLevelPublic()» «returnType» «fullFctName»(«languageExt.selfPointer(className, !arguments.empty)»«arguments»)''' } - + } 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 c516cdda9..04dbb16a4 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 @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.generator.generic @@ -47,12 +47,14 @@ import org.eclipse.etrice.generator.fsm.generic.FSMExtensions @Singleton class RoomExtensions extends FSMExtensions { + public val NEWLINE = System.getProperty("line.separator") + private static String genDir = "/src-gen/" private static String genInfoDir = "/src-gen-info/" private static String genDocDir = "/doc-gen/" - + @Inject protected extension RoomHelpers - + def static setDefaultGenDir() { genDir = "/src-gen/" } @@ -71,10 +73,10 @@ class RoomExtensions extends FSMExtensions { def static setGenDocDir(String dir) { genDocDir = "/"+dir+"/" } - + //------------------------------------------------------- // union methods - + /** * a specialized version of {@link #union(Iterable, Iterable)} * @param in1 an iterable of type T @@ -87,17 +89,17 @@ class RoomExtensions extends FSMExtensions { ret.addAll(in1) return ret } - + //------------------------------------------------------- // path related methods - + /** * @return the relative path to the destination folder for the generated code */ def String getGenerationPathSegment() { genDir } - + /** * @return the relative path to the destination folder for the generated code */ @@ -130,7 +132,7 @@ class RoomExtensions extends FSMExtensions { //------------------------------------------------------- // packages and paths - + /** * @param rc a {@link RoomClass} * @return the name of the room model which also serves as a package name @@ -138,7 +140,7 @@ class RoomExtensions extends FSMExtensions { def String getPackage(RoomClass rc) { return (rc.eContainer as RoomModel).name } - + /** * @param rc a {@link RoomClass} * @return the name of the room model followed by the class name and all . replaced with _ @@ -146,7 +148,7 @@ class RoomExtensions extends FSMExtensions { def String getFullyQualifiedName(RoomClass rc) { rc.package.replace(".", "_")+"_"+rc.name } - + /** * @param packageName a dot (.) separated package anem * @return the input with dots replaced with slashes (/) @@ -154,7 +156,7 @@ class RoomExtensions extends FSMExtensions { def String getPathFromPackage(String packageName) { return packageName.replaceAll("\\.", "/") + "/" } - + /** * @param rc a {@link RoomClass} * @return the relative folder path of the package @@ -163,7 +165,7 @@ class RoomExtensions extends FSMExtensions { def String getPath(RoomClass rc) { getPathFromPackage(getPackage(rc)) } - + // a directory is a eclipse project if it contains a ".project" file /** * @param e an {@link EObject} @@ -177,7 +179,7 @@ class RoomExtensions extends FSMExtensions { return res.toFileString } - + /** * @param e an {@link EObject} * @return the concatenation of the object's project path @@ -186,7 +188,7 @@ class RoomExtensions extends FSMExtensions { def String getGenerationTargetPath(EObject e){ return getProjectPath(e)+getGenerationPathSegment() } - + /** * @param e an {@link EObject} * @return the concatenation of the object's project path @@ -204,7 +206,7 @@ class RoomExtensions extends FSMExtensions { def String getDocGenerationTargetPath(EObject e){ return getProjectPath(e)+getDocGenerationPathSegment() } - + /** * makes a valid identifier from a path string * @param path a slash (/) separated path @@ -216,7 +218,7 @@ class RoomExtensions extends FSMExtensions { //------------------------------------------------------- // protocol related methods - + /** * @param p a {@link Port} * @return a name for the associated port class @@ -235,7 +237,7 @@ class RoomExtensions extends FSMExtensions { def dispatch String getPortClassName(ExternalPort p){ return p.interfacePort.getPortClassName() } - + /** * @param sap a {@link SAP} * @return a name for the associated port class @@ -259,7 +261,7 @@ class RoomExtensions extends FSMExtensions { def dispatch String getPortClassName(ServiceImplementation svc) { return svc.spp.protocol.getPortClassName(false, true) } - + /** * @param p a {@link ProtocolClass} * @param conj if <code>true</code> consider conjugate port, else regular @@ -268,7 +270,7 @@ class RoomExtensions extends FSMExtensions { def String getPortClassName(ProtocolClass p, boolean conj) { getPortClassName(p, conj, false) } - + /** * @param p a {@link ProtocolClass} * @param conj if <code>true</code> consider conjugate port, else regular @@ -291,7 +293,7 @@ class RoomExtensions extends FSMExtensions { else return pc.regular } - + /** * @param pc a {@link ProtocolClass} * @param conj flag indicating the desired communication direction @@ -307,7 +309,7 @@ class RoomExtensions extends FSMExtensions { } return false; } - + /** * @param pc a {@link ProtocolClass} * @param conj flag indicating the desired communication direction @@ -343,7 +345,7 @@ class RoomExtensions extends FSMExtensions { return false } } - + /** * @param pc a {@link ProtocolClass} * @param conj flag indicating the desired communication direction @@ -379,7 +381,7 @@ class RoomExtensions extends FSMExtensions { return res } } - + /** * @param m a {@link Message} * @param conj flag indicating the desired communication direction @@ -388,7 +390,7 @@ class RoomExtensions extends FSMExtensions { def MessageHandler getSendHandler(Message m, boolean conj) { return (m.eContainer as ProtocolClass).getSendHandlers(conj).findFirst(e|e.msg==m) } - + /** * @param m a {@link Message} * @return <code>true</code> if this message is an incoming message @@ -396,7 +398,7 @@ class RoomExtensions extends FSMExtensions { def boolean isIncoming(Message m) { return (m.eContainer as ProtocolClass).allIncomingMessages.contains(m) } - + /* * @param m a {@link Message} * @return a string that can be used as identifier for the message. It is prefixed with IN_ or OUT_ @@ -418,7 +420,7 @@ class RoomExtensions extends FSMExtensions { ac.operations.exists(e|e.name=="stop" && e.arguments.isEmpty && e.returnType==null) || (ac.actorBase!=null && ac.actorBase.overridesStop()) } - + def getAllSubInstances(StructureInstance ssi) { val BasicEList<AbstractInstance> result = new BasicEList<AbstractInstance>(); val TreeIterator<EObject> it = ssi.eAllContents(); @@ -429,7 +431,7 @@ class RoomExtensions extends FSMExtensions { } return result; } - - - + + + } diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java index f3c1ac171..9cd08e5dc 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/GenericStateMachineGenerator.java @@ -10,9 +10,7 @@ */ package org.eclipse.etrice.generator.generic; -import com.google.common.base.Objects; 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.fsm.fSM.Guard; import org.eclipse.etrice.core.fsm.fSM.GuardedTransition; @@ -31,75 +29,81 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IterableExtensions; /** - * A target language independent generator of the state machine implementation- + * A target language independent generator of the state machine implementation */ @SuppressWarnings("all") public class GenericStateMachineGenerator extends AbstractStateMachineGenerator { /** - * generates the code of the whole state machine + * generates the code of the whole state machine, consisting of constants + methods * * @param xpmc the {@link ExpandedModelComponent} * @return the generated code - * - * @see #genStateMachine */ public CharSequence genStateMachine(final ExpandedModelComponent xpmc) { - return this.genStateMachine(xpmc, true); + StringConcatenation _builder = new StringConcatenation(); + CharSequence _genStateMachineConstants = this.genStateMachineConstants(xpmc); + _builder.append(_genStateMachineConstants, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + CharSequence _genStateMachineMethods = this.genStateMachineMethods(xpmc, true); + _builder.append(_genStateMachineMethods, ""); + _builder.newLineIfNotEmpty(); + return _builder; + } + + /** + * generates the constants for the state machine + */ + public CharSequence genStateMachineConstants(final ExpandedModelComponent xpmc) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("/* state IDs */"); + _builder.newLine(); + String _genStateIdConstants = this.genStateIdConstants(xpmc); + _builder.append(_genStateIdConstants, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("/* transition chains */"); + _builder.newLine(); + String _genTransitionChainConstants = this.genTransitionChainConstants(xpmc); + _builder.append(_genTransitionChainConstants, ""); + _builder.newLineIfNotEmpty(); + _builder.newLine(); + _builder.append("/* triggers */"); + _builder.newLine(); + String _genTriggerConstants = this.genTriggerConstants(xpmc); + _builder.append(_genTriggerConstants, ""); + _builder.newLineIfNotEmpty(); + return _builder; } /** - * generates the code of the whole state machine + * generates the methods for the state machine codes and state switching * * @param xpmc the {@link ExpandedModelComponent} - * @param shallGenerateOneFile if <code>true</code> the generation of state IDs and - * other constants is skipped (and left for the header file) + * @param generateImplemenation or declaration only * @return the generated code */ - public CharSequence genStateMachine(final ExpandedModelComponent xpmc, final boolean shallGenerateOneFile) { + public CharSequence genStateMachineMethods(final ExpandedModelComponent xpmc, final boolean generateImplementation) { StringConcatenation _builder = new StringConcatenation(); - { - if (shallGenerateOneFile) { - _builder.append("/* state IDs */"); - _builder.newLine(); - String _genStateIdConstants = this.genStateIdConstants(xpmc); - _builder.append(_genStateIdConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* transition chains */"); - _builder.newLine(); - String _genTransitionChainConstants = this.genTransitionChainConstants(xpmc); - _builder.append(_genTransitionChainConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* triggers */"); - _builder.newLine(); - String _genTriggerConstants = this.genTriggerConstants(xpmc); - _builder.append(_genTriggerConstants, ""); - _builder.newLineIfNotEmpty(); - } - } - _builder.newLine(); - CharSequence _genExtra = this.genExtra(xpmc); + CharSequence _genExtra = this.genExtra(xpmc, generateImplementation); _builder.append(_genExtra, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("/* Entry and Exit Codes */"); _builder.newLine(); - _builder.append(" "); - String _genEntryAndExitCodes = this.genEntryAndExitCodes(xpmc, true); - _builder.append(_genEntryAndExitCodes, " "); + String _genEntryAndExitCodes = this.genEntryAndExitCodes(xpmc, generateImplementation); + _builder.append(_genEntryAndExitCodes, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("/* Action Codes */"); _builder.newLine(); - _builder.append(" "); - String _genActionCodes = this.genActionCodes(xpmc, true); - _builder.append(_genActionCodes, " "); + String _genActionCodes = this.genActionCodes(xpmc, generateImplementation); + _builder.append(_genActionCodes, ""); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("/* State Switch Methods */"); _builder.newLine(); - String _genStateSwitchMethods = this.genStateSwitchMethods(xpmc, true); + String _genStateSwitchMethods = this.genStateSwitchMethods(xpmc, generateImplementation); _builder.append(_genStateSwitchMethods, ""); _builder.newLineIfNotEmpty(); return _builder; @@ -433,227 +437,14 @@ public class GenericStateMachineGenerator extends AbstractStateMachineGenerator } /** - * @param classname the name of the type - * @return the type name for a constant pointer - */ - public String constPointer(final String classname) { - return classname; - } - - /** - * generate all method declarations + * let derived class add extra code after definition of constants * - * @param xpax the {@link ExpandedModelComponent} + * @param xpmc an expanded actor class + * @param generateImplementation or declaration only * @return the generated code */ - public CharSequence genStateMachineMethodDeclarations(final ExpandedModelComponent xpmc) { - CharSequence _xblockexpression = null; - { - final ModelComponent mc = xpmc.getModelComponent(); - ComponentCommunicationType _commType = mc.getCommType(); - final boolean async = Objects.equal(_commType, ComponentCommunicationType.ASYNCHRONOUS); - ComponentCommunicationType _commType_1 = mc.getCommType(); - final boolean eventDriven = Objects.equal(_commType_1, ComponentCommunicationType.EVENT_DRIVEN); - boolean _or = false; - if (async) { - _or = true; - } else { - _or = eventDriven; - } - final boolean handleEvents = _or; - String _className = this.getClassName(mc); - final String selfPtr = this.langExt.selfPointer(_className, true); - final boolean usesHdlr = this.usesHandlerTrPoints(xpmc); - StringConcatenation _builder = new StringConcatenation(); - _builder.newLine(); - _builder.append("/* state IDs */"); - _builder.newLine(); - String _genStateIdConstants = this.genStateIdConstants(xpmc); - _builder.append(_genStateIdConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* transition chains */"); - _builder.newLine(); - String _genTransitionChainConstants = this.genTransitionChainConstants(xpmc); - _builder.append(_genTransitionChainConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* triggers */"); - _builder.newLine(); - String _genTriggerConstants = this.genTriggerConstants(xpmc); - _builder.append(_genTriggerConstants, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - CharSequence _genExtraDecl = this.genExtraDecl(xpmc); - _builder.append(_genExtraDecl, ""); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* Entry and Exit Codes */"); - _builder.newLine(); - _builder.append(" "); - String _genEntryAndExitCodes = this.genEntryAndExitCodes(xpmc, false); - _builder.append(_genEntryAndExitCodes, " "); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("/* Action Codes */"); - _builder.newLine(); - _builder.append(" "); - String _genActionCodes = this.genActionCodes(xpmc, false); - _builder.append(_genActionCodes, " "); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("private:"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* calls exit codes while exiting from the current state to one of its"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* parent states while remembering the history"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @param current - the current state"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @param to - the final parent state"); - _builder.newLine(); - { - if (usesHdlr) { - _builder.append("\t "); - _builder.append("* @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints)"); - _builder.newLine(); - } - } - _builder.append("\t "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("void exitTo("); - _builder.append(selfPtr, "\t"); - _builder.append("int current, int to"); - { - if (usesHdlr) { - _builder.append(", "); - String _boolType = this.boolType(); - _builder.append(_boolType, "\t"); - _builder.append(" handler"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* calls action, entry and exit codes along a transition chain. The generic data are cast to typed data"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* matching the trigger of this chain. The ID of the final state is returned"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @param chain - the chain ID"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @param generic_data__et - the generic data pointer"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @return the ID of the final state"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("int executeTransitionChain("); - _builder.append(selfPtr, "\t"); - _builder.append("int chain"); - { - if (handleEvents) { - _builder.append(", "); - String _constPointer = this.constPointer("etRuntime::InterfaceItemBase"); - _builder.append(_constPointer, "\t"); - _builder.append(" ifitem, "); - String _voidPointer = this.langExt.voidPointer(); - _builder.append(_voidPointer, "\t"); - _builder.append(" generic_data__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/**"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* calls entry codes while entering a state\'s history. The ID of the final leaf state is returned"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("* @param state - the state which is entered"); - _builder.newLine(); - { - if (usesHdlr) { - _builder.append("\t "); - _builder.append("* @param handler - entry code is executed if not handler"); - _builder.newLine(); - } - } - _builder.append("\t "); - _builder.append("* @return - the ID of the final leaf state"); - _builder.newLine(); - _builder.append("\t "); - _builder.append("*/"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("int enterHistory("); - _builder.append(selfPtr, "\t"); - _builder.append("int state"); - { - if (usesHdlr) { - _builder.append(", "); - String _boolType_1 = this.boolType(); - _builder.append(_boolType_1, "\t"); - _builder.append(" handler"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("public:"); - _builder.newLine(); - _builder.newLine(); - _builder.append("\t"); - _builder.append("void executeInitTransition("); - String _className_1 = this.getClassName(mc); - String _selfPointer = this.langExt.selfPointer(_className_1, false); - _builder.append(_selfPointer, "\t"); - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _builder.append("\t"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("/* receiveEvent contains the main implementation of the FSM */"); - _builder.newLine(); - _builder.append("\t"); - _builder.append("void receiveEvent("); - String _className_2 = this.getClassName(mc); - String _selfPointer_1 = this.langExt.selfPointer(_className_2, handleEvents); - _builder.append(_selfPointer_1, "\t"); - { - if (handleEvents) { - _builder.append("etRuntime::InterfaceItemBase* ifitem, int evt, "); - String _voidPointer_1 = this.langExt.voidPointer(); - _builder.append(_voidPointer_1, "\t"); - _builder.append(" generic_data__et"); - } - } - _builder.append(");"); - _builder.newLineIfNotEmpty(); - _xblockexpression = _builder; - } - return _xblockexpression; + public CharSequence genExtra(final ExpandedModelComponent xpmc, final boolean generateImplementation) { + StringConcatenation _builder = new StringConcatenation(); + return _builder; } } diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java index 037c3f1fe..b9d1e4c0e 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java @@ -14,25 +14,32 @@ package org.eclipse.etrice.generator.generic; import com.google.common.base.Objects; import com.google.inject.Inject; import com.google.inject.Singleton; +import java.util.ArrayList; import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.etrice.core.fsm.fSM.DetailCode; import org.eclipse.etrice.core.genmodel.fsm.base.ILogger; +import org.eclipse.etrice.core.room.ActorClass; import org.eclipse.etrice.core.room.ActorContainerClass; import org.eclipse.etrice.core.room.Attribute; +import org.eclipse.etrice.core.room.ClassStructor; import org.eclipse.etrice.core.room.DataClass; import org.eclipse.etrice.core.room.DataType; import org.eclipse.etrice.core.room.Operation; import org.eclipse.etrice.core.room.ProtocolClass; import org.eclipse.etrice.core.room.RefableType; +import org.eclipse.etrice.core.room.RoomClass; import org.eclipse.etrice.core.room.VarDecl; import org.eclipse.etrice.core.room.util.RoomHelpers; import org.eclipse.etrice.generator.base.AbstractGenerator; import org.eclipse.etrice.generator.generic.ILanguageExtension; import org.eclipse.etrice.generator.generic.TypeHelpers; import org.eclipse.xtend2.lib.StringConcatenation; +import org.eclipse.xtext.xbase.lib.CollectionLiterals; import org.eclipse.xtext.xbase.lib.Conversions; import org.eclipse.xtext.xbase.lib.Extension; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.StringExtensions; /** @@ -42,6 +49,8 @@ import org.eclipse.xtext.xbase.lib.StringExtensions; @Singleton @SuppressWarnings("all") public class ProcedureHelpers { + protected final String NEWLINE = System.getProperty("line.separator"); + @Inject @Extension protected RoomHelpers _roomHelpers; @@ -187,13 +196,13 @@ public class ProcedureHelpers { * @param EnumTest a list of {@link Attribute}s * @return code declaring the attributes */ - public CharSequence attributes(final List<Attribute> EnumTest) { + public CharSequence attributes(final List<Attribute> attributes) { StringConcatenation _builder = new StringConcatenation(); _builder.append("/*--------------------- attributes ---------------------*/"); _builder.newLine(); { - for(final Attribute attribute : EnumTest) { - CharSequence _attributeDeclaration = this.attributeDeclaration(attribute); + for(final Attribute it : attributes) { + CharSequence _attributeDeclaration = this.attributeDeclaration(it); _builder.append(_attributeDeclaration, ""); _builder.newLineIfNotEmpty(); } @@ -202,54 +211,18 @@ public class ProcedureHelpers { } /** - * Attributes will be public. Should be protected, but not supported in C. - * * @param attribute an {@link Attribute} * @return the code declaring the attribute */ public CharSequence attributeDeclaration(final Attribute attribute) { StringConcatenation _builder = new StringConcatenation(); - { - int _size = attribute.getSize(); - boolean _equals = (_size == 0); - if (_equals) { - String _accessLevelPublic = this.languageExt.accessLevelPublic(); - _builder.append(_accessLevelPublic, ""); - _builder.append(" "); - RefableType _type = attribute.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - RefableType _type_2 = attribute.getType(); - boolean _isRef = _type_2.isRef(); - if (_isRef) { - String _pointerLiteral = this.languageExt.pointerLiteral(); - _builder.append(_pointerLiteral, ""); - } - } - _builder.append(" "); - String _name = attribute.getName(); - _builder.append(_name, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } else { - String _accessLevelPublic_1 = this.languageExt.accessLevelPublic(); - _builder.append(_accessLevelPublic_1, ""); - _builder.append(" "); - RefableType _type_3 = attribute.getType(); - DataType _type_4 = _type_3.getType(); - String _typeName_1 = this._typeHelpers.typeName(_type_4); - int _size_1 = attribute.getSize(); - String _name_1 = attribute.getName(); - RefableType _type_5 = attribute.getType(); - boolean _isRef_1 = _type_5.isRef(); - String _arrayDeclaration = this.languageExt.arrayDeclaration(_typeName_1, _size_1, _name_1, _isRef_1); - _builder.append(_arrayDeclaration, ""); - _builder.append(";"); - _builder.newLineIfNotEmpty(); - } - } + String _accessLevelPublic = this.languageExt.accessLevelPublic(); + _builder.append(_accessLevelPublic, ""); + _builder.append(" "); + String _declarationString = this.declarationString(attribute); + _builder.append(_declarationString, ""); + _builder.append(";"); + _builder.newLineIfNotEmpty(); return _builder; } @@ -309,12 +282,12 @@ public class ProcedureHelpers { * @param classname the name of the defining class * @return code declaring setters and getters for the attributes */ - public CharSequence attributeSettersGettersDeclaration(final List<Attribute> EnumTest, final String classname) { + public CharSequence attributeSettersGettersDeclaration(final List<Attribute> attributes, final String classname) { StringConcatenation _builder = new StringConcatenation(); _builder.append("/* --------------------- attribute setters and getters */"); _builder.newLine(); { - for(final Attribute attribute : EnumTest) { + for(final Attribute attribute : attributes) { CharSequence _setterHeader = this.setterHeader(attribute, classname); _builder.append(_setterHeader, ""); _builder.append(";"); @@ -333,12 +306,12 @@ public class ProcedureHelpers { * @param classname the name of the defining class * @return code defining setters and getters for the attributes */ - public CharSequence attributeSettersGettersImplementation(final List<Attribute> EnumTest, final String classname) { + public CharSequence attributeSettersGettersImplementation(final List<Attribute> attributes, final String classname) { StringConcatenation _builder = new StringConcatenation(); _builder.append("/* --------------------- attribute setters and getters */"); _builder.newLine(); { - for(final Attribute attribute : EnumTest) { + for(final Attribute attribute : attributes) { CharSequence _setterHeader = this.setterHeader(attribute, classname); _builder.append(_setterHeader, ""); _builder.append(" {"); @@ -387,23 +360,11 @@ public class ProcedureHelpers { String _name = attribute.getName(); String _firstUpper = StringExtensions.toFirstUpper(_name); _builder.append(_firstUpper, ""); - _builder.append(" ("); + _builder.append("("); String _selfPointer = this.languageExt.selfPointer(classname, true); _builder.append(_selfPointer, ""); - RefableType _type = attribute.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - int _size = attribute.getSize(); - boolean _notEquals = (_size != 0); - if (_notEquals) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name_1 = attribute.getName(); - _builder.append(_name_1, ""); + String _declarationString = this.declarationString(attribute); + _builder.append(_declarationString, ""); _builder.append(")"); return _builder; } @@ -417,22 +378,13 @@ public class ProcedureHelpers { StringConcatenation _builder = new StringConcatenation(); String _accessLevelPublic = this.languageExt.accessLevelPublic(); _builder.append(_accessLevelPublic, ""); - RefableType _type = attribute.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - int _size = attribute.getSize(); - boolean _notEquals = (_size != 0); - if (_notEquals) { - _builder.append("[]"); - } - } + String _signatureReturnString = this.signatureReturnString(attribute); + _builder.append(_signatureReturnString, ""); _builder.append(" get"); String _name = attribute.getName(); String _firstUpper = StringExtensions.toFirstUpper(_name); _builder.append(_firstUpper, ""); - _builder.append(" ("); + _builder.append("("); String _selfPointer = this.languageExt.selfPointer(classname, false); _builder.append(_selfPointer, ""); _builder.append(")"); @@ -453,20 +405,8 @@ public class ProcedureHelpers { } else { _builder.appendImmediate(", ", ""); } - RefableType _type = a.getType(); - DataType _type_1 = _type.getType(); - String _typeName = this._typeHelpers.typeName(_type_1); - _builder.append(_typeName, ""); - { - int _size = a.getSize(); - boolean _greaterThan = (_size > 0); - if (_greaterThan) { - _builder.append("[]"); - } - } - _builder.append(" "); - String _name = a.getName(); - _builder.append(_name, ""); + String _declarationString = this.declarationString(a); + _builder.append(_declarationString, ""); } } return _builder; @@ -573,7 +513,7 @@ public class ProcedureHelpers { _builder.newLine(); { for(final Operation operation : operations) { - CharSequence _operationSignature = this.operationSignature(operation, classname); + CharSequence _operationSignature = this.operationSignature(operation, classname, true); _builder.append(_operationSignature, ""); _builder.append(";"); _builder.newLineIfNotEmpty(); @@ -593,7 +533,7 @@ public class ProcedureHelpers { _builder.newLine(); { for(final Operation operation : operations) { - CharSequence _operationSignature = this.operationSignature(operation, classname); + CharSequence _operationSignature = this.operationSignature(operation, classname, false); _builder.append(_operationSignature, ""); _builder.append(" {"); _builder.newLineIfNotEmpty(); @@ -622,25 +562,246 @@ public class ProcedureHelpers { return _builder; } - public CharSequence getConstructorSignature(final String classname) { - String _constructorName = this.languageExt.constructorName(classname); - String _constructorReturnType = this.languageExt.constructorReturnType(); - return this.classOperationSignature(classname, _constructorName, "", _constructorReturnType); + /** + * invoke user structor, if (inherited) present - <b>C only</b> + * + * @param cls {@link ActorClass} or {@link DataClass} + * @param args self pointer to instance + */ + public String invokeUserStructor(final RoomClass cls, final String args, final boolean ctor) { + boolean _usesInheritance = this.languageExt.usesInheritance(); + boolean _not = (!_usesInheritance); + List<ClassStructor> _structors = this.getStructors(cls, _not); + final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + public Boolean apply(final ClassStructor it) { + boolean _isConstructor = it.isConstructor(); + return Boolean.valueOf((_isConstructor == ctor)); + } + }; + boolean _exists = IterableExtensions.<ClassStructor>exists(_structors, _function); + if (_exists) { + StringConcatenation _builder = new StringConcatenation(); + String _name = cls.getName(); + String _xifexpression = null; + if (ctor) { + _xifexpression = "ctor"; + } else { + _xifexpression = "dtor"; + } + String _memberInDeclaration = this.languageExt.memberInDeclaration(_name, _xifexpression); + _builder.append(_memberInDeclaration, ""); + _builder.append("("); + _builder.append(args, ""); + _builder.append(");"); + return _builder.toString(); + } + return ""; } - public CharSequence getDestructorSignature(final String classname) { - String _destructorName = this.languageExt.destructorName(classname); - String _destructorReturnType = this.languageExt.destructorReturnType(); - return this.classOperationSignature(classname, _destructorName, "", _destructorReturnType); + /** + * declaration of user constructor + destructor, if (inherited) present - <b>C only</b> + * + * @param cls {@link ActorClass} or {@link DataClass} + */ + public String userStructorsDeclaration(final RoomClass cls) { + String _xblockexpression = null; + { + String _name = cls.getName(); + final String namePrefix = this.languageExt.operationScope(_name, true); + final ArrayList<String> declBlock = CollectionLiterals.<String>newArrayList(); + declBlock.add("/*--------------------- user constructor/destructor ---------------------*/"); + boolean _usesInheritance = this.languageExt.usesInheritance(); + boolean _not = (!_usesInheritance); + List<ClassStructor> _structors = this.getStructors(cls, _not); + final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + public Boolean apply(final ClassStructor it) { + return Boolean.valueOf(it.isConstructor()); + } + }; + boolean _exists = IterableExtensions.<ClassStructor>exists(_structors, _function); + if (_exists) { + String _name_1 = cls.getName(); + CharSequence _functionSignature = this.functionSignature(_name_1, (namePrefix + "ctor"), "void", ""); + String _plus = (_functionSignature + ";"); + declBlock.add(_plus); + } + boolean _usesInheritance_1 = this.languageExt.usesInheritance(); + boolean _not_1 = (!_usesInheritance_1); + List<ClassStructor> _structors_1 = this.getStructors(cls, _not_1); + final Function1<ClassStructor, Boolean> _function_1 = new Function1<ClassStructor, Boolean>() { + public Boolean apply(final ClassStructor it) { + boolean _isConstructor = it.isConstructor(); + return Boolean.valueOf((!_isConstructor)); + } + }; + boolean _exists_1 = IterableExtensions.<ClassStructor>exists(_structors_1, _function_1); + if (_exists_1) { + String _name_2 = cls.getName(); + CharSequence _functionSignature_1 = this.functionSignature(_name_2, (namePrefix + "dtor"), "void", ""); + String _plus_1 = (_functionSignature_1 + ";"); + declBlock.add(_plus_1); + } + _xblockexpression = IterableExtensions.join(declBlock, this.NEWLINE); + } + return _xblockexpression; + } + + /** + * implementation of user constructor + destructor, if (inherited) present - <b>C only</b> + * + * @param cls {@link ActorClass} or {@link DataClass} + */ + public String userStructorsImplementation(final RoomClass cls) { + String _xblockexpression = null; + { + final ArrayList<String> declBlock = CollectionLiterals.<String>newArrayList(); + declBlock.add("/*--------------------- user constructor/destructor ---------------------*/"); + String _userStuctorImplementation = this.userStuctorImplementation(cls, true); + declBlock.add(_userStuctorImplementation); + String _userStuctorImplementation_1 = this.userStuctorImplementation(cls, false); + declBlock.add(_userStuctorImplementation_1); + Iterable<String> _filterNull = IterableExtensions.<String>filterNull(declBlock); + _xblockexpression = IterableExtensions.join(_filterNull, this.NEWLINE); + } + return _xblockexpression; + } + + private String userStuctorImplementation(final RoomClass cls, final boolean ctor) { + String _xblockexpression = null; + { + String _name = cls.getName(); + final String namePrefix = this.languageExt.operationScope(_name, false); + boolean _usesInheritance = this.languageExt.usesInheritance(); + boolean _not = (!_usesInheritance); + List<ClassStructor> _structors = this.getStructors(cls, _not); + final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + public Boolean apply(final ClassStructor it) { + boolean _isConstructor = it.isConstructor(); + return Boolean.valueOf((_isConstructor == ctor)); + } + }; + boolean _exists = IterableExtensions.<ClassStructor>exists(_structors, _function); + boolean _not_1 = (!_exists); + if (_not_1) { + return null; + } + StringConcatenation _builder = new StringConcatenation(); + String _name_1 = cls.getName(); + String _xifexpression = null; + if (ctor) { + _xifexpression = "ctor"; + } else { + _xifexpression = "dtor"; + } + String _plus = (namePrefix + _xifexpression); + CharSequence _functionSignature = this.functionSignature(_name_1, _plus, "void", ""); + _builder.append(_functionSignature, ""); + _builder.append("{"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + String _userStructorBody = this.userStructorBody(cls, ctor); + _builder.append(_userStructorBody, "\t"); + _builder.newLineIfNotEmpty(); + _builder.append("}"); + _builder.newLine(); + _xblockexpression = _builder.toString(); + } + return _xblockexpression; } /** - * @param classname the name of a class - * @return code calling the destructor of the class + * implementation of user structor, if (inherited) present */ - public String destructorCall(final String classname) { - String _destructorName = this.languageExt.destructorName(classname); - return (_destructorName + "()"); + public String userStructorBody(final RoomClass cls, final boolean ctor) { + StringConcatenation _builder = new StringConcatenation(); + _builder.append("// user defined "); + { + if (ctor) { + _builder.append("con"); + } else { + _builder.append("de"); + } + } + _builder.append("structor body"); + final String comment = _builder.toString(); + boolean _usesInheritance = this.languageExt.usesInheritance(); + boolean _not = (!_usesInheritance); + List<ClassStructor> _structors = this.getStructors(cls, _not); + final Function1<ClassStructor, Boolean> _function = new Function1<ClassStructor, Boolean>() { + public Boolean apply(final ClassStructor it) { + boolean _isConstructor = it.isConstructor(); + return Boolean.valueOf((_isConstructor == ctor)); + } + }; + final Iterable<ClassStructor> implementedStructors = IterableExtensions.<ClassStructor>filter(_structors, _function); + final Function1<ClassStructor, DetailCode> _function_1 = new Function1<ClassStructor, DetailCode>() { + public DetailCode apply(final ClassStructor it) { + return it.getDetailCode(); + } + }; + Iterable<DetailCode> _map = IterableExtensions.<ClassStructor, DetailCode>map(implementedStructors, _function_1); + final Function1<DetailCode, String> _function_2 = new Function1<DetailCode, String>() { + public String apply(final DetailCode it) { + AbstractGenerator _instance = AbstractGenerator.getInstance(); + return _instance.getTranslatedCode(it); + } + }; + final Iterable<String> translatedCodes = IterableExtensions.<DetailCode, String>map(_map, _function_2); + final Function1<String, CharSequence> _function_3 = new Function1<String, CharSequence>() { + public CharSequence apply(final String it) { + CharSequence _xifexpression = null; + int _size = IterableExtensions.size(translatedCodes); + boolean _greaterThan = (_size > 1); + if (_greaterThan) { + _xifexpression = ProcedureHelpers.this.asBlock(it); + } else { + _xifexpression = it; + } + return _xifexpression; + } + }; + Iterable<CharSequence> _map_1 = IterableExtensions.<String, CharSequence>map(translatedCodes, _function_3); + String _join = IterableExtensions.join(_map_1); + return ((comment + this.NEWLINE) + _join); + } + + private List<ClassStructor> getStructors(final RoomClass cls, final boolean inherited) { + List<ClassStructor> _switchResult = null; + final RoomClass it = cls; + boolean _matched = false; + if (!_matched) { + if (it instanceof ActorClass) { + if ((!inherited)) { + _matched=true; + _switchResult = ((ActorClass)it).getStructors(); + } + } + } + if (!_matched) { + if (it instanceof DataClass) { + if ((!inherited)) { + _matched=true; + _switchResult = ((DataClass)it).getStructors(); + } + } + } + if (!_matched) { + if (it instanceof ActorClass) { + if (inherited) { + _matched=true; + _switchResult = this._roomHelpers.getAllStructors(((ActorClass)it)); + } + } + } + if (!_matched) { + if (it instanceof DataClass) { + if (inherited) { + _matched=true; + _switchResult = this._roomHelpers.getAllStructors(((DataClass)it)); + } + } + } + return _switchResult; } /** @@ -648,89 +809,138 @@ public class ProcedureHelpers { * @return the operation signature (with special care for * constructor and destructor */ - private CharSequence operationSignature(final Operation operation, final String classname) { - String _name = operation.getName(); - EList<VarDecl> _arguments = operation.getArguments(); - CharSequence _BuildArgumentList = this.BuildArgumentList(_arguments); - String _string = _BuildArgumentList.toString(); - RefableType _returnType = operation.getReturnType(); - String _dataTypeToString = this.dataTypeToString(_returnType); - return this.classOperationSignature(classname, _name, _string, _dataTypeToString); + private CharSequence operationSignature(final Operation operation, final String classname, final boolean isDeclaration) { + CharSequence _xblockexpression = null; + { + StringConcatenation _builder = new StringConcatenation(); + { + EList<VarDecl> _arguments = operation.getArguments(); + boolean _hasElements = false; + for(final VarDecl argument : _arguments) { + if (!_hasElements) { + _hasElements = true; + } else { + _builder.appendImmediate(", ", ""); + } + RefableType _refType = argument.getRefType(); + String _signatureString = this.signatureString(_refType); + _builder.append(_signatureString, ""); + _builder.append(" "); + String _name = argument.getName(); + _builder.append(_name, ""); + } + } + final String arguments = _builder.toString(); + RefableType _returnType = operation.getReturnType(); + final String returnType = this.signatureString(_returnType); + String _operationScope = this.languageExt.operationScope(classname, isDeclaration); + String _name_1 = operation.getName(); + String _plus = (_operationScope + _name_1); + _xblockexpression = this.functionSignature(classname, _plus, returnType, arguments); + } + return _xblockexpression; } /** * @param type a {@link RefableType} * @return a string for the type (also for pointers) */ - private String dataTypeToString(final RefableType type) { - String _xifexpression = null; - boolean _equals = Objects.equal(type, null); - if (_equals) { - _xifexpression = "void"; - } else { - String _xifexpression_1 = null; - boolean _isRef = type.isRef(); + private String signatureString(final RefableType type) { + String _switchResult = null; + final RefableType it = type; + boolean _matched = false; + if (!_matched) { + if (Objects.equal(it, null)) { + _matched=true; + _switchResult = "void"; + } + } + if (!_matched) { + boolean _isRef = it.isRef(); if (_isRef) { + _matched=true; DataType _type = type.getType(); String _typeName = this._typeHelpers.typeName(_type); String _pointerLiteral = this.languageExt.pointerLiteral(); - _xifexpression_1 = (_typeName + _pointerLiteral); - } else { - DataType _type_1 = type.getType(); - _xifexpression_1 = this._typeHelpers.typeName(_type_1); + _switchResult = (_typeName + _pointerLiteral); } - _xifexpression = _xifexpression_1; } - return _xifexpression; + if (!_matched) { + DataType _type_1 = type.getType(); + _switchResult = this._typeHelpers.typeName(_type_1); + } + return _switchResult; + } + + private String signatureReturnString(final Attribute attribute) { + String _switchResult = null; + final Attribute it = attribute; + boolean _matched = false; + if (!_matched) { + int _size = it.getSize(); + boolean _greaterThan = (_size > 0); + if (_greaterThan) { + _matched=true; + RefableType _type = it.getType(); + String _signatureString = this.signatureString(_type); + String _typeArrayModifier = this.languageExt.typeArrayModifier(); + _switchResult = (_signatureString + _typeArrayModifier); + } + } + if (!_matched) { + RefableType _type_1 = it.getType(); + _switchResult = this.signatureString(_type_1); + } + return _switchResult; } /** - * builds comma separated argument list as string from EList<VarDecl> arguments + * @param attribute a {@link Attribute} + * @return a string for <code>type name</code> */ - private CharSequence BuildArgumentList(final EList<VarDecl> arguments) { - StringConcatenation _builder = new StringConcatenation(); - { - boolean _hasElements = false; - for(final VarDecl argument : arguments) { - if (!_hasElements) { - _hasElements = true; - } else { - _builder.appendImmediate(", ", ""); - } - RefableType _refType = argument.getRefType(); - DataType _type = _refType.getType(); - String _typeName = this._typeHelpers.typeName(_type); - _builder.append(_typeName, ""); - { - RefableType _refType_1 = argument.getRefType(); - boolean _isRef = _refType_1.isRef(); - if (_isRef) { - String _pointerLiteral = this.languageExt.pointerLiteral(); - _builder.append(_pointerLiteral, ""); - } - } - _builder.append(" "); - String _name = argument.getName(); - _builder.append(_name, ""); + private String declarationString(final Attribute attribute) { + String _switchResult = null; + final Attribute it = attribute; + boolean _matched = false; + if (!_matched) { + int _size = it.getSize(); + boolean _greaterThan = (_size > 0); + if (_greaterThan) { + _matched=true; + RefableType _type = it.getType(); + DataType _type_1 = _type.getType(); + String _typeName = this._typeHelpers.typeName(_type_1); + int _size_1 = it.getSize(); + String _name = it.getName(); + RefableType _type_2 = it.getType(); + boolean _isRef = _type_2.isRef(); + _switchResult = this.languageExt.arrayDeclaration(_typeName, _size_1, _name, _isRef); } } - return _builder; + if (!_matched) { + RefableType _type_3 = it.getType(); + String _signatureString = this.signatureString(_type_3); + String _plus = (_signatureString + " "); + String _name_1 = it.getName(); + _switchResult = (_plus + _name_1); + } + return _switchResult; } - private CharSequence classOperationSignature(final String classname, final String operationname, final String argumentList, final String returnType) { + private CharSequence functionSignature(final String className, final String fullFctName, final String returnType, final String arguments) { StringConcatenation _builder = new StringConcatenation(); String _accessLevelPublic = this.languageExt.accessLevelPublic(); _builder.append(_accessLevelPublic, ""); + _builder.append(" "); _builder.append(returnType, ""); _builder.append(" "); - String _memberInDeclaration = this.languageExt.memberInDeclaration(classname, operationname); - _builder.append(_memberInDeclaration, ""); + _builder.append(fullFctName, ""); _builder.append("("); - boolean _isEmpty = argumentList.isEmpty(); + boolean _isEmpty = arguments.isEmpty(); boolean _not = (!_isEmpty); - String _selfPointer = this.languageExt.selfPointer(classname, _not); + String _selfPointer = this.languageExt.selfPointer(className, _not); _builder.append(_selfPointer, ""); - _builder.append(argumentList, ""); + _builder.append(arguments, ""); _builder.append(")"); return _builder; } 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 7a1f8f24c..775639e84 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 @@ -59,6 +59,8 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; @Singleton @SuppressWarnings("all") public class RoomExtensions extends FSMExtensions { + public final String NEWLINE = System.getProperty("line.separator"); + private static String genDir = "/src-gen/"; private static String genInfoDir = "/src-gen-info/"; diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip Binary files differindex 8cea2fd71..38c0ddfa8 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip Binary files differindex 1647fe5cb..087fec19b 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip Binary files differnew file mode 100644 index 000000000..d8a388aeb --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip Binary files differindex 12bf48c1c..4ce4962b6 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip Binary files differindex a68a0a76f..89fb3f88e 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip Binary files differnew file mode 100644 index 000000000..ee93342fe --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip Binary files differindex c91da2f24..432fa8117 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip Binary files differindex 6e57f190f..30dfb966a 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip Binary files differnew file mode 100644 index 000000000..9893a874c --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip Binary files differindex 0586d60a9..f298bdb23 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip Binary files differnew file mode 100644 index 000000000..65a55a9e8 --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.cpp.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml b/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml index 5344d58c1..2ef2e5f96 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml +++ b/plugins/org.eclipse.etrice.ui.runtime/create_contents.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- ====================================================================== - This ant script creates a zip file for each of eTrice's runtime projects. - If the projects would not be zipped the resulting file namens would be too long to be +<!-- ====================================================================== + This ant script creates a zip file for each of eTrice's runtime projects. + If the projects would not be zipped the resulting file namens would be too long to be handled my MS Windows. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=301858 - - Henrik Rentz-Reichert (original by Moritz Eysholdt) + + Henrik Rentz-Reichert (original by Moritz Eysholdt) ====================================================================== --> <project name="project" default="zip_all_projects"> @@ -26,12 +26,17 @@ <zip_project source="../../examples" name="org.eclipse.etrice.tutorials.c" /> <zip_project source="../../examples" name="org.eclipse.etrice.examples.c" /> <zip_project source="../../examples" name="org.eclipse.etrice.template.c" /> - + <zip_project source="../../runtime" name="org.eclipse.etrice.runtime.java" /> <zip_project source="../../runtime" name="org.eclipse.etrice.modellib.java" /> <zip_project source="../../examples" name="org.eclipse.etrice.tutorials.java" /> <zip_project source="../../examples" name="org.eclipse.etrice.examples.java" /> - + + <zip_project source="../../runtime" name="org.eclipse.etrice.runtime.cpp" /> + <zip_project source="../../runtime" name="org.eclipse.etrice.modellib.cpp" /> + <zip_project source="../../examples" name="org.eclipse.etrice.tutorials.cpp" /> + <zip_project source="../../examples" name="org.eclipse.etrice.template.cpp" /> + <echo message="done zipping wizard contents" /> </target> diff --git a/plugins/org.eclipse.etrice.ui.runtime/plugin.xml b/plugins/org.eclipse.etrice.ui.runtime/plugin.xml index d1d27260f..9efa56b35 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/plugin.xml +++ b/plugins/org.eclipse.etrice.ui.runtime/plugin.xml @@ -12,6 +12,11 @@ parentCategory="org.eclipse.etrice.core.ui.wizardCategory"> </category> <category + id="org.eclipse.etrice.core.ui.wizardCppCategory" + name="C++" + parentCategory="org.eclipse.etrice.core.ui.wizardCategory"> + </category> + <category id="org.eclipse.etrice.core.ui.wizardJavaCategory" name="Java" parentCategory="org.eclipse.etrice.core.ui.wizardCategory"> @@ -22,6 +27,11 @@ parentCategory="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCCategory"> </category> <category + id="org.eclipse.etrice.core.ui.libraryCppCategory" + name="Libraries" + parentCategory="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCppCategory"> + </category> + <category id="org.eclipse.etrice.core.ui.libraryJavaCategory" name="Libraries" parentCategory="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardJavaCategory"> @@ -30,11 +40,11 @@ <!-- ========= org.eclipse.etrice.runtime.c ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewCRuntimeWizard" - name="eTrice C Runtime" - class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" + <wizard id="org.eclipse.etrice.ui.runtime.NewCRuntimeWizard" + name="eTrice C Runtime" + class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCCategory/org.eclipse.etrice.core.ui.libraryCCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>The C Runtime required by eTrice C projects</description> </wizard> @@ -46,15 +56,15 @@ contentURI="contents/org.eclipse.etrice.runtime.c.zip" description="eTrice Runtime for C"/> </example> - </extension> + </extension> <!-- ========= org.eclipse.etrice.modellib.c ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewCModelLibWizard" - name="eTrice C ModelLib" - class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + <wizard id="org.eclipse.etrice.ui.runtime.NewCModelLibWizard" + name="eTrice C ModelLib" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCCategory/org.eclipse.etrice.core.ui.libraryCCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>A ROOM Model Library for C with useful services</description> </wizard> @@ -68,18 +78,69 @@ <projectDescriptor contentURI="contents/org.eclipse.etrice.runtime.c.zip" description="eTrice Runtime for C" - name="org.eclipse.etrice.runtime.c"> - </projectDescriptor> + name="org.eclipse.etrice.runtime.c"/> </example> - </extension> + </extension> + + <!-- ========= org.eclipse.etrice.runtime.cpp ========= --> + <extension point="org.eclipse.ui.newWizards"> + <wizard id="org.eclipse.etrice.ui.runtime.NewCppRuntimeWizard" + name="eTrice C++ Runtime" + class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" + category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCppCategory/org.eclipse.etrice.core.ui.libraryCppCategory" + icon="icons/genproject.gif" + project="true"> + <description>The C Runtime required by eTrice C++ projects</description> + </wizard> + </extension> + <extension point="org.eclipse.emf.common.ui.examples"> + <example wizardID="org.eclipse.etrice.ui.runtime.NewCppRuntimeWizard" pageImage="icons/genproject.gif"> + <projectDescriptor + name="org.eclipse.etrice.runtime.c++" + contentURI="contents/org.eclipse.etrice.runtime.c++.zip" + description="eTrice Runtime for Cpp"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.c.zip" + description="eTrice Runtime for C" + name="org.eclipse.etrice.runtime.c"/> + </example> + </extension> + + <!-- ========= org.eclipse.etrice.modellib.cpp ========= --> + <extension point="org.eclipse.ui.newWizards"> + <wizard id="org.eclipse.etrice.ui.runtime.NewCppModelLibWizard" + name="eTrice C++ ModelLib" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCppCategory/org.eclipse.etrice.core.ui.libraryCppCategory" + icon="icons/genproject.gif" + project="true"> + <description>A ROOM Model Library for C++ with useful services</description> + </wizard> + </extension> + <extension point="org.eclipse.emf.common.ui.examples"> + <example wizardID="org.eclipse.etrice.ui.runtime.NewCppModelLibWizard" pageImage="icons/genproject.gif"> + <projectDescriptor + name="org.eclipse.etrice.modellib.cpp" + contentURI="contents/org.eclipse.etrice.modellib.cpp.zip" + description="eTrice ModelLib for C++"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.cpp.zip" + description="eTrice Runtime for C++" + name="org.eclipse.etrice.runtime.cpp"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.c.zip" + description="eTrice Runtime for C" + name="org.eclipse.etrice.runtime.c"/> + </example> + </extension> <!-- ========= org.eclipse.etrice.runtime.java ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewJavaRuntimeWizard" - name="eTrice Java Runtime" - class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" + <wizard id="org.eclipse.etrice.ui.runtime.NewJavaRuntimeWizard" + name="eTrice Java Runtime" + class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardJavaCategory/org.eclipse.etrice.core.ui.libraryJavaCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>The Java Runtime required by eTrice Java projects</description> </wizard> @@ -91,15 +152,15 @@ contentURI="contents/org.eclipse.etrice.runtime.java.zip" description="eTrice Runtime for Java"/> </example> - </extension> + </extension> <!-- ========= org.eclipse.etrice.modellib.java ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewJavaModelLibWizard" - name="eTrice Java ModelLib" - class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + <wizard id="org.eclipse.etrice.ui.runtime.NewJavaModelLibWizard" + name="eTrice Java ModelLib" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardJavaCategory/org.eclipse.etrice.core.ui.libraryJavaCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>A ROOM Model Library for Java with useful services</description> </wizard> @@ -116,16 +177,16 @@ name="org.eclipse.etrice.runtime.java"> </projectDescriptor> </example> - </extension> + </extension> <!-- ========= org.eclipse.etrice.tutorials.java ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewJavaTutorialWizard" - name="eTrice Java Tutorials" - class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + <wizard id="org.eclipse.etrice.ui.runtime.NewJavaTutorialWizard" + name="eTrice Java Tutorials" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardJavaCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>eTrice Java tutorials accompanying the online help</description> </wizard> @@ -147,15 +208,15 @@ name="org.eclipse.etrice.runtime.java"> </projectDescriptor> </example> - </extension> - + </extension> + <!-- ========= org.eclipse.etrice.examples.java ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewJavaExamplesWizard" - name="eTrice Java Examples" - class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + <wizard id="org.eclipse.etrice.ui.runtime.NewJavaExamplesWizard" + name="eTrice Java Examples" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardJavaCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>eTrice Java examples</description> </wizard> @@ -178,15 +239,15 @@ name="org.eclipse.etrice.examples.java"> </projectDescriptor> </example> - </extension> + </extension> <!-- ========= org.eclipse.etrice.tutorials.c ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.NewCTutorialWizard" - name="eTrice C Tutorials" - class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + <wizard id="org.eclipse.etrice.ui.runtime.NewCTutorialWizard" + name="eTrice C Tutorials" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>eTrice C tutorials accompanying the online help</description> </wizard> @@ -208,15 +269,15 @@ name="org.eclipse.etrice.modellib.c"> </projectDescriptor> </example> - </extension> - + </extension> + <!-- ========= org.eclipse.etrice.examples.c ========= --> <extension point="org.eclipse.ui.newWizards"> - <wizard id="org.eclipse.etrice.ui.runtime.ExamplesCWizard" - name="eTrice C Examples" - class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + <wizard id="org.eclipse.etrice.ui.runtime.ExamplesCWizard" + name="eTrice C Examples" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCCategory" - icon="icons/genproject.gif" + icon="icons/genproject.gif" project="true"> <description>eTrice C tutorials accompanying the online help</description> </wizard> @@ -239,7 +300,7 @@ </projectDescriptor> </example> </extension> - + <!-- ========= org.eclipse.etrice.template.c ========= --> <extension point="org.eclipse.ui.newWizards"> <wizard @@ -270,9 +331,79 @@ description="eTrice ModelLib for C" name="org.eclipse.etrice.modellib.c"> </projectDescriptor> - <fileToOpen - location="org.eclipse.etrice.template.c/model/TemplateModel.room"> - </fileToOpen> + <fileToOpen + location="org.eclipse.etrice.template.c/model/TemplateModel.room"> + </fileToOpen> + </example> + </extension> + + <!-- ========= org.eclipse.etrice.tutorials.cpp ========= --> + <extension point="org.eclipse.ui.newWizards"> + <wizard id="org.eclipse.etrice.ui.runtime.NewCppTutorialWizard" + name="eTrice C++ Tutorials" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCppCategory" + icon="icons/genproject.gif" + project="true"> + <description>eTrice C++ tutorials accompanying the online help</description> + </wizard> + </extension> + <extension point="org.eclipse.emf.common.ui.examples"> + <example wizardID="org.eclipse.etrice.ui.runtime.NewCppTutorialWizard" pageImage="icons/genproject.gif"> + <projectDescriptor + name="org.eclipse.etrice.tutorials.cpp" + contentURI="contents/org.eclipse.etrice.tutorials.cpp.zip" + description="eTrice C++ Tutorials"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.cpp.zip" + description="eTrice Runtime for C++" + name="org.eclipse.etrice.runtime.cpp"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.modellib.cpp.zip" + description="eTrice ModelLib for C++" + name="org.eclipse.etrice.modellib.cpp"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.c.zip" + description="eTrice Runtime for C" + name="org.eclipse.etrice.runtime.c"/> + </example> + </extension> + + <!-- ========= org.eclipse.etrice.template.cpp ========= --> + <extension point="org.eclipse.ui.newWizards"> + <wizard + category="org.eclipse.etrice.core.ui.wizardCategory/org.eclipse.etrice.core.ui.wizardCppCategory" + class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller" + finalPerspective="org.eclipse.cdt.ui.CPerspective" + icon="icons/genproject.gif" + id="org.eclipse.etrice.ui.runtime.TemplateCppWizard" + name="eTrice C++ Template Project" + preferredPerspectives="org.eclipse.cdt.ui.CPerspective" + project="true"> + <description>Create the template C++ project with eTrice dependencies</description> + </wizard> + </extension> + <extension point="org.eclipse.emf.common.ui.examples"> + <example wizardID="org.eclipse.etrice.ui.runtime.TemplateCppWizard" pageImage="icons/genproject.gif"> + <projectDescriptor + name="org.eclipse.etrice.template.cpp" + contentURI="contents/org.eclipse.etrice.template.cpp.zip" + description="eTrice C++ Template Project"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.cpp.zip" + description="eTrice Runtime for C++" + name="org.eclipse.etrice.runtime.cpp"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.modellib.cpp.zip" + description="eTrice ModelLib for C++" + name="org.eclipse.etrice.modellib.cpp"/> + <projectDescriptor + contentURI="contents/org.eclipse.etrice.runtime.c.zip" + description="eTrice Runtime for C" + name="org.eclipse.etrice.runtime.c"/> + <fileToOpen + location="org.eclipse.etrice.template.cpp/model/TemplateModel.room"> + </fileToOpen> </example> - </extension> + </extension> </plugin> diff --git a/releng/org.eclipse.etrice.releng/buckminster.cspec b/releng/org.eclipse.etrice.releng/buckminster.cspec index a6e88fe00..9d883f463 100644 --- a/releng/org.eclipse.etrice.releng/buckminster.cspec +++ b/releng/org.eclipse.etrice.releng/buckminster.cspec @@ -3,18 +3,27 @@ <cs:dependency name="org.eclipse.emf.mwe.utils" componentType="osgi.bundle"/> <cs:dependency name="org.eclipse.etrice.cdt-integration.feature" componentType="eclipse.feature"/> <cs:dependency name="org.eclipse.etrice.feature" componentType="eclipse.feature"/> - <cs:dependency name="org.eclipse.etrice.generator.c.tests" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.generator.common.tests" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.generator.c.tests" componentType="buckminster"/> <cs:dependency name="org.eclipse.etrice.generator.cpp.tests" componentType="buckminster"/> <cs:dependency name="org.eclipse.etrice.generator.java.tests" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.kieler.feature" componentType="eclipse.feature"/> <cs:dependency name="org.eclipse.etrice.layout.feature" componentType="eclipse.feature"/> + <cs:dependency name="org.eclipse.etrice.modellib.c" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.modellib.cpp" componentType="buckminster"/> <cs:dependency name="org.eclipse.etrice.modellib.java" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.runtime.c" componentType="buckminster"/> - <cs:dependency name="org.eclipse.etrice.runtime.c.tests" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.runtime.cpp" componentType="buckminster"/> <cs:dependency name="org.eclipse.etrice.runtime.java" componentType="buckminster"/> + + <cs:dependency name="org.eclipse.etrice.runtime.c.tests" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.runtime.cpp.tests" componentType="buckminster"/> <cs:dependency name="org.eclipse.etrice.runtime.java.tests" componentType="buckminster"/> + <cs:dependency name="org.eclipse.etrice.site" componentType="eclipse.feature"/> <cs:dependency name="org.eclipse.etrice.tests.feature" componentType="eclipse.feature"/> <cs:dependency name="org.eclipse.etrice.tutorials.java" componentType="buckminster"/> diff --git a/releng/org.eclipse.etrice.releng/buckminster.script b/releng/org.eclipse.etrice.releng/buckminster.script index e55d918c8..0854d493f 100644 --- a/releng/org.eclipse.etrice.releng/buckminster.script +++ b/releng/org.eclipse.etrice.releng/buckminster.script @@ -26,13 +26,16 @@ junit -l org.eclipse.etrice.ui.structure.tests/org.eclipse.etrice.ui.structure.t junit -l org.eclipse.etrice.abstractexec.behavior.tests/org.eclipse.etrice.abstractexec.behavior.tests.launch -o ${WORKSPACE}/buildroot/test.results/org.eclipse.etrice.abstractexec.behavior.tests.xml --terseXML --flatXML --stderr ${WORKSPACE}/buildroot/test.results/org.eclipse.etrice.abstractexec.behavior.tests.launch-err.log --stdout ${WORKSPACE}/buildroot/test.results/org.eclipse.etrice.abstractexec.behavior.tests.launch-out.log perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.runtime.c.tests#run_tests -perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.generator.java.tests#run_tests +perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.runtime.cpp.tests#run_tests + perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.generator.c.tests#run_tests -#perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.generator.cpp.tests#run_tests +perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.generator.cpp.tests#run_tests +perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.generator.java.tests#run_tests perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.ui.runtime#create.contents perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.releng#export.c.generator +#perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.releng#export.cpp.generator perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.releng#export.java.generator perform -D WORKSPACE=${WORKSPACE} -P "${WORKSPACE}/buildroot/build.properties" org.eclipse.etrice.releng#copy.deliveries diff --git a/runtime/org.eclipse.etrice.modellib.c/.cproject b/runtime/org.eclipse.etrice.modellib.c/.cproject index 127a203dc..3637b3de5 100644 --- a/runtime/org.eclipse.etrice.modellib.c/.cproject +++ b/runtime/org.eclipse.etrice.modellib.c/.cproject @@ -12,13 +12,13 @@ </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.847049798" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.847049798" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.847049798." name="/" resourcePath=""> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.384751993" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.890594653" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> @@ -49,6 +49,7 @@ <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.c.compiler.option.dialect.std.2005279778" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c99" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.161900119" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1011028586" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> @@ -85,11 +86,11 @@ </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> @@ -161,11 +162,11 @@ </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.cproject b/runtime/org.eclipse.etrice.modellib.cpp/.cproject index 0746c4ef3..717915687 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/.cproject +++ b/runtime/org.eclipse.etrice.modellib.cpp/.cproject @@ -2,31 +2,35 @@ <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> <storageModule moduleId="org.eclipse.cdt.core.settings"> <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035"> - <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" moduleId="org.eclipse.cdt.core.settings" name="Debug"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" moduleId="org.eclipse.cdt.core.settings" name="WindowsMinGW"> <externalSettings> <externalSetting> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/Debug"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.modellib.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/WindowsMinGW"/> <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="org.eclipse.etrice.modellib.cpp" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <configuration artifactExtension="a" artifactName="org.eclipse.etrice.modellib.cpp" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035." name="/" resourcePath=""> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.528335783" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.1299569783" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> - <builder buildPath="${workspace_loc:/org.eclipse.etrice.modellib.cpp/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.2013445161" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.modellib.cpp}/WindowsMinGW" id="cdt.managedbuild.tool.gnu.builder.mingw.base.334543344" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.724387525" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug"> <option id="gnu.both.asm.option.include.paths.1757143474" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> </option> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1284881452" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> @@ -35,19 +39,28 @@ <option id="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level.1721757225" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1204207148" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> <option id="gnu.cpp.compiler.option.include.paths.1001723439" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.cpp.compiler.option.dialect.std.1027459885" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.error.1553779395" name="Pedantic warnings as errors (-pedantic-errors)" superClass="gnu.cpp.compiler.option.warnings.pedantic.error" value="true" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.402201359" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.485632379" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug"> <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.386071444" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/> <option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.2121576926" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> <option id="gnu.c.compiler.option.include.paths.1424766451" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> </option> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2050037191" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> @@ -55,95 +68,231 @@ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.386321355" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/> </toolChain> </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> </configuration> </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> </cconfiguration> - <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927"> - <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927" moduleId="org.eclipse.cdt.core.settings" name="Release"> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093" moduleId="org.eclipse.cdt.core.settings" name="ExternalMakefile"> <externalSettings> <externalSetting> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/Release"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/ExternalMakefile"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp"/> <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927" name="Release" parent="cdt.managedbuild.config.gnu.mingw.lib.release"> - <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.release.369390927." name="/" resourcePath=""> - <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.release.863050384" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.release"> - <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.release.1531613870" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.release"/> - <builder buildPath="${workspace_loc:/org.eclipse.etrice.modellib.cpp/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.658172533" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> - <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release.1090371584" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release"> - <option id="gnu.both.asm.option.include.paths.2079893992" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <configuration artifactExtension="a" artifactName="org.eclipse.etrice.modellib.cpp" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093" name="ExternalMakefile" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.488608050" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> + <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.2112042599" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> + <builder id="cdt.managedbuild.target.gnu.builder.base.1876012904" incrementalBuildTarget="build" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.1018894377" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug"> + <option id="gnu.both.asm.option.include.paths.54562668" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> - <listOptionValue builtIn="false" value="/org.eclipse.etrice.runtime.cpp/src/platform/generic"/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> </option> - <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1692202427" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.287217142" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> - <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release.859095155" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release"/> - <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.756312591" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release"> - <option id="gnu.cpp.compiler.mingw.lib.release.option.optimization.level.2147476314" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> - <option id="gnu.cpp.compiler.mingw.lib.release.option.debugging.level.1387780898" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.include.paths.528505037" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug.1527067482" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.448305340" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug"> + <option id="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level.117342493" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1035517938" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.27501825" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.54501712" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.929736773" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.456166370" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.1203197176" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.776631792" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.249749500" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.7150152" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.1795174830" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/ExternalMakefile"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464" moduleId="org.eclipse.cdt.core.settings" name="LinuxPosix"> + <externalSettings> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.modellib.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.modellib.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.modellib.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.modellib.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactExtension="a" artifactName="org.eclipse.etrice.modellib.cpp" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464" name="LinuxPosix" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.base.1769544793" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base"> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1007475917" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.modellib.cpp}/LinuxPosix" id="cdt.managedbuild.target.gnu.builder.base.255029229" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.archiver.base.1464497979" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1653033041" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"> + <option id="gnu.cpp.compiler.option.include.paths.1352950879" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> - <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1763050360" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + <option id="gnu.cpp.compiler.option.optimization.level.1192159685" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.debugging.level.536107719" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.dialect.std.141185236" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.495840162" superClass="gnu.cpp.compiler.option.warnings.pedantic" value="true" valueType="boolean"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1729514812" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1143151683" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"> + <option id="gnu.c.compiler.option.include.paths.1608033267" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths"/> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.863477407" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/> + <option id="gnu.c.compiler.option.debugging.level.567501402" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1482592347" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> - <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.129970568" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release"> - <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.lib.release.option.optimization.level.1329568783" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.release.option.optimization.level" valueType="enumerated"/> - <option id="gnu.c.compiler.mingw.lib.release.option.debugging.level.1807223219" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> - <option id="gnu.c.compiler.option.include.paths.316043543" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> + <tool id="cdt.managedbuild.tool.gnu.c.linker.base.918402900" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.900175608" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.base.2102428941" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"> + <option id="gnu.both.asm.option.include.paths.1581322722" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.modellib.cpp/src-gen}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> </option> - <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.760635415" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2112266569" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> - <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1854320864" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> - <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.1472356875" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/> </toolChain> </folderInfo> + <sourceEntries> + <entry excluding="src-gen-info" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> </configuration> </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> </cconfiguration> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> <project id="org.eclipse.etrice.modellib.cpp.cdt.managedbuild.target.gnu.mingw.lib.704211053" name="Static Library" projectType="cdt.managedbuild.target.gnu.mingw.lib"/> </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> + <storageModule moduleId="refreshScope" versionNumber="2"> + <configuration configurationName="ExternalMakefile"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.modellib.cpp"/> + </configuration> + <configuration configurationName="WindowsMinGW"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.modellib.cpp"/> + </configuration> + </storageModule> <storageModule moduleId="scannerConfiguration"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.456186999;cdt.managedbuild.tool.gnu.c.compiler.input.278038575"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.118960948;cdt.managedbuild.tool.gnu.cpp.compiler.input.402201359"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/> </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.369390927;cdt.managedbuild.config.gnu.mingw.lib.release.369390927.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.129970568;cdt.managedbuild.tool.gnu.c.compiler.input.760635415"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.448305340;cdt.managedbuild.tool.gnu.cpp.compiler.input.54501712"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.485632379;cdt.managedbuild.tool.gnu.c.compiler.input.2050037191"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464.;cdt.managedbuild.tool.gnu.c.compiler.base.1143151683;cdt.managedbuild.tool.gnu.c.compiler.input.1482592347"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.254249640;cdt.managedbuild.tool.gnu.cpp.compiler.input.10447823"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.369390927;cdt.managedbuild.config.gnu.mingw.lib.release.369390927.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.756312591;cdt.managedbuild.tool.gnu.cpp.compiler.input.1763050360"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/> </scannerConfigBuildInfo> - </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> - <storageModule moduleId="refreshScope" versionNumber="2"> - <configuration configurationName="Release"> - <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.modellib.cpp"/> - </configuration> - <configuration configurationName="Debug"> - <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.modellib.cpp"/> - </configuration> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.551809464.;cdt.managedbuild.tool.gnu.cpp.compiler.base.1653033041;cdt.managedbuild.tool.gnu.cpp.compiler.input.1729514812"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093;cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.929736773;cdt.managedbuild.tool.gnu.c.compiler.input.249749500"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> </storageModule> </cproject> diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.gitignore b/runtime/org.eclipse.etrice.modellib.cpp/.gitignore index 0f3a6b1b9..5d84de410 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/.gitignore +++ b/runtime/org.eclipse.etrice.modellib.cpp/.gitignore @@ -1,2 +1,14 @@ -Debug -Release +WindowsMinGW +LinuxPosix + +src-gen/* +!src-gen/readme.txt +src-gen-info/* +!src-gen-info/readme.txt + +*.aux +*.lof +*.gz +*.toc +*.log +/MinGWDebug/ diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.project b/runtime/org.eclipse.etrice.modellib.cpp/.project index 34286da09..218d6fc34 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/.project +++ b/runtime/org.eclipse.etrice.modellib.cpp/.project @@ -3,6 +3,7 @@ <name>org.eclipse.etrice.modellib.cpp</name> <comment></comment> <projects> + <project>org.eclipse.etrice.runtime.cpp</project> </projects> <buildSpec> <buildCommand> diff --git a/runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.core.prefs b/runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 000000000..1cbabde2f --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/CPP_RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/CPP_RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/CPP_RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/ECLIPSE_MODE/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/ECLIPSE_MODE/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/ECLIPSE_MODE/value=true +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.c} +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/append=true +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.44153035.90416093/appendContributed=true diff --git a/runtime/org.eclipse.etrice.modellib.cpp/Makefile b/runtime/org.eclipse.etrice.modellib.cpp/Makefile new file mode 100644 index 000000000..4236856be --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/Makefile @@ -0,0 +1,20 @@ +ifeq ($(strip ${RUNTIME_ROOTDIR}),) + RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.c +endif +ifeq ($(strip ${CPP_RUNTIME_ROOTDIR}),) + CPP_RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.cpp +endif + +include ${CPP_RUNTIME_ROOTDIR}/buildTools/runtime.mk + +# --- +IN_TARGET := lib$(notdir $(shell pwd)).a +IN_INCDIRS += ./src-gen +IN_SRCDIRS_REC := ./src-gen +CC = ${CXX} +IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall +# --- + + +# Create rules +include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/buildTools/modellib.mk b/runtime/org.eclipse.etrice.modellib.cpp/buildTools/modellib.mk new file mode 100644 index 000000000..a21037ef4 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/buildTools/modellib.mk @@ -0,0 +1,17 @@ +include ${RUNTIME_ROOTDIR}/buildTools/defaults.mk + +# --- +IN_INCDIRS += ${CPP_MODELLIB_ROOTDIR}/src-gen + +IN_LDFLAGS += -L${CPP_MODELLIB_ROOTDIR}/${TARGET_BUILD_DIR} +IN_LDLIBS += -lorg.eclipse.etrice.modellib.cpp +ifeq ($(strip ${ECLIPSE_MODE}),) + IN_PREREQS += liborg.eclipse.etrice.modellib.cpp.a +endif + +liborg.eclipse.etrice.modellib.cpp.a: + ${MAKE} -C ${CPP_MODELLIB_ROOTDIR} build + +clean_liborg.eclipse.etrice.modellib.cpp.a: + ${MAKE} -C ${CPP_MODELLIB_ROOTDIR} clean + diff --git a/runtime/org.eclipse.etrice.modellib.cpp/gen_modellib.launch b/runtime/org.eclipse.etrice.modellib.cpp/gen_modellib.launch index 7d753659a..20bfb754c 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/gen_modellib.launch +++ b/runtime/org.eclipse.etrice.modellib.cpp/gen_modellib.launch @@ -1,13 +1,20 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.etrice.generator.launch.cpp.launchConfigurationType"> +<booleanAttribute key="DataLogging" value="false"/> +<booleanAttribute key="Debug" value="false"/> +<booleanAttribute key="GenDocumentation" value="false"/> <booleanAttribute key="GenInstanceDiagram" value="false"/> <stringAttribute key="GenModelPath" value=""/> <booleanAttribute key="Lib" value="true"/> +<booleanAttribute key="MSC" value="true"/> <listAttribute key="ModelFiles"> -<listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.cpp/model/Language.room}"/> <listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.cpp/model/TimingService.room}"/> <listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.cpp/model/Types.room}"/> </listAttribute> +<booleanAttribute key="OverrideDirectories" value="false"/> <booleanAttribute key="SaveGenModel" value="false"/> +<booleanAttribute key="UseTranslation" value="true"/> +<booleanAttribute key="Verbose" value="false"/> +<booleanAttribute key="etUnit" value="false"/> <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/org.eclipse.etrice.modellib.cpp/src-gen" type="2"/> </resources>}"/> </launchConfiguration> diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys b/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys new file mode 100644 index 000000000..27f442b9c --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys @@ -0,0 +1,43 @@ +PhysicalModel room.generic.physical { + + PhysicalSystem GenericPhysicalSystem { + NodeRef node : GenericNodeClass + } + + NodeClass GenericNodeClass { + runtime = DefaultRuntimeClass + priomin = -10 + priomax = 10 + + DefaultThread DefaultPhysicalThread { + execmode = mixed + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread BlockedThread { + execmode = blocked + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + + Thread PolledThread { + execmode = polled + interval = 100ms + prio = 0 + stacksize = 1024 + msgblocksize = 64 + msgpoolsize = 100 + } + } + + RuntimeClass DefaultRuntimeClass { + model = multiThreaded + } + +}
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room b/runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room new file mode 100644 index 000000000..48e49e03d --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room @@ -0,0 +1,16 @@ +RoomModel room.basic.etunit { + + import room.basic.types.* from "Types.room" + + /** + * A SubSystemClass or ActorClass having this annotation is construed as an instance.<br> + * During generation the necessary instantiation (LogicalSystem, SubSystemRef etc.) and mapping will be created. + * <p> + * Must not have LogicalThreads. Globally only once allowed. Runtime execution on DefaultThread of given PhysicalSystem. + * </p> + */ + AnnotationType TestInstance { + target = { SubSystemClass, ActorClass } + } + +}
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room index f90df84a7..ba8953ff4 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room @@ -8,139 +8,141 @@ RoomModel room.basic.service.timing { } Structure { usercode1 { - " - #include \"common/platform/etTimer.h\" - #define ET_NB_OF_TCBS 10 - typedef struct etTCB etTimerControlBlock; - struct etTCB { - etTargetTime_t expTime; - etTargetTime_t pTime; - int32 portIdx; - etTimerControlBlock* next; - }; - " + "#include \"osal/etTime.h\" " + "#define ET_NB_OF_TCBS 30" + "typedef struct etTCB etTimerControlBlock;" + "struct etTCB {" + " etTime expTime;" + " etTime pTime;" + " int32 portIdx;" + " etTimerControlBlock* next;" + "};" } usercode2 { - "//uc2" + "// uc2" + } usercode3 { + "// uc3" } - usercode3{ - "//etTimerControlBlock tcbs[ET_NB_OF_TCBS];" - } - ServiceImplementation of timer - Attribute tcbs[10]:tcb - Attribute usedTcbsRoot : tcb ref - Attribute freeTcbsRoot : tcb ref + Attribute tcbs [ 30 ]: tcb + Attribute usedTcbsRoot: tcb ref + Attribute freeTcbsRoot: tcb ref + ServiceImplementation of timer } Behavior { - Operation getTcb():tcb ref{" - etTimerControlBlock* temp = freeTcbsRoot; - - if(freeTcbsRoot!=0) { - freeTcbsRoot=freeTcbsRoot->next; - temp->next=0; - } - return temp; - "} - Operation returnTcb(block:tcb ref){" - block->next=freeTcbsRoot; - freeTcbsRoot=block; - "} - Operation removeTcbFromUsedList(idx:int32){" - etTimerControlBlock* temp=usedTcbsRoot; - etTimerControlBlock* temp2=usedTcbsRoot; - - if (temp==0) return; - - if (usedTcbsRoot->portIdx == idx){ - // element found, the first one - usedTcbsRoot = usedTcbsRoot->next; - returnTcb(temp); - return; - } + Operation getTcb(): tcb ref { + "etTimerControlBlock* temp = freeTcbsRoot;" + "" + "if (freeTcbsRoot != 0) {" + " freeTcbsRoot = freeTcbsRoot->next;" + " temp->next = 0;" + "}" + "return temp;" + "" + } + Operation returnTcb(block: tcb ref) { + "block->next = freeTcbsRoot;" + "freeTcbsRoot = block;" + } + Operation removeTcbFromUsedList(idx: int32) { + "etTimerControlBlock* temp = usedTcbsRoot;" + "etTimerControlBlock* temp2 = usedTcbsRoot;" + "" + "if (temp == 0)" + " return;" + "" + "if (usedTcbsRoot->portIdx == idx) {" + " /* element found, the first one */" + " usedTcbsRoot = usedTcbsRoot->next;" + " returnTcb(temp);" + " return;" + "}" + "" + "temp = temp->next;" + "while (temp != 0) {" + " if (temp->portIdx == idx) {" + " temp2->next = temp->next;" + " returnTcb(temp);" + " return;" + " } else {" + " /* try next */" + " temp2 = temp;" + " temp = temp->next;" + " }" + "}" + } + Operation putTcbToUsedList(block: tcb ref) { + "etTimerControlBlock* temp = usedTcbsRoot;" + "etTimerControlBlock* temp2 = usedTcbsRoot;" + "" + "if (temp == 0) {" + " /* list empty put new block to root */" + " block->next = 0;" + " usedTcbsRoot = block;" + " return;" + "}" + "" + "while (1) {" + " if (temp != 0) {" + " if (isTimeGreater(&block->expTime, &temp->expTime)) {" + " /* try next position */" + " temp2 = temp;" + " temp = temp->next;" + " } else {" + " /* right position found */" + " block->next = temp;" + " if (temp == usedTcbsRoot) {" + " usedTcbsRoot = block;" + " } else {" + " temp2->next = block;" + " }" + " return;" + " }" + " } else {" + " /* end of list reached */" + " block->next = 0;" + " temp2->next = block;" + " return;" + " }" + "}" + } + Operation isTimeGreater(t1: targetTime ref, t2: targetTime ref): boolean { + "if (t1->sec > t2->sec)" + " return ET_TRUE;" + "if (t1->sec < t2->sec)" + " return ET_FALSE;" + "if (t1->nSec > t2->nSec)" + " return ET_TRUE;" + "return ET_FALSE;" + } + Operation addTime(t1: targetTime ref, t2: targetTime ref) { + "t1->sec += t2->sec;" + "t1->nSec += t2->nSec;" + "while (t1->nSec >= 1000000000L) {" + " t1->sec++;" + " t1->nSec -= 1000000000L;" + "}" + } - temp=temp->next; - while(temp!=0){ - if(temp->portIdx==idx){ - temp2->next=temp->next; - returnTcb(temp); - return; - }else{ - // try next - temp2=temp; - temp=temp->next; - } - } - "} - Operation putTcbToUsedList(block:tcb ref){" - etTimerControlBlock* temp=usedTcbsRoot; - etTimerControlBlock* temp2=usedTcbsRoot; + // Operation printList(){ + // "etTimerControlBlock* temp=usedTcbsRoot;" + // " printf(\"list: \");" + // " while (temp!=0){" + // " printf(\"(%ld,%ld),\",temp->expTime.sec,temp->expTime.nSec);" + // " temp=temp->next;" + // " }" + // " printf(\"\\n\");" + // } - if (temp==0){ - // list empty put new block to root - block->next=0; - usedTcbsRoot=block; - return; - } - - while(1){ - if (temp != 0){ - if (isTimeGreater(&block->expTime,&temp->expTime)){ - //try next position - temp2=temp; - temp=temp->next; - }else{ - // right position found - block->next=temp; - if(temp==usedTcbsRoot){ - usedTcbsRoot=block; - }else{ - temp2->next=block; - } - return; - } - }else{ - // end of list reached - block->next=0; - temp2->next=block; - return; - } - } - "} - Operation isTimeGreater(t1:targetTime ref, t2 :targetTime ref):boolean{" - if (t1->sec > t2->sec) return TRUE; - if (t1->sec < t2->sec) return FALSE; - if (t1->nSec > t2->nSec) return TRUE; - return FALSE; - "} - - Operation addTime(t1:targetTime ref, t2:targetTime ref){" - t1->sec += t2->sec; - t1->nSec += t2->nSec; - while(t1->nSec >= 1000000000L){ - t1->sec++; - t1->nSec-=1000000000L; - } - "} - - Operation printList(){" - etTimerControlBlock* temp=usedTcbsRoot; - printf(\"list: \"); - while (temp!=0){ - printf(\"(%ld,%ld),\",temp->expTime.sec,temp->expTime.nSec); - temp=temp->next; - } - printf(\"\\n\"); - "} StateMachine { Transition tr0: initial -> Operational { action { "int i;" - "usedTcbsRoot=0;" - "freeTcbsRoot=&tcbs[0];" - "tcbs[ET_NB_OF_TCBS-1].next=0;" - "for (i=0;i<ET_NB_OF_TCBS-1;i++){" - "\ttcbs[i].next=&tcbs[i+1];" - "\t}" + "usedTcbsRoot = 0;" + "freeTcbsRoot = &tcbs[0];" + "tcbs[ET_NB_OF_TCBS - 1].next = 0;" + "for (i = 0; i < ET_NB_OF_TCBS - 1; i++) {" + "\ttcbs[i].next = &tcbs[i + 1];" + "}" } } Transition tr1: Operational -> Operational { @@ -149,17 +151,17 @@ RoomModel room.basic.service.timing { } action { "etTimerControlBlock* timer = getTcb();" - "etTargetTime_t t;" - "if (timer!= 0){" - "\tt.sec=time/1000;" - "\tt.nSec=(time%1000)*1000000L;" + "etTime t;" + "if (timer != 0) {" + "\tt.sec = time / 1000;" + "\tt.nSec = (time % 1000) * 1000000L;" "\ttimer->pTime.sec = 0;" "\ttimer->pTime.nSec = 0;" - "\ttimer->portIdx=ifitem->getIdx();" + "\ttimer->portIdx = ifitem->getIdx();" "\tgetTimeFromTarget(&(timer->expTime));" - "\taddTime(&(timer->expTime),&t);" + "\taddTime(&(timer->expTime), &t);" "\tputTcbToUsedList(timer);" - "\t}" + "}" } } Transition tr3: Operational -> Operational { @@ -168,16 +170,16 @@ RoomModel room.basic.service.timing { } action { "etTimerControlBlock* timer = getTcb();" - "etTargetTime_t t;" - "if (timer!= 0){" - "\tt.sec=time/1000;" - "\tt.nSec=(time%1000)*1000000L;" + "etTime t;" + "if (timer != 0) {" + "\tt.sec = time / 1000;" + "\tt.nSec = (time % 1000) * 1000000L;" "\ttimer->pTime = t;" - "\ttimer->portIdx=ifitem->getIdx();" + "\ttimer->portIdx = ifitem->getIdx();" "\tgetTimeFromTarget(&(timer->expTime));" - "\taddTime(&(timer->expTime),&t);" + "\taddTime(&(timer->expTime), &t);" "\tputTcbToUsedList(timer);" - "\t}" + "}" } } Transition tr4: Operational -> Operational { @@ -194,38 +196,36 @@ RoomModel room.basic.service.timing { } do { "// maintain timers" "etTimerControlBlock* temp;" - "etTargetTime_t t;" + "etTime t;" "" "getTimeFromTarget(&t);" - "while (usedTcbsRoot !=0 ){" - "\tif (isTimeGreater(&t,&(usedTcbsRoot->expTime))){" - "\t\ttimer[usedTcbsRoot->portIdx].timeout();" - "\t\ttemp=usedTcbsRoot;" - "\t\tusedTcbsRoot=usedTcbsRoot->next;" - "\t\tif((temp->pTime.sec==0)&&(temp->pTime.nSec==0)){" + "while (usedTcbsRoot != 0) {" + "\tif (isTimeGreater(&t, &(usedTcbsRoot->expTime))) {" + "\t\ttimer.get(usedTcbsRoot->portIdx).timeout();" + "\t\ttemp = usedTcbsRoot;" + "\t\tusedTcbsRoot = usedTcbsRoot->next;" + "\t\tif ((temp->pTime.sec == 0) && (temp->pTime.nSec == 0)) {" "\t\t\t// single shot timer" "\t\t\treturnTcb(temp);" - "\t\t}else{" + "\t\t} else {" "\t\t\t// periodic timer" - "\t\t\taddTime(&temp->expTime,&temp->pTime);" + "\t\t\taddTime(&temp->expTime, &temp->pTime);" "\t\t\tputTcbToUsedList(temp);" - "\t\t\t}" - "\t\t}else{" - "\t\t\tbreak;" - "\t\t\t}" + "\t\t}" + "\t} else {" + "\t\tbreak;" "\t}" + "}" } } } } } - ProtocolClass PTimer { - usercode1 {" - #define ET_TIMER_RUNNING 0x01 - #define ET_TIMER_PERIODIC 0x02 - " + usercode1 { + "#define ET_TIMER_RUNNING 0x01" + "#define ET_TIMER_PERIODIC 0x02" } usercode2 { "//uc2 " @@ -240,35 +240,37 @@ RoomModel room.basic.service.timing { } conjugated PortClass { - handle incoming startTimer{ - " - if (status==0){ + Attribute status: int8 = "0" + handle + incoming startTimer { + "if (status==0){ status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC; DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), PTimer::getMessageString(PTimer::IN_startTimer)); if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimer, - reinterpret_cast<void*>(time), + getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimer, + &time, sizeof(uint32))); } } - " - } - handle incoming startTimeout{ " - if (status==0){ + } + handle + incoming startTimeout { + "if (status==0){ status = ET_TIMER_RUNNING; DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), PTimer::getMessageString(PTimer::IN_startTimeout)); if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimeout, - reinterpret_cast<void*>(time), + getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimeout, + &time, sizeof(uint32))); } } - " + " } - handle outgoing timeout{ + handle + outgoing timeout { " //TODO: clear active bit in case of single shot timer if (status!=0){ @@ -277,25 +279,26 @@ RoomModel room.basic.service.timing { status=0; } // msg to fsm - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); + getActor()->receiveEvent(this, msg->getEvtId(), msg->getData()); } " } - handle incoming kill { + handle + incoming kill { " if (status!=0){ status=0; DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), PTimer::getMessageString(PTimer::IN_kill)); if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_kill, 0, 0)); + getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_kill)); } } " } - Attribute status:int8="0" } } - ExternalType tcb -> "etTimerControlBlock" - ExternalType targetTime -> "etTargetTime_t" + + ExternalType tcb -> "etTimerControlBlock" default "{{0,0},{0,0},0,NULL}" + ExternalType targetTime -> "etTime" default "{0,0}" }
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room b/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room index b9f15df1e..b3c4b89d5 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/Types.room @@ -17,5 +17,7 @@ RoomModel room.basic.types { // TODO: define strings for C PrimitiveType charPtr:ptCharacter -> charPtr default "0" - PrimitiveType string:ptCharacter -> charPtr default "0" + PrimitiveType string:ptCharacter -> string default "0" + + ExternalType voidType -> "void" default "NULL" }
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior index 8a72fd245..bb4cfad57 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.behavior @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ASCII"?> -<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of ATimingService" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link //@connections.3/@link" verticalGridUnit="10" version="0.9.0"> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of ATimingService" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link //@connections.3/@link" verticalGridUnit="10" version="0.11.0"> <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> <link> <businessObjects href="../TimingService.room#ActorClass:ATimingService"/> @@ -55,7 +55,7 @@ <link> <businessObjects href="../TimingService.room#SimpleState:ATimingService$Operational"/> </link> - <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1 //@connections.2 //@connections.3" incomingConnections="//@connections.0 //@connections.1 //@connections.2 //@connections.3" referencedGraphicsAlgorithm="//@children.0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1 //@connections.2 //@connections.3" incomingConnections="//@connections.0 //@connections.1 //@connections.2 //@connections.3"/> <children visible="true"> <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="375" height="156" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Operational"/> </children> diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure index 593420d2c..068747c43 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/diagrams/room.basic.service.timing.ATimingService.structure @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ASCII"?> -<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of ATimingService" pictogramLinks="//@children.0/@link //@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.9.0"> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.structure" name="Structure of ATimingService" pictogramLinks="//@children.0/@link //@link //@children.0/@children.0/@link" verticalGridUnit="10" version="0.11.0"> <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> <link> <businessObjects href="../TimingService.room#ActorClass:ATimingService"/> @@ -15,16 +15,17 @@ </link> <children xsi:type="pi:ContainerShape" visible="true" active="true"> <properties key="obj-type" value="port"/> + <properties key="inherited" value="false"/> <properties key="item-kind" value=""/> <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="245"> <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.2" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="40" height="40" x="20" y="20"/> </graphicsAlgorithm> <link> - <businessObjects href="../TimingService.room#SPPRef:ATimingService$timer"/> + <businessObjects href="../TimingService.room#SPP:ATimingService$timer"/> </link> <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> <children visible="true"> - <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="timer"/> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="80" height="20" font="//@fonts.0" value="timer"/> </children> </children> </children> diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen-info/readme.txt b/runtime/org.eclipse.etrice.modellib.cpp/src-gen-info/readme.txt new file mode 100644 index 000000000..1dc2b35ab --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/src-gen-info/readme.txt @@ -0,0 +1,4 @@ +This directory is an eTrice code generation target. +It will be erased every time the generator is executed. + +DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp deleted file mode 100644 index 1bbb17da9..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/** - * @author generated by eTrice - * - * Source File of ActorClass ATimingService - * - */ - -#include "ATimingService.h" -#include "common/debugging/DebuggingService.h" -#include <iostream> - -using namespace etRuntime; - - -ATimingService::ATimingService(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr, - const std::vector<std::vector<etRuntime::Address> >& peer_addr) -: ActorClassBase( parent, name, port_addr[0][0], peer_addr[0][0]), -timer(*this, this, "timer", IFITEM_timer, port_addr[IFITEM_timer], peer_addr[IFITEM_timer]), -tcbs(), -usedTcbsRoot(0), -freeTcbsRoot(0) -{ - history = new int[s_numberOfStates]; - for (int i = 0; i < s_numberOfStates; i++) { - history[i] = NO_STATE; - } - setClassName("ATimingService"); - // initialize attributes - for (int i=0;i<10;i++){ - tcbs[i] = etTimerControlBlock(); - } - - getMsgsvc()->addAsyncActor(*this); -} - -void ATimingService::init(){ - initUser(); -} - -void ATimingService::start(){ - startUser(); -} - -void ATimingService::stop(){ - stopUser(); -} - -void ATimingService::destroy(){ -} - - -std::string ATimingService::s_stateStrings[] = {"<no state>","<top>","Operational" -}; -const int ATimingService::s_numberOfStates = 3; - -void ATimingService::setState(int new_state) { - DebuggingService::getInstance().addActorState(*this, s_stateStrings[new_state]); - if (s_stateStrings[new_state]!="Idle") { - std::cout << getInstancePath() << " -> " << s_stateStrings[new_state] << std::endl; - } - m_state = new_state; -} - -/* Entry and Exit Codes */ -void ATimingService::entry_Operational() { - // prepare -} - void ATimingService::do_Operational() { - // maintain timers - etTimerControlBlock* temp; - etTargetTime_t t; - - getTimeFromTarget(&t); - while (usedTcbsRoot !=0 ){ - if (isTimeGreater(&t,&(usedTcbsRoot->expTime))){ - timer.get(usedTcbsRoot->portIdx).timeout(); - temp=usedTcbsRoot; - usedTcbsRoot=usedTcbsRoot->next; - if((temp->pTime.sec==0)&&(temp->pTime.nSec==0)){ - // single shot timer - returnTcb(temp); - }else{ - // periodic timer - addTime(&temp->expTime,&temp->pTime); - putTcbToUsedList(temp); - } - }else{ - break; - } - } -} - -/* Action Codes */ -void ATimingService::action_TRANS_INITIAL_TO__Operational() { - int i; - usedTcbsRoot=0; - freeTcbsRoot=&tcbs[0]; - tcbs[ET_NB_OF_TCBS-1].next=0; - for (i=0;i<ET_NB_OF_TCBS-1;i++){ - tcbs[i].next=&tcbs[i+1]; - } -} -void ATimingService::action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const InterfaceItemBase* ifitem, uint32 time) { - etTimerControlBlock* timer = getTcb(); - etTargetTime_t t; - if (timer!= 0){ - t.sec=time/1000; - t.nSec=(time%1000)*1000000L; - timer->pTime.sec = 0; - timer->pTime.nSec = 0; - timer->portIdx=ifitem->getIdx(); - getTimeFromTarget(&(timer->expTime)); - addTime(&(timer->expTime),&t); - putTcbToUsedList(timer); - } -} -void ATimingService::action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(const InterfaceItemBase* ifitem, uint32 time) { - etTimerControlBlock* timer = getTcb(); - etTargetTime_t t; - if (timer!= 0){ - t.sec=time/1000; - t.nSec=(time%1000)*1000000L; - timer->pTime = t; - timer->portIdx=ifitem->getIdx(); - getTimeFromTarget(&(timer->expTime)); - addTime(&(timer->expTime),&t); - putTcbToUsedList(timer); - } -} -void ATimingService::action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(const InterfaceItemBase* ifitem) { - removeTcbFromUsedList(ifitem->getIdx()); -} - -/** - * calls exit codes while exiting from the current state to one of its - * parent states while remembering the history - * @param current - the current state - * @param to - the final parent state - * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints) - */ -void ATimingService::exitTo(int current, int to, bool handler) { - while (current!=to) { - switch (current) { - case STATE_Operational: - this->history[STATE_TOP] = STATE_Operational; - current = STATE_TOP; - break; - } - } -} - -/** - * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data - * matching the trigger of this chain. The ID of the final state is returned - * @param chain - the chain ID - * @param generic_data - the generic data pointer - * @return the ID of the final state - */ -int ATimingService::executeTransitionChain(int chain, const InterfaceItemBase* ifitem, void* generic_data) { - switch (chain) { - case CHAIN_TRANS_INITIAL_TO__Operational: - { - action_TRANS_INITIAL_TO__Operational(); - return STATE_Operational; - } - case CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1: - { - uint32 time = ((uint32) generic_data); - action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(ifitem, time); - return STATE_Operational; - } - case CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3: - { - uint32 time = ((uint32) generic_data); - action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(ifitem, time); - return STATE_Operational; - } - case CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4: - { - action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(ifitem); - return STATE_Operational; - } - } - return NO_STATE; -} - -/** - * calls entry codes while entering a state's history. The ID of the final leaf state is returned - * @param state - the state which is entered - * @param handler - entry code is executed if not handler - * @return - the ID of the final leaf state - */ -int ATimingService::enterHistory(int state, bool handler, bool skip_entry) { - while (true) { - switch (state) { - case STATE_Operational: - if (!(skip_entry || handler)) entry_Operational(); - // in leaf state: return state id - return STATE_Operational; - case STATE_TOP: - state = this->history[STATE_TOP]; - break; - } - skip_entry = false; - } - //return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) -} - -void ATimingService::executeInitTransition() { - int chain = CHAIN_TRANS_INITIAL_TO__Operational; - int next = ATimingService::executeTransitionChain(chain, 0, 0); - next = ATimingService::enterHistory(next, false, false); - setState(next); -} - -/* receiveEvent contains the main implementation of the FSM */ -void ATimingService::receiveEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) { - int trigger = (ifitem==0)? POLLING : ifitem->getLocalId() + EVT_SHIFT*evt; - int chain = NOT_CAUGHT; - int catching_state = NO_STATE; - bool is_handler = false; - bool skip_entry = false; - - if (!handleSystemEvent(ifitem, evt, generic_data)) { - switch (getState()) { - case STATE_Operational: - switch(trigger) { - case POLLING: - do_Operational(); - break; - case TRIG_timer__startTimeout: - { - chain = CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1; - catching_state = STATE_TOP; - } - break; - case TRIG_timer__startTimer: - { - chain = CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3; - catching_state = STATE_TOP; - } - break; - case TRIG_timer__kill: - { - chain = CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4; - catching_state = STATE_TOP; - } - break; - } - break; - } - } - if (chain != NOT_CAUGHT) { - ATimingService::exitTo(getState(), catching_state, is_handler); - int next = ATimingService::executeTransitionChain(chain, ifitem, generic_data); - next = ATimingService::enterHistory(next, is_handler, skip_entry); - setState(next); - } -} - -//****************************************** -// END of generated code for FSM -//****************************************** diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h deleted file mode 100644 index 9b48f789f..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h +++ /dev/null @@ -1,262 +0,0 @@ - /** - * @author generated by eTrice - * - * Header File of ActorClass ATimingService - * - */ - - #ifndef _ATIMINGSERVICE_H_ - #define _ATIMINGSERVICE_H_ - - #include "platforms/generic/etDatatypes.h" - #include "common/messaging/IRTObject.h" - #include "common/modelbase/PortBase.h" - #include "common/modelbase/InterfaceItemBase.h" - #include "common/modelbase/ActorClassBase.h" - #include "common/modelbase/SubSystemClassBase.h" - #include "common/messaging/Address.h" - #include "common/messaging/IMessageReceiver.h" - #include "common/debugging/DebuggingService.h" - #include <string> - #include <vector> - - - #include "room/basic/service/timing/PTimer.h" - - - /*--------------------- begin user code ---------------------*/ - - #include "common/platform/etTimer.h" - #define ET_NB_OF_TCBS 10 - typedef struct etTCB etTimerControlBlock; - struct etTCB { - etTargetTime_t expTime; - etTargetTime_t pTime; - int32 portIdx; - etTimerControlBlock* next; - }; - - /*--------------------- end user code ---------------------*/ - - - class ATimingService : public etRuntime::ActorClassBase { - - - protected: - //--------------------- ports - //--------------------- saps - //--------------------- services - PTimerReplPort timer; - - //--------------------- interface item IDs - typedef enum { - IFITEM_timer = 1, - } interface_items; - - /*--------------------- attributes ---------------------*/ - etTimerControlBlock tcbs[10]; - etTimerControlBlock* usedTcbsRoot; - etTimerControlBlock* freeTcbsRoot; - - /*--------------------- operations ---------------------*/ - etTimerControlBlock* getTcb() { - - etTimerControlBlock* temp = freeTcbsRoot; - - if(freeTcbsRoot!=0) { - freeTcbsRoot=freeTcbsRoot->next; - temp->next=0; - } - return temp; - } - void returnTcb(etTimerControlBlock* block) { - - block->next=freeTcbsRoot; - freeTcbsRoot=block; - } - void removeTcbFromUsedList(int32 idx) { - - etTimerControlBlock* temp=usedTcbsRoot; - etTimerControlBlock* temp2=usedTcbsRoot; - - if (temp==0) return; - - if (usedTcbsRoot->portIdx == idx){ - // element found, the first one - usedTcbsRoot = usedTcbsRoot->next; - returnTcb(temp); - return; - } - - temp=temp->next; - while(temp!=0){ - if(temp->portIdx==idx){ - temp2->next=temp->next; - returnTcb(temp); - return; - }else{ - // try next - temp2=temp; - temp=temp->next; - } - } - } - void putTcbToUsedList(etTimerControlBlock* block) { - - etTimerControlBlock* temp=usedTcbsRoot; - etTimerControlBlock* temp2=usedTcbsRoot; - - if (temp==0){ - // list empty put new block to root - block->next=0; - usedTcbsRoot=block; - return; - } - - while(1){ - if (temp != 0){ - if (isTimeGreater(&block->expTime,&temp->expTime)){ - //try next position - temp2=temp; - temp=temp->next; - }else{ - // right position found - block->next=temp; - if(temp==usedTcbsRoot){ - usedTcbsRoot=block; - }else{ - temp2->next=block; - } - return; - } - }else{ - // end of list reached - block->next=0; - temp2->next=block; - return; - } - } - } - bool isTimeGreater(etTargetTime_t* t1, etTargetTime_t* t2) { - - if (t1->sec > t2->sec) return TRUE; - if (t1->sec < t2->sec) return FALSE; - if (t1->nSec > t2->nSec) return TRUE; - return FALSE; - } - void addTime(etTargetTime_t* t1, etTargetTime_t* t2) { - - t1->sec += t2->sec; - t1->nSec += t2->nSec; - while(t1->nSec >= 1000000000L){ - t1->sec++; - t1->nSec-=1000000000L; - } - } - void printList() { - - etTimerControlBlock* temp=usedTcbsRoot; - printf("list: "); - while (temp!=0){ - printf("(%ld,%ld),",temp->expTime.sec,temp->expTime.nSec); - temp=temp->next; - } - printf("\n"); - } - - public: - //--------------------- construction - ATimingService(etRuntime::IRTObject* parent, std::string name, const std::vector<std::vector<etRuntime::Address> >& port_addr, - const std::vector<std::vector<etRuntime::Address> >& peer_addr); - - //--------------------- port getters - PTimerReplPort getTimer (){ - return this->timer; - } - - //--------------------- lifecycle functions - virtual void init(); - virtual void start(); - virtual void stop(); - virtual void destroy(); - - /* state IDs */ - typedef enum { - STATE_Operational = 2, - } state_ids; - - /* transition chains */ - typedef enum { - CHAIN_TRANS_INITIAL_TO__Operational = 1, - CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1 = 2, - CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3 = 3, - CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4 = 4, - } chain_ids; - - /* triggers */ - typedef enum { - POLLING = 0, - TRIG_timer__kill = IFITEM_timer + EVT_SHIFT*PTimer::IN_kill, - TRIG_timer__startTimeout = IFITEM_timer + EVT_SHIFT*PTimer::IN_startTimeout, - TRIG_timer__startTimer = IFITEM_timer + EVT_SHIFT*PTimer::IN_startTimer, - } triggers; - - protected: - static std::string s_stateStrings[]; - static const int s_numberOfStates; - - private: - void setState(int new_state); - - /* Entry and Exit Codes */ - void entry_Operational(); - void do_Operational(); - - /* Action Codes */ - void action_TRANS_INITIAL_TO__Operational(); - void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const etRuntime::InterfaceItemBase* ifitem, uint32 time); - void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(const etRuntime::InterfaceItemBase* ifitem, uint32 time); - void action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(const etRuntime::InterfaceItemBase* ifitem); - - private: - /** - * calls exit codes while exiting from the current state to one of its - * parent states while remembering the history - * @param current - the current state - * @param to - the final parent state - * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints) - */ - void exitTo(int current, int to, bool handler); - - /** - * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data - * matching the trigger of this chain. The ID of the final state is returned - * @param chain - the chain ID - * @param generic_data - the generic data pointer - * @return the ID of the final state - */ - int executeTransitionChain(int chain, const etRuntime::InterfaceItemBase* ifitem, void* generic_data); - - /** - * calls entry codes while entering a state's history. The ID of the final leaf state is returned - * @param state - the state which is entered - * @param handler - entry code is executed if not handler - * @return - the ID of the final leaf state - */ - int enterHistory(int state, bool handler, bool skip_entry); - - public: - - void executeInitTransition(); - - /* receiveEvent contains the main implementation of the FSM */ - void receiveEvent(etRuntime::InterfaceItemBase* ifitem, int evt, void* generic_data); - - /*--------------------- begin user code ---------------------*/ - //uc2 - /*--------------------- end user code ---------------------*/ - - }; - - - #endif /* _ATIMINGSERVICE_H_ */ diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp deleted file mode 100644 index 7672294d1..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp +++ /dev/null @@ -1,242 +0,0 @@ - /** - * @author generated by eTrice - * - * Source File of ProtocolClass PTimer - * - */ - - #include "PTimer.h" - #include "common/debugging/DebuggingService.h" - #include <iostream> - - using namespace etRuntime; - - - /*--------------------- begin user code ---------------------*/ - //uc2 - /*--------------------- end user code ---------------------*/ - - //------------------------------------------------------------------------------------------------------------ - // port class - //------------------------------------------------------------------------------------------------------------ - - PTimerPort::PTimerPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress, bool doRegistration) - : PortBase(actor, parent, name, localId, 0, addr, peerAddress) - { - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } - } - - PTimerPort::PTimerPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress, bool doRegistration) - : PortBase(actor, parent, name, localId, idx, addr, peerAddress) - { - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } - } - - void PTimerPort::receive(Message* msg) { - if (! PTimer::isValidIncomingEvtID(msg->getEvtId())) { - std::cout << "unknown" << std::endl; - } - else { - if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag - DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), PTimer::getMessageString(msg->getEvtId())); - } - - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); - } - }; - - - // sent messages - void PTimerPort::timeout() { - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - PTimer::getMessageString(PTimer::OUT_timeout)); - if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(), PTimer::OUT_timeout)); - } - } - - - //------------------------------------------------------------------------------------------------------------ - // replicated port class - //------------------------------------------------------------------------------------------------------------ - PTimerReplPort::PTimerReplPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) - : m_replication(addr.size()), - m_ports() - { - char numstr[10]; // enough to hold all numbers up to 32-bits - - m_ports = reinterpret_cast<PTimerPort*> (new char[sizeof(PTimerPort) * addr.size()]); - for (int i = 0; i < m_replication; ++i) { - snprintf(numstr, sizeof(numstr), "%d", i); - //placement new to avoid copy construction, therefore no vector is used - new (&m_ports[i]) PTimerPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]); - } - }; - - - // outgoing messages - void PTimerReplPort::timeout(){ - for (int i=0; i<m_replication; ++i) { - m_ports[i].timeout(); - } - } - //------------------------------------------------------------------------------------------------------------ - // conjugated port class - //------------------------------------------------------------------------------------------------------------ - - PTimerConjPort::PTimerConjPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, Address addr, Address peerAddress, bool doRegistration) - : PortBase(actor, parent, name, localId, 0, addr, peerAddress), - status(0) - { - // initialize attributes - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } - } - - PTimerConjPort::PTimerConjPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, Address addr, Address peerAddress, bool doRegistration) - : PortBase(actor, parent, name, localId, idx, addr, peerAddress), - status(0) - { - // initialize attributes - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } - } - - void PTimerConjPort::receive(Message* msg) { - if (! PTimer::isValidOutgoingEvtID(msg->getEvtId())) { - std::cout << "unknown" << std::endl; - } - else { - if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag - DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), PTimer::getMessageString(msg->getEvtId())); - } - - switch (msg->getEvtId()) { - case PTimer::OUT_timeout: - { - - //TODO: clear active bit in case of single shot timer - if (status!=0){ - if (status==ET_TIMER_RUNNING){ - // single shot timer - status=0; - } - // msg to fsm - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); - } - } - break; - default: - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); - break; - } - } - }; - - /*--------------------- operations ---------------------*/ - - // sent messages - void PTimerConjPort::startTimer(uint32 time) { - - if (status==0){ - status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC; - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - PTimer::getMessageString(PTimer::IN_startTimer)); - if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimer, - reinterpret_cast<void*>(time), - sizeof(uint32))); - } - } - } - - void PTimerConjPort::startTimeout(uint32 time) { - - if (status==0){ - status = ET_TIMER_RUNNING; - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - PTimer::getMessageString(PTimer::IN_startTimeout)); - if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_startTimeout, - reinterpret_cast<void*>(time), - sizeof(uint32))); - } - } - } - - void PTimerConjPort::kill() { - - if (status!=0){ - status=0; - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - PTimer::getMessageString(PTimer::IN_kill)); - if (getPeerAddress().isValid()){ - getPeerMsgReceiver()->receive(new Message(getPeerAddress(),PTimer::IN_kill, 0, 0)); - } - } - } - - - //------------------------------------------------------------------------------------------------------------ - // conjugated replicated port class - //------------------------------------------------------------------------------------------------------------ - PTimerConjReplPort::PTimerConjReplPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<Address> addr, std::vector<Address> peerAddress) - : m_replication(addr.size()), - m_ports() - { - char numstr[10]; // enough to hold all numbers up to 32-bits - - m_ports = reinterpret_cast<PTimerConjPort*> (new char[sizeof(PTimerConjPort) * addr.size()]); - for (int i = 0; i < m_replication; ++i) { - snprintf(numstr, sizeof(numstr), "%d", i); - //placement new to avoid copy construction, therefore no vector is used - new (&m_ports[i]) PTimerConjPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]); - } - }; - - - // outgoing messages - void PTimerConjReplPort::startTimer(uint32 time){ - for (int i=0; i<m_replication; ++i) { - m_ports[i].startTimer( time); - } - } - void PTimerConjReplPort::startTimeout(uint32 time){ - for (int i=0; i<m_replication; ++i) { - m_ports[i].startTimeout( time); - } - } - void PTimerConjReplPort::kill(){ - for (int i=0; i<m_replication; ++i) { - m_ports[i].kill(); - } - } - - /*--------------------- debug helpers */ - - /* message names as strings for debugging (generate MSC) */ - std::string PTimer::s_messageStrings[] - = {"MIN", - "timeout", - "startTimer", - "startTimeout", - "kill", - "MAX"}; - - std::string PTimer::getMessageString(int msg_id) { - if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) { - return s_messageStrings[msg_id]; - } else { - // id out of range - return "Message ID out of range"; - } - } - - - diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h deleted file mode 100644 index d98ea2520..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @author generated by eTrice - * - * Header File of ProtocolClass PTimer - * - */ - -#ifndef _PTIMER_H_ -#define _PTIMER_H_ - -#include "platforms/generic/etDatatypes.h" -#include "common/messaging/IRTObject.h" -#include "common/modelbase/PortBase.h" -#include "common/modelbase/InterfaceItemBase.h" -#include "common/messaging/Address.h" -#include "common/messaging/Message.h" -#include <vector> -#include <string> - -namespace etRuntime { - class IEventReceiver; - -} - -/*--------------------- begin user code ---------------------*/ - - #define ET_TIMER_RUNNING 0x01 - #define ET_TIMER_PERIODIC 0x02 - -/*--------------------- end user code ---------------------*/ - - -class PTimer { - public: - /* message IDs */ - typedef enum { - MSG_MIN = 0, - OUT_timeout = 1, - IN_startTimer = 2, - IN_startTimeout = 3, - IN_kill = 4, - MSG_MAX = 5, - } msg_ids; - static bool isValidEvtID(int evtId) { - return ((MSG_MIN < evtId) && (evtId < MSG_MAX)); - }; - static bool isValidOutgoingEvtID(int evtId) { - return ((MSG_MIN < evtId) && (evtId < IN_startTimer)); - }; - static bool isValidIncomingEvtID(int evtId) { - return ((IN_startTimer <= evtId) && (evtId < MSG_MAX)); - }; - static std::string getMessageString(int msg_id); - - private: - static std::string s_messageStrings[]; - /*--------------------- begin user code ---------------------*/ - //uc2 - /*--------------------- end user code ---------------------*/ -}; - -//------------------------------------------------------------------------------------------------------------ -// port class -//------------------------------------------------------------------------------------------------------------ -class PTimerPort : public etRuntime::PortBase { - public: - // constructors - PTimerPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); - PTimerPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); - - virtual void receive(etRuntime::Message* m); - - // outgoing messages - public: void timeout(); -}; - -//------------------------------------------------------------------------------------------------------------ -// replicated port class -//------------------------------------------------------------------------------------------------------------ -class PTimerReplPort { - private: - int m_replication; - PTimerPort* m_ports; //dynamic array used instead of vector to avoid copy construction - - public: - PTimerReplPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress); - virtual ~PTimerReplPort() {}; - - int getReplication() { return m_replication; } - int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx(); } - PTimerPort get(int i) {return m_ports[i];} - - // outgoing messages - public: void timeout(); - -}; -//------------------------------------------------------------------------------------------------------------ -// conjugated port class -//------------------------------------------------------------------------------------------------------------ -class PTimerConjPort : public etRuntime::PortBase { - public: - // constructors - PTimerConjPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); - PTimerConjPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, int idx, etRuntime::Address addr, etRuntime::Address peerAddress, bool doRegistration = true); - - virtual void receive(etRuntime::Message* m); - /*--------------------- attributes ---------------------*/ - int8 status; - /*--------------------- operations ---------------------*/ - - // outgoing messages - public: void startTimer(uint32 time); - public: void startTimeout(uint32 time); - public: void kill(); -}; - -//------------------------------------------------------------------------------------------------------------ -// conjugated replicated port class -//------------------------------------------------------------------------------------------------------------ -class PTimerConjReplPort { - private: - int m_replication; - PTimerConjPort* m_ports; //dynamic array used instead of vector to avoid copy construction - - public: - PTimerConjReplPort(etRuntime::IEventReceiver& actor, etRuntime::IRTObject* parent, std::string name, int localId, std::vector<etRuntime::Address> addr, std::vector<etRuntime::Address> peerAddress); - virtual ~PTimerConjReplPort() {}; - - int getReplication() { return m_replication; } - int getIndexOf(const etRuntime::InterfaceItemBase& ifitem){ return ifitem.getIdx(); } - PTimerConjPort get(int i) {return m_ports[i];} - - // outgoing messages - public: void startTimer(uint32 time); - public: void startTimeout(uint32 time); - public: void kill(); - -}; -#endif /* _PTIMER_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject index 4b64a3634..e08c4b926 100644 --- a/runtime/org.eclipse.etrice.runtime.c/.cproject +++ b/runtime/org.eclipse.etrice.runtime.c/.cproject @@ -15,13 +15,13 @@ </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919." name="/" resourcePath=""> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.592670815" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.801787195" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> @@ -43,6 +43,8 @@ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/util}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/platforms/MT_WIN_MinGW}""/> </option> + <option id="gnu.c.compiler.option.dialect.std.1095860550" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c99" valueType="enumerated"/> + <option id="gnu.c.compiler.option.warnings.pedantic.1900907598" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.316560634" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.2104156208" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> @@ -70,11 +72,11 @@ </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> @@ -97,6 +99,8 @@ </option> <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1123878180" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/> <option id="gnu.c.compiler.option.debugging.level.878097472" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.dialect.std.706501680" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c99" valueType="enumerated"/> + <option id="gnu.c.compiler.option.warnings.pedantic.1531135222" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="false" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2145340965" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.base.148289955" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> @@ -129,15 +133,15 @@ </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.18376023" name="ExternalMakefile" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.18376023" name="ExternalMakefile" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.18376023." name="/" resourcePath=""> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.1317763190" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.1009481846" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> @@ -178,17 +182,17 @@ </storageModule> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="refreshScope" versionNumber="2"> - <configuration configurationName="WindowsMinGW"/> - <configuration configurationName="LinuxPosix"/> - <configuration configurationName="MinGWDebug"> + <configuration configurationName="ExternalMakefile"> <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.c"/> </configuration> - <configuration configurationName="ExternalMakefile"> + <configuration configurationName="MinGWDebug"> <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.c"/> </configuration> + <configuration configurationName="WindowsMinGW"/> <configuration configurationName="Debug"> <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.c"/> </configuration> + <configuration configurationName="LinuxPosix"/> </storageModule> <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> <storageModule moduleId="scannerConfiguration"> diff --git a/runtime/org.eclipse.etrice.runtime.c/.gitignore b/runtime/org.eclipse.etrice.runtime.c/.gitignore index 811cd3775..d81a69793 100644 --- a/runtime/org.eclipse.etrice.runtime.c/.gitignore +++ b/runtime/org.eclipse.etrice.runtime.c/.gitignore @@ -2,5 +2,3 @@ bin src-gen-info WindowsMinGW LinuxPosix -/MinGWDebug/ -/PosixDebug/ diff --git a/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile b/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile index 1c3586189..69efa78f5 100644 --- a/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile +++ b/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile @@ -1,9 +1,12 @@ +## Example Makefile + # environment variables: RUNTIME_ROOTDIR, MODELLIB_ROOTDIR, TARGET_PLATFORM, TARGET_BUILD_DIR, ECLIPSE_MODE # default is windows mingw -# CDT Environment: +# examples CDT Environment: # RUNTIME_ROOTDIR: ${workspace_loc:org.eclipse.etrice.runtime.c} # MODELLIB_ROOTDIR: ${workspace_loc:org.eclipse.etrice.modellib.c} +# ECLIPSE_MODE (no value) ifeq ($(strip ${RUNTIME_ROOTDIR}),) RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.c diff --git a/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk b/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk index fa93315de..4c06f5e56 100644 --- a/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk +++ b/runtime/org.eclipse.etrice.runtime.c/buildTools/Makefile.mk @@ -15,7 +15,9 @@ # IN_LDLIBS # IN_PREREQS -# Note: Variables set from environment or make parameter are unmodifiable. +# Note: avoid trailing spaces ! + +# Note: Variables from environment or cmd are unmodifiable. # E.g. use additional variables: # IN_SRCDIRS_REC += ${APP_SRCDIRS_REC} # IN_SRCDIRS_REC += ... @@ -50,6 +52,7 @@ endef ifeq ($(strip ${IN_BUILD_DIR}),) +# TODO: TARGET_BUILD_DIR should not be here IN_BUILD_DIR := ${TARGET_BUILD_DIR} endif @@ -73,6 +76,7 @@ M_OBJS := M_SOURCES := $(call CANONICAL_PATH, ${M_SOURCES}) M_SOURCES += $(call CANONICAL_PATH,$(foreach DIR,${IN_SRCDIRS_REC},$(call REC_FILE_SEARCH,${DIR}/,*.c))) +M_SOURCES += $(call CANONICAL_PATH,$(foreach DIR,${IN_SRCDIRS_REC},$(call REC_FILE_SEARCH,${DIR}/,*.cpp))) M_OBJS += $(addprefix ${M_BUILD_DIR}/,$(addsuffix .o,$(basename ${M_SOURCES}))) M_DEFS := $(addprefix -D,${M_DEFS}) @@ -85,6 +89,10 @@ ${M_BUILD_DIR}/%.o: %.c $(strip ${CC} -o $@ -c ${M_CFLAGS} ${M_SRC_CFLAGS} ${M_INCDIRS} \ ${M_SRC_INCDIRS} ${M_SRC_DEFS} ${M_DEFS} $<) +${M_BUILD_DIR}/%.o: %.cpp + @mkdir -p $(dir $@) + $(strip ${CXX} -o $@ -c ${M_CFLAGS} ${M_SRC_CFLAGS} ${M_INCDIRS} \ + ${M_SRC_INCDIRS} ${M_SRC_DEFS} ${M_DEFS} $<) .PHONY: build clean-all diff --git a/runtime/org.eclipse.etrice.runtime.c/buildTools/defaults.mk b/runtime/org.eclipse.etrice.runtime.c/buildTools/defaults.mk index a8543042d..4692d3c8b 100644 --- a/runtime/org.eclipse.etrice.runtime.c/buildTools/defaults.mk +++ b/runtime/org.eclipse.etrice.runtime.c/buildTools/defaults.mk @@ -3,7 +3,7 @@ # MODELLIB_ROOTDIR e.g. ${workspace_loc:org.eclipse.etrice.modellib.c} default: ../org.eclipse.etrice.modellib.c # TARGET_PLATFORM MT_WIN_MinGW|MT_POSIX_GENERIC_GCC default MT_WIN_MinGW # TARGET_BUILD_DIR automatically derived from TARGET_PLATFORM -# ECLIPSE_MODE if set, makefile won't build modellib and runtime (let eclipse handle this) +# ECLIPSE_MODE if present, makefile won't build modellib and runtime (let eclipse handle this) #ifeq ($(strip ${RUNTIME_ROOTDIR}),) # RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.c diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h index 2c9c386bf..a4bb8c0c2 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h @@ -17,6 +17,9 @@ * * \author: tschuetz */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _ETLOGGER_H_ #define _ETLOGGER_H_ @@ -93,3 +96,7 @@ void etLogger_logInfoF(const char* format, ... ); void etLogger_fprintf(etFileHandle file, const char* format, ... ); #endif /* _ETLOGGER_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h index 294068261..90f583d60 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h @@ -13,6 +13,9 @@ /* * Generic version for most platforms based on std. */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _ETSTDDATATYPES_H_ #define _ETSTDDATATYPES_H_ @@ -30,7 +33,7 @@ /* --- Data types for room.basic.types */ -// bool already defined +/* bool already defined */ typedef uint8_t uint8; typedef uint16_t uint16; typedef uint32_t uint32; @@ -58,11 +61,11 @@ typedef char* charPtr; /*--- Cross language support (e.g. Java,C/C++) */ #define null NULL -// typedef x boolean +/* typedef x boolean */ /*-----------------------------------------------------------*/ -//--- Required types of runtime +/*--- Required types of runtime */ typedef bool etBool; #define ET_TRUE true #define ET_FALSE false @@ -115,3 +118,7 @@ typedef etInt16 etAddressId; /*-----------------------------------------------------------*/ #endif /* _ETSTDDATATYPES_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h index 99c5bb3e0..ff1902cac 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h @@ -19,6 +19,9 @@ * * \author Thomas Schuetz */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _ETUNIT_H_ #define _ETUNIT_H_ @@ -387,4 +390,7 @@ void expectOrderEnd(etInt16 id, const char* msg, etInt16 identifier, const char* #endif /* _ETUNIT_H_ */ +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h index 27d0c1118..ec7ae3634 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h @@ -18,6 +18,9 @@ * * \author Thomas Schuetz, Thomas Jung */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _ETMUTEX_H_ #define _ETMUTEX_H_ @@ -56,3 +59,7 @@ void etMutex_enter(etMutex* self); void etMutex_leave(etMutex* self); #endif /* _ETMUTEX_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h index 6642f69a3..8c2fefb3b 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h @@ -9,6 +9,9 @@ * Thomas Schuetz (initial contribution) * *******************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _ETSEMA_H_ #define _ETSEMA_H_ @@ -57,3 +60,7 @@ void etSema_waitForWakeup(etSema* self); #endif /* _ETSEMA_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h index 310ecc76a..a50017b55 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h @@ -17,6 +17,9 @@ * * \author Henrik Rentz-Reichert */ +#ifdef __cplusplus +extern "C" { +#endif #ifndef _ETTCPSOCKETS_H_ #define _ETTCPSOCKETS_H_ @@ -173,3 +176,7 @@ etSocketError etWriteSocket(etSocketConnectionData* self, int size, const int8* etSocketError etCloseSocket(etSocketConnectionData* self); #endif /* _ETTCPSOCKETS_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h index a176f9d6a..980ccc476 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h @@ -18,6 +18,10 @@ * \author Thomas Schuetz, Thomas Jung * */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _ETTHREAD_H_ #define _ETTHREAD_H_ @@ -97,3 +101,7 @@ etOSThreadId etThread_self_id(void); #endif /* _ETTHREAD_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h index fa51d50ed..75dab0edd 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h @@ -18,6 +18,10 @@ * \author Thomas Schuetz */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _ETTIME_H_ #define _ETTIME_H_ @@ -43,3 +47,7 @@ typedef struct etTime { void getTimeFromTarget(etTime *t); #endif /* _ETTIME_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h index 827c2a025..da9bdd228 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h @@ -17,6 +17,10 @@ * * \author Thomas Jung */ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _ETTIMER_H_ #define _ETTIMER_H_ @@ -70,3 +74,7 @@ void etTimer_destruct(etTimer* self); #endif /* __ETTIMER_H__ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h index a2bc7901e..d5b23e25c 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h @@ -10,6 +10,10 @@ * *******************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _ETRUNTIME_H_ #define _ETRUNTIME_H_ @@ -31,3 +35,7 @@ etSema* etRuntime_getTerminateSemaphore(); #endif /* _ETRUNTIME_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h index 8adfcda08..057d23a06 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h @@ -10,6 +10,10 @@ * *******************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + #ifndef _ETDATATYPES_H_ #define _ETDATATYPES_H_ @@ -50,3 +54,7 @@ typedef DWORD etOSTimerId; /*-----------------------------------------------------------*/ #endif /* _DATATYPES_H_ */ + +#ifdef __cplusplus +} +#endif diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.cproject b/runtime/org.eclipse.etrice.runtime.cpp/.cproject index 4f8cb2d71..30dee99a2 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/.cproject +++ b/runtime/org.eclipse.etrice.runtime.cpp/.cproject @@ -1,32 +1,39 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?fileVersion 4.0.0?> - -<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> <storageModule moduleId="org.eclipse.cdt.core.settings"> <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176"> - <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" moduleId="org.eclipse.cdt.core.settings" name="Debug"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" moduleId="org.eclipse.cdt.core.settings" name="WindowsMinGW"> <externalSettings> <externalSetting> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/Debug"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <configuration artifactExtension="a" artifactName="org.eclipse.etrice.runtime.cpp" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176." name="/" resourcePath=""> <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.1964804313" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.1363258846" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> - <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.765054146" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp}/WindowsMinGW" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1145162516" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.778368249" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug"> <option id="gnu.both.asm.option.include.paths.479529629" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/platforms/generic}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> </option> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1431383431" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> @@ -35,86 +42,206 @@ <option id="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level.143629884" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1636571561" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> <option id="gnu.cpp.compiler.option.include.paths.371088988" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/platforms/generic}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> + <option id="gnu.cpp.compiler.option.dialect.std.1515882877" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.1054188764" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" value="true" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.834970834" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.787652226" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug"> <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.1338147333" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/> <option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.1088652134" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> - <option id="gnu.c.compiler.option.include.paths.181765143" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/platforms/generic}""/> - </option> + <option id="gnu.c.compiler.option.include.paths.181765143" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths"/> + <option id="gnu.c.compiler.option.dialect.std.1365070354" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.c90" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1322245631" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.833683108" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.1619419934" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/> </toolChain> </folderInfo> - <sourceEntries> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> - </sourceEntries> </configuration> </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> </cconfiguration> - <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536"> - <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536" moduleId="org.eclipse.cdt.core.settings" name="Release"> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605" moduleId="org.eclipse.cdt.core.settings" name="ExternalMakefile"> <externalSettings> <externalSetting> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/Release"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/ExternalMakefile"/> <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> </externalSetting> </externalSettings> <extensions> - <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536" name="Release" parent="cdt.managedbuild.config.gnu.mingw.lib.release"> - <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536." name="/" resourcePath=""> - <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.release.341416755" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.release"> - <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.release.2033657787" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.release"/> - <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.629737011" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> - <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release.1791075014" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.release"> - <option id="gnu.both.asm.option.include.paths.227502240" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths"/> - <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1768068662" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605" name="ExternalMakefile" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.lib.debug.735358268" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.lib.debug"> + <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.lib.debug.2132346692" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.lib.debug"/> + <builder id="cdt.managedbuild.target.gnu.builder.base.1131223063" incrementalBuildTarget="build" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="false" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug.1357671675" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.lib.debug"> + <option id="gnu.both.asm.option.include.paths.1612643425" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.781438692" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug.1704674283" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1456609015" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug"> + <option id="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level.1551264069" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level.1612652495" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.1116549066" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> + </option> + <option id="gnu.cpp.compiler.option.dialect.std.54663605" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.773921974" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> </tool> - <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release.633341399" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.lib.release"/> - <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release.567360588" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.release"> - <option id="gnu.cpp.compiler.mingw.lib.release.option.optimization.level.584961348" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> - <option id="gnu.cpp.compiler.mingw.lib.release.option.debugging.level.1368123052" name="Debug Level" superClass="gnu.cpp.compiler.mingw.lib.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.include.paths.763277987" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/platforms/generic}""/> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.1803237789" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.lib.debug.option.optimization.level.1470653893" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.debug.option.optimization.level" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.lib.debug.option.debugging.level.1112819348" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.363472888" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1785503496" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.1808349437" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.1692521571" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.18376023" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/ExternalMakefile"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/buildTools"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079" moduleId="org.eclipse.cdt.core.settings" name="LinuxPosix"> + <externalSettings> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactExtension="a" artifactName="org.eclipse.etrice.runtime.cpp" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079" name="LinuxPosix" parent="cdt.managedbuild.config.gnu.mingw.lib.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.base.1080791615" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base"> + <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1780203952" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp}/LinuxPosix" id="cdt.managedbuild.target.gnu.builder.base.41376769" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.archiver.base.300346113" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.920787132" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"> + <option id="gnu.cpp.compiler.option.include.paths.891996885" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src-gen}""/> </option> - <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1712453980" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + <option id="gnu.cpp.compiler.option.optimization.level.1821469380" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.debugging.level.1846925677" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.dialect.std.1819612545" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.791879755" superClass="gnu.cpp.compiler.option.warnings.pedantic" value="true" valueType="boolean"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.385161260" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> </tool> - <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.2143016498" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release"> - <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.lib.release.option.optimization.level.180068255" name="Optimization Level" superClass="gnu.c.compiler.mingw.lib.release.option.optimization.level" valueType="enumerated"/> - <option id="gnu.c.compiler.mingw.lib.release.option.debugging.level.1290753638" name="Debug Level" superClass="gnu.c.compiler.mingw.lib.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> - <option id="gnu.c.compiler.option.include.paths.1098867338" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/platforms/generic}""/> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.466073081" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.806058339" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/> + <option id="gnu.c.compiler.option.debugging.level.1967435041" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.1517993666" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths"/> + <option id="gnu.c.compiler.option.dialect.std.1890958235" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1511381686" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.base.634106669" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.512982776" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.base.1329449959" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"> + <option id="gnu.both.asm.option.include.paths.989539875" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> </option> - <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1857566126" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.322790476" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> - <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.base.536323295" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.base"/> - <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base.2051974509" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base"/> </toolChain> </folderInfo> - <sourceEntries> - <entry excluding="src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> - </sourceEntries> </configuration> </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919.294295052" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/LinuxPosix"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> </cconfiguration> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> @@ -124,6 +251,10 @@ <configuration configurationName="Release"> <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp"/> </configuration> + <configuration configurationName="ExternalMakefile"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp"/> + </configuration> + <configuration configurationName="WindowsMinGW"/> <configuration configurationName="Debug"> <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp"/> </configuration> @@ -132,12 +263,24 @@ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> <storageModule moduleId="scannerConfiguration"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079.;cdt.managedbuild.tool.gnu.cpp.compiler.base.920787132;cdt.managedbuild.tool.gnu.cpp.compiler.input.385161260"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1456609015;cdt.managedbuild.tool.gnu.cpp.compiler.input.773921974"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.1803237789;cdt.managedbuild.tool.gnu.c.compiler.input.1785503496"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.lib.debug.1516705340;cdt.managedbuild.tool.gnu.cpp.compiler.input.834970834"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/> </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.release.1265017536;cdt.managedbuild.config.gnu.mingw.lib.release.1265017536.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.release.2143016498;cdt.managedbuild.tool.gnu.c.compiler.input.1857566126"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.190433079.;cdt.managedbuild.tool.gnu.c.compiler.base.466073081;cdt.managedbuild.tool.gnu.c.compiler.input.1511381686"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.lib.debug.878140176;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.;cdt.managedbuild.tool.gnu.c.compiler.mingw.lib.debug.787652226;cdt.managedbuild.tool.gnu.c.compiler.input.1322245631"> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> </scannerConfigBuildInfo> diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.gitignore b/runtime/org.eclipse.etrice.runtime.cpp/.gitignore index 9904774eb..9f090e11d 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/.gitignore +++ b/runtime/org.eclipse.etrice.runtime.cpp/.gitignore @@ -1,2 +1,4 @@ +WindowsMinGW +LinuxPosix bin -Debug +src-gen-info diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.project b/runtime/org.eclipse.etrice.runtime.cpp/.project index 3dbf92d9e..7e25bb85d 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/.project +++ b/runtime/org.eclipse.etrice.runtime.cpp/.project @@ -3,6 +3,7 @@ <name>org.eclipse.etrice.runtime.cpp</name> <comment></comment> <projects> + <project>org.eclipse.etrice.runtime.c</project> </projects> <buildSpec> <buildCommand> diff --git a/runtime/org.eclipse.etrice.runtime.cpp/.settings/org.eclipse.cdt.core.prefs b/runtime/org.eclipse.etrice.runtime.cpp/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 000000000..eda368335 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/ECLIPSE_MODE/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/ECLIPSE_MODE/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/ECLIPSE_MODE/value=true +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.c} +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/append=true +environment/project/cdt.managedbuild.config.gnu.mingw.lib.debug.878140176.1748792605/appendContributed=true diff --git a/runtime/org.eclipse.etrice.runtime.cpp/Makefile b/runtime/org.eclipse.etrice.runtime.cpp/Makefile new file mode 100644 index 000000000..3c22c6779 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/Makefile @@ -0,0 +1,18 @@ +ifeq ($(strip ${RUNTIME_ROOTDIR}),) + RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.c +endif + +include ${RUNTIME_ROOTDIR}/buildTools/runtime.mk + +CPP_RUNTIME_INCDIRS := ./src ./src-gen + +IN_TARGET := lib$(notdir $(shell pwd)).a +IN_INCDIRS += ${CPP_RUNTIME_INCDIRS} +IN_SRCDIRS_REC := ${CPP_RUNTIME_INCDIRS} +CC = ${CXX} +IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall + +include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk + + + diff --git a/runtime/org.eclipse.etrice.runtime.cpp/buildTools/Makefile b/runtime/org.eclipse.etrice.runtime.cpp/buildTools/Makefile new file mode 100644 index 000000000..f0610a164 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/buildTools/Makefile @@ -0,0 +1,32 @@ +# environment variables: RUNTIME_ROOTDIR, MODELLIB_ROOTDIR, TARGET_PLATFORM, TARGET_BUILD_DIR, ECLIPSE_MODE +# default is windows mingw + +# CDT Environment: +# RUNTIME_ROOTDIR: ${workspace_loc:org.eclipse.etrice.runtime.c} +# MODELLIB_ROOTDIR: ${workspace_loc:org.eclipse.etrice.modellib.c} +# ECLIPSE_MODE (no value) + +ifeq ($(strip ${RUNTIME_ROOTDIR}),) + RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.c +endif +ifeq ($(strip ${CPP_MODELLIB_ROOTDIR}),) + CPP_MODELLIB_ROOTDIR := ../org.eclipse.etrice.modellib.cpp +endif +ifeq ($(strip ${CPP_RUNTIME_ROOTDIR}),) + CPP_RUNTIME_ROOTDIR := ../org.eclipse.etrice.runtime.cpp +endif + +include ${CPP_MODELLIB_ROOTDIR}/buildTools/modellib.mk +include ${CPP_RUNTIME_ROOTDIR}/buildTools/runtime.mk + +# --- +IN_TARGET := $(notdir $(shell pwd)).exe +IN_INCDIRS += ./src-gen ./src +IN_SRCDIRS_REC += ./src-gen ./src +CC = ${CXX} +IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall +#--- + + +# Create rules +include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk diff --git a/runtime/org.eclipse.etrice.runtime.cpp/buildTools/runtime.mk b/runtime/org.eclipse.etrice.runtime.cpp/buildTools/runtime.mk new file mode 100644 index 000000000..6a615e677 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/buildTools/runtime.mk @@ -0,0 +1,30 @@ +include ${RUNTIME_ROOTDIR}/buildTools/defaults.mk + +# Includes +CPP_RUNTIME_INCDIRS := ${CPP_RUNTIME_ROOTDIR}/src ${CPP_RUNTIME_ROOTDIR}/src-gen + + +IN_INCDIRS += ${CPP_RUNTIME_INCDIRS} + +IN_LDFLAGS += -L${CPP_RUNTIME_ROOTDIR}/${TARGET_BUILD_DIR} +IN_LDLIBS += -lorg.eclipse.etrice.runtime.cpp +ifeq ($(strip ${ECLIPSE_MODE}),) + IN_PREREQS += liborg.eclipse.etrice.runtime.cpp.a +endif + +liborg.eclipse.etrice.runtime.cpp.a: + ${MAKE} -C ${CPP_RUNTIME_ROOTDIR} build + +clean_liborg.eclipse.etrice.runtime.cpp.a: + ${MAKE} -C ${CPP_RUNTIME_ROOTDIR} clean + +include ${RUNTIME_ROOTDIR}/buildTools/runtime.mk + + + + + + + + + diff --git a/runtime/org.eclipse.etrice.runtime.cpp/gen_runtime.launch b/runtime/org.eclipse.etrice.runtime.cpp/gen_runtime.launch new file mode 100644 index 000000000..8c58d1f30 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/gen_runtime.launch @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.etrice.generator.launch.cpp.launchConfigurationType"> +<booleanAttribute key="DataLogging" value="false"/> +<booleanAttribute key="Debug" value="false"/> +<booleanAttribute key="GenDocumentation" value="false"/> +<booleanAttribute key="GenInstanceDiagram" value="false"/> +<stringAttribute key="GenModelPath" value=""/> +<booleanAttribute key="Lib" value="true"/> +<booleanAttribute key="MSC" value="true"/> +<listAttribute key="ModelFiles"> +<listEntry value="${workspace_loc:/org.eclipse.etrice.runtime.cpp/model/SystemServices.room}"/> +</listAttribute> +<booleanAttribute key="OverrideDirectories" value="false"/> +<booleanAttribute key="SaveGenModel" value="false"/> +<booleanAttribute key="UseTranslation" value="true"/> +<booleanAttribute key="Verbose" value="false"/> +</launchConfiguration> diff --git a/runtime/org.eclipse.etrice.runtime.cpp/model/SystemServices.room b/runtime/org.eclipse.etrice.runtime.cpp/model/SystemServices.room new file mode 100644 index 000000000..f6949ddef --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/model/SystemServices.room @@ -0,0 +1,9 @@ +RoomModel common.modelbase { + ProtocolClass RTSystemServicesProtocol { + incoming { + Message executeInitialTransition() + Message startDebugging() + Message stopDebugging() + } + } +}
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src-gen/common/modelbase/RTSystemServicesProtocol.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src-gen/common/modelbase/RTSystemServicesProtocol.cpp new file mode 100644 index 000000000..55276e76f --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src-gen/common/modelbase/RTSystemServicesProtocol.cpp @@ -0,0 +1,161 @@ +/** + * @author generated by eTrice + * + * Source File of ProtocolClass RTSystemServicesProtocol + * + */ + +#include "RTSystemServicesProtocol.h" + +#include <common/debugging/DebuggingService.h> +#include <common/messaging/AbstractMessageReceiver.h> +#include <common/messaging/Address.h> +#include <common/messaging/Message.h> +#include <common/modelbase/IEventReceiver.h> +#include <iostream> +#include <iterator> +#include <string> +#include <vector> + +using namespace etRuntime; + + + +/* message names as strings for debugging (generate MSC) */ +const std::string RTSystemServicesProtocol::s_messageStrings[] = {"MIN", "executeInitialTransition","startDebugging","stopDebugging","MAX"}; + +const std::string& RTSystemServicesProtocol::getMessageString(int msg_id) { + if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) { + return s_messageStrings[msg_id]; + } else { + // id out of range + static const std::string errorMsg = "Message ID out of range"; + return errorMsg; + } +} + +//------------------------------------------------------------------------------------------------------------ +// port class +//------------------------------------------------------------------------------------------------------------ + +RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IInterfaceItemOwner* actor, const std::string& name, int localId) : + PortBase(actor, name, localId, 0) +{ + DebuggingService::getInstance().addPortInstance(*this); +} + +RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx) : + PortBase(actor, name, localId, idx) +{ + DebuggingService::getInstance().addPortInstance(*this); +} + +void RTSystemServicesProtocolPort::destroy() { + DebuggingService::getInstance().removePortInstance(*this); + PortBase::destroy(); +} + +void RTSystemServicesProtocolPort::receive(const Message* msg) { + // TODO JH further + if (! RTSystemServicesProtocol::isValidIncomingEvtID(msg->getEvtId())) { + std::cout << "unknown" << std::endl; + } + + DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId())); + + getActor()->receiveEvent(this, msg->getEvtId(), msg->getData()); +} + + +// sent messages + +//------------------------------------------------------------------------------------------------------------ +// replicated port class +//------------------------------------------------------------------------------------------------------------ +RTSystemServicesProtocolReplPort::RTSystemServicesProtocolReplPort(IInterfaceItemOwner* actor, const std::string& name, int localId) : + ReplicatedPortBase(actor, name, localId) +{ +} + +// outgoing messages +//------------------------------------------------------------------------------------------------------------ +// conjugated port class +//------------------------------------------------------------------------------------------------------------ + +RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IInterfaceItemOwner* actor, const std::string& name, int localId) : + PortBase(actor, name, localId, 0) +{ + DebuggingService::getInstance().addPortInstance(*this); +} + +RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx) : + PortBase(actor, name, localId, idx) +{ + DebuggingService::getInstance().addPortInstance(*this); +} + +void RTSystemServicesProtocolConjPort::destroy() { + DebuggingService::getInstance().removePortInstance(*this); + PortBase::destroy(); +} + +void RTSystemServicesProtocolConjPort::receive(const Message* msg) { + // TODO JH further + if (! RTSystemServicesProtocol::isValidOutgoingEvtID(msg->getEvtId())) { + std::cout << "unknown" << std::endl; + } + + DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId())); + + getActor()->receiveEvent(this, msg->getEvtId(), msg->getData()); +} + + +// sent messages +void RTSystemServicesProtocolConjPort::executeInitialTransition() { + DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), + RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_executeInitialTransition)); + if (getPeerAddress().isValid()){ + getPeerMsgReceiver()->receive(new Message(getPeerAddress(), RTSystemServicesProtocol::IN_executeInitialTransition)); + } +} +void RTSystemServicesProtocolConjPort::startDebugging() { + DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), + RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_startDebugging)); + if (getPeerAddress().isValid()){ + getPeerMsgReceiver()->receive(new Message(getPeerAddress(), RTSystemServicesProtocol::IN_startDebugging)); + } +} +void RTSystemServicesProtocolConjPort::stopDebugging() { + DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), + RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_stopDebugging)); + if (getPeerAddress().isValid()){ + getPeerMsgReceiver()->receive(new Message(getPeerAddress(), RTSystemServicesProtocol::IN_stopDebugging)); + } +} + +//------------------------------------------------------------------------------------------------------------ +// conjugated replicated port class +//------------------------------------------------------------------------------------------------------------ +RTSystemServicesProtocolConjReplPort::RTSystemServicesProtocolConjReplPort(IInterfaceItemOwner* actor, const std::string& name, int localId) : + ReplicatedPortBase(actor, name, localId) +{ +} + +// incoming messages +void RTSystemServicesProtocolConjReplPort::executeInitialTransition(){ + for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) { + (dynamic_cast<RTSystemServicesProtocolConjPort*>(*it))->executeInitialTransition(); + } +} +void RTSystemServicesProtocolConjReplPort::startDebugging(){ + for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) { + (dynamic_cast<RTSystemServicesProtocolConjPort*>(*it))->startDebugging(); + } +} +void RTSystemServicesProtocolConjReplPort::stopDebugging(){ + for (std::vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) { + (dynamic_cast<RTSystemServicesProtocolConjPort*>(*it))->stopDebugging(); + } +} + diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src-gen/common/modelbase/RTSystemServicesProtocol.h b/runtime/org.eclipse.etrice.runtime.cpp/src-gen/common/modelbase/RTSystemServicesProtocol.h new file mode 100644 index 000000000..69c914db8 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src-gen/common/modelbase/RTSystemServicesProtocol.h @@ -0,0 +1,127 @@ +/** + * @author generated by eTrice + * + * Header File of ProtocolClass RTSystemServicesProtocol + * + */ + +#ifndef _RTSYSTEMSERVICESPROTOCOL_H_ +#define _RTSYSTEMSERVICESPROTOCOL_H_ + +#include <common/modelbase/InterfaceItemBase.h> +#include <common/modelbase/PortBase.h> +#include <common/modelbase/ReplicatedInterfaceItemBase.h> +#include <common/modelbase/ReplicatedPortBase.h> +#include <etDatatypes.h> +#include <string> + + + +class RTSystemServicesProtocol { + public: + /* message IDs */ + typedef enum { + MSG_MIN = 0, + IN_executeInitialTransition = 1, + IN_startDebugging = 2, + IN_stopDebugging = 3, + MSG_MAX = 4 + } msg_ids; + + + static bool isValidEvtID(int evtId) { + return ((MSG_MIN < evtId) && (evtId < MSG_MAX)); + } + static bool isValidOutgoingEvtID(int evtId) { + return ((MSG_MIN < evtId) && (evtId < IN_executeInitialTransition)); + } + static bool isValidIncomingEvtID(int evtId) { + return ((IN_executeInitialTransition <= evtId) && (evtId < MSG_MAX)); + } + static const std::string& getMessageString(int msg_id); + + private: + static const std::string s_messageStrings[]; + + +}; + +//------------------------------------------------------------------------------------------------------------ +// port class +//------------------------------------------------------------------------------------------------------------ +class RTSystemServicesProtocolPort : public etRuntime::PortBase { + public: + RTSystemServicesProtocolPort(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId); + RTSystemServicesProtocolPort(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId, int idx); + + virtual void destroy(); + + virtual void receive(const etRuntime::Message* m); + + + // sent messages +}; + +//------------------------------------------------------------------------------------------------------------ +// replicated port class +//------------------------------------------------------------------------------------------------------------ +class RTSystemServicesProtocolReplPort : public etRuntime::ReplicatedPortBase { + + public: + RTSystemServicesProtocolReplPort(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId); + + int getReplication() const { return getNInterfaceItems(); } + int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); } + RTSystemServicesProtocolPort& get(int idx) const { return *dynamic_cast<RTSystemServicesProtocolPort*>(getInterfaceItem(idx)); } + + // outgoing messages + + protected: + virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) { + return new RTSystemServicesProtocolPort(rcv, name, lid, idx); + } + +}; +//------------------------------------------------------------------------------------------------------------ +// conjugated port class +//------------------------------------------------------------------------------------------------------------ +class RTSystemServicesProtocolConjPort : public etRuntime::PortBase { + public: + RTSystemServicesProtocolConjPort(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId); + RTSystemServicesProtocolConjPort(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId, int idx); + + virtual void destroy(); + + virtual void receive(const etRuntime::Message* m); + + + // sent messages + public: void executeInitialTransition(); + public: void startDebugging(); + public: void stopDebugging(); +}; + +//------------------------------------------------------------------------------------------------------------ +// conjugated replicated port class +//------------------------------------------------------------------------------------------------------------ +class RTSystemServicesProtocolConjReplPort : public etRuntime::ReplicatedPortBase { + + public: + RTSystemServicesProtocolConjReplPort(etRuntime::IInterfaceItemOwner* actor, const std::string& name, int localId); + + int getReplication() const { return getNInterfaceItems(); } + int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); } + RTSystemServicesProtocolConjPort& get(int idx) const { return *dynamic_cast<RTSystemServicesProtocolConjPort*>(getInterfaceItem(idx)); } + + // incoming messages + public: void executeInitialTransition(); + public: void startDebugging(); + public: void stopDebugging(); + + protected: + virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) { + return new RTSystemServicesProtocolConjPort(rcv, name, lid, idx); + } + +}; +#endif /* _RTSYSTEMSERVICESPROTOCOL_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src-gen/readme.txt b/runtime/org.eclipse.etrice.runtime.cpp/src-gen/readme.txt new file mode 100644 index 000000000..1dc2b35ab --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src-gen/readme.txt @@ -0,0 +1,4 @@ +This directory is an eTrice code generation target. +It will be erased every time the generator is executed. + +DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp index ed8c11e57..89a8bc6dd 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.cpp @@ -10,67 +10,97 @@ * *******************************************************************************/ - #include "DebuggingService.h" + #include "common/modelbase/ActorClassBase.h" +#include "common/modelbase/SubSystemClassBase.h" +#include "common/modelbase/PortBase.h" #include <iostream> namespace etRuntime { -DebuggingService* DebuggingService::s_instance = 0; +DebuggingService& DebuggingService::getInstance() { + static DebuggingService instance; + + return instance; +} + +DebuggingService::DebuggingService() : + m_asyncLogger(), + m_syncLogger(), + m_portInstances() { +} + +const PortBase* DebuggingService::getPort(const Address& address) const { + std::map<Address, const PortBase*>::const_iterator it = m_portInstances.find(address); + if (it != m_portInstances.end()) + return it->second; -DebuggingService::DebuggingService() -: asyncLogger() , - syncLogger(), - portInstances() -{ + return 0; } -DebuggingService::~DebuggingService() { +void DebuggingService::addMessageAsyncOut(const Address& source, const Address& target, const std::string& msg) { + const PortBase* srcPort = getPort(source); + const PortBase* tgtPort = getPort(target); + if (srcPort != 0 && tgtPort != 0) + m_asyncLogger.addMessageAsyncOut(srcPort->getActor()->getInstancePath(), tgtPort->getActor()->getInstancePath(), + msg); + } +void DebuggingService::addMessageAsyncIn(const Address& source, const Address& target, const std::string& msg) { + const PortBase* srcPort = getPort(source); + const PortBase* tgtPort = getPort(target); + if (srcPort != 0 && tgtPort != 0) + m_asyncLogger.addMessageAsyncIn(srcPort->getActor()->getInstancePath(), tgtPort->getActor()->getInstancePath(), + msg); +} -void DebuggingService::addMessageAsyncOut(Address source, Address target, - const std::string& msg) { - asyncLogger.addMessageAsyncOut(portInstances.at(source)->getActorPath(), - portInstances.at(target)->getActorPath(), msg); +void DebuggingService::addMessageSyncCall(const Address& source, const Address& target, const std::string& msg) { + const PortBase* srcPort = getPort(source); + const PortBase* tgtPort = getPort(target); + if (srcPort != 0 && tgtPort != 0) + m_asyncLogger.addMessageSyncCall(srcPort->getActor()->getInstancePath(), tgtPort->getActor()->getInstancePath(), + msg); } -void DebuggingService::addMessageAsyncIn(Address source, Address target, - const std::string& msg) { - asyncLogger.addMessageAsyncIn(portInstances.at(source)->getActorPath(), - portInstances.at(target)->getActorPath(), msg); +void DebuggingService::addMessageSyncReturn(const Address& source, const Address& target, const std::string& msg) { + const PortBase* srcPort = getPort(source); + const PortBase* tgtPort = getPort(target); + if (srcPort != 0 && tgtPort != 0) + m_asyncLogger.addMessageSyncReturn(srcPort->getActor()->getInstancePath(), + tgtPort->getActor()->getInstancePath(), msg); } -void DebuggingService::addMessageSyncCall(Address source, Address target, - const std::string& msg) { - asyncLogger.addMessageSyncCall(portInstances.at(source)->getActorPath(), - portInstances.at(target)->getActorPath(), msg); +void DebuggingService::addActorState(const ActorClassBase& actor, const std::string& state) { + m_asyncLogger.addActorState(actor.getInstancePath(), state); } -void DebuggingService::addMessageSyncReturn(Address source, Address target, - const std::string& msg) { - asyncLogger.addMessageSyncReturn(portInstances.at(source)->getActorPath(), - portInstances.at(target)->getActorPath(), msg); +void DebuggingService::addMessageActorCreate(const SubSystemClassBase& parent, const std::string& refName) { + m_asyncLogger.addMessageActorCreate(parent.getInstancePath(), + parent.getInstancePath() + IRTObject::PATH_DELIM + refName); } -void DebuggingService::addActorState(const ActorClassBase& actor, - const std::string& state) { - asyncLogger.addActorState(actor.getInstancePath(), state); +void DebuggingService::addMessageActorCreate(const ActorClassBase& parent, const std::string& refName) { + m_asyncLogger.addMessageActorCreate(parent.getInstancePath(), + parent.getInstancePath() + IRTObject::PATH_DELIM + refName); } -void DebuggingService::addPortInstance(PortBase& port) { - portInstances[port.getAddress()] = &port; - std::cout << "adding " << port.getAddress().toID() << " " << &port << " " << port.getParent()->getInstancePathName()<< std::endl; +void DebuggingService::addMessageActorDestroy(const ActorClassBase& inst) { + //if (!(inst.getParent() instanceof OptionalActorInterfaceBase)) + m_asyncLogger.addMessageActorDestroy(inst.getParent()->getInstancePath(), inst.getInstancePath()); } -MSCLogger& DebuggingService::getSyncLogger() { - return syncLogger; +void DebuggingService::addVisibleComment(const std::string& comment) { + m_asyncLogger.addVisibleComment(comment); } -MSCLogger& DebuggingService::getAsyncLogger() { - return asyncLogger; +void DebuggingService::addPortInstance(const PortBase& port) { + m_portInstances[port.getAddress()] = &port; } +void DebuggingService::removePortInstance(const PortBase& port) { + m_portInstances.erase(port.getAddress()); +} } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h index 872eabf6c..c7ef3e6fe 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/DebuggingService.h @@ -13,55 +13,54 @@ #ifndef DEBUGGINGSERVICE_H_ #define DEBUGGINGSERVICE_H_ -#include "common/messaging/Address.h" #include "common/debugging/MSCLogger.h" -#include "common/modelbase/PortBase.h" +#include "common/messaging/Address.h" +#include "etDatatypes.h" #include <string> #include <map> namespace etRuntime { - class ActorClassBase; +class ActorClassBase; +class SubSystemClassBase; +class PortBase; class DebuggingService { -private: - static DebuggingService* s_instance; public: - virtual ~DebuggingService(); - - static DebuggingService& getInstance() { - if (s_instance == 0) { - s_instance = new DebuggingService(); - } - return *s_instance; - } - - void addMessageAsyncOut(Address source, Address target, const std::string& msg); - void addMessageAsyncIn(Address source, Address target, const std::string& msg); - void addMessageSyncCall(Address source, Address target, const std::string& msg); - void addMessageSyncReturn(Address source, Address target, const std::string& msg); + virtual ~DebuggingService() {} + + static DebuggingService& getInstance(); + + void addMessageAsyncOut(const Address& source, const Address& target, const std::string& msg); + void addMessageAsyncIn(const Address& source, const Address& target, const std::string& msg); + void addMessageSyncCall(const Address& source, const Address& target, const std::string& msg); + void addMessageSyncReturn(const Address& source, const Address& target, const std::string& msg); void addActorState(const ActorClassBase& actor, const std::string& state); - void addPortInstance(PortBase& port); - MSCLogger& getSyncLogger(); - MSCLogger& getAsyncLogger(); + void addMessageActorCreate(const SubSystemClassBase& parent, const std::string& refName); + void addMessageActorCreate(const ActorClassBase& parent, const std::string& refName); + void addMessageActorDestroy(const ActorClassBase& inst); + void addVisibleComment(const std::string& comment); + void addPortInstance(const PortBase& port); + void removePortInstance(const PortBase& port); + + MSCLogger& getSyncLogger() { return m_syncLogger; } + MSCLogger& getAsyncLogger() { return m_asyncLogger; } private: - MSCLogger asyncLogger; - MSCLogger syncLogger; - std::map<Address, PortBase*> portInstances; + MSCLogger m_asyncLogger; + MSCLogger m_syncLogger; + std::map<Address, const PortBase*> m_portInstances; + + const PortBase* getPort(const Address& address) const; DebuggingService(); - DebuggingService(const DebuggingService& right); - DebuggingService& operator=(const DebuggingService& right); + DebuggingService(DebuggingService const&); + DebuggingService& operator=(DebuggingService const&); }; } /* namespace etRuntime */ #endif /* DEBUGGINGSERVICE_H_ */ - - - - diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp index d720bbe5e..d38c20679 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.cpp @@ -10,25 +10,26 @@ * *******************************************************************************/ -#include "MSCFilter.h" +#include "common/debugging/MSCFilter.h" +#include "etStdDatatypes.h" +#include <list> +#include <string> namespace etRuntime { MSCFilter::MSCFilter() : filterList() { } -MSCFilter::~MSCFilter() { -} void MSCFilter::addFilter(FilterItem filter) { filterList.push_back(filter); } -bool MSCFilter::applyTo(const std::string& text) { +etBool MSCFilter::applyTo(const std::string& text) { if (filterList.empty()) return true; // no filters -> all messages will be logged std::list<FilterItem>::iterator it = filterList.begin(); - for ( ; it != filterList.end(); ++it) { + for (; it != filterList.end(); ++it) { if (text.compare((*it).filter) == 0) return !(*it).exclude; } diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h index 917feb460..52067ed0f 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCFilter.h @@ -13,6 +13,7 @@ #ifndef MSCFILTER_H_ #define MSCFILTER_H_ +#include "etStdDatatypes.h" #include <list> #include <string> @@ -20,23 +21,24 @@ namespace etRuntime { class MSCFilter { public: - class FilterItem{ + class FilterItem { public: - FilterItem(const std::string& filter_, bool exclude_) - : exclude(exclude_), - filter(filter_) - {}; - bool exclude; + FilterItem(const std::string& filter_, etBool exclude_) : + exclude(exclude_), + filter(filter_) { + } + etBool exclude; std::string filter; private: FilterItem(); }; MSCFilter(); - virtual ~MSCFilter(); + virtual ~MSCFilter() { + } void addFilter(FilterItem filter); - bool applyTo(const std::string& text); + etBool applyTo(const std::string& text); std::string reduceString(const std::string& string); private: diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp index 5ecb0354d..60f853f22 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.cpp @@ -10,95 +10,134 @@ * *******************************************************************************/ -#include "MSCLogger.h" +#include "common/debugging/MSCFilter.h" +#include "common/debugging/MSCLogger.h" +#include "debugging/etLogger.h" +#include "etDatatypes.h" +#include <list> +#include <string> namespace etRuntime { -MSCLogger::MSCLogger() -: commandList(), - filter(0), - path(), - msc_name(), -is_open(false) -{ +MSCLogger::MSCLogger() : + m_commandList(), + m_filter(0), + m_path(), + m_msc_name(), + m_is_open(false) { + etMutex_construct(&m_mutex); } MSCLogger::~MSCLogger() { - delete filter; - filter = 0; + delete m_filter; + m_filter = 0; + etMutex_destruct(&m_mutex); } -void MSCLogger::setMSC(const std::string& msc_name_, const std::string& path_) { - msc_name = msc_name_; - path = path_; - delete filter; - filter = new MSCFilter(); +void MSCLogger::setMSC(const std::string& msc_name, const std::string& path) { + m_msc_name = msc_name; + m_path = path; + delete m_filter; + m_filter = new MSCFilter(); } -void MSCLogger::addMessageAsyncOut(const std::string& source, const std::string& target, - const std::string& message) { +void MSCLogger::open() { + etMutex_enter(&m_mutex); + m_is_open = true; + etMutex_leave(&m_mutex); +} + +void MSCLogger::addMessageAsyncOut(const std::string& source, const std::string& target, const std::string& message) { + etMutex_enter(&m_mutex); createLine(source, " >-- ", target, message); + etMutex_leave(&m_mutex); } -void MSCLogger::addMessageAsyncIn(const std::string& source, const std::string& target, - const std::string& message) { +void MSCLogger::addMessageAsyncIn(const std::string& source, const std::string& target, const std::string& message) { + etMutex_enter(&m_mutex); createLine(source, " --> ", target, message); + etMutex_leave(&m_mutex); } -void MSCLogger::addMessageSyncCall(const std::string& source, const std::string& target, - const std::string& message) { +void MSCLogger::addMessageSyncCall(const std::string& source, const std::string& target, const std::string& message) { + etMutex_enter(&m_mutex); createLine(source, " ==> ", target, message); + etMutex_leave(&m_mutex); } -void MSCLogger::addMessageSyncReturn(const std::string& source, const std::string& target, - const std::string& message) { +void MSCLogger::addMessageSyncReturn(const std::string& source, const std::string& target, const std::string& message) { + etMutex_enter(&m_mutex); createLine(source, " <== ", target, message); + etMutex_leave(&m_mutex); +} + +void MSCLogger::addMessageActorCreate(const std::string& source, const std::string& target) { + etMutex_enter(&m_mutex); + createLine(source, " (!) ", target, ""); + etMutex_leave(&m_mutex); +} + +void MSCLogger::addMessageActorDestroy(const std::string& source, const std::string& target) { + etMutex_enter(&m_mutex); + createLine(source, " (X) ", target, ""); + etMutex_leave(&m_mutex); +} + +void MSCLogger::addNote(const std::string& actor, const std::string& note) { + etMutex_enter(&m_mutex); + //if (filter.applyTo(actor)) + getCommandList().push_back("\t" + m_filter->reduceString(actor) + " note: " + note); + etMutex_leave(&m_mutex); +} + +void MSCLogger::addMessageCreate(const std::string& source, const std::string& target) { + etMutex_enter(&m_mutex); + createLine(source, " (!) ", target, ""); + etMutex_leave(&m_mutex); } void MSCLogger::addActorState(const std::string& actor, const std::string& state) { - if (filter->applyTo(actor)) - commandList.push_back("\t" + filter->reduceString(actor) + " >>> " + state); + etMutex_enter(&m_mutex); + //if (filter->applyTo(actor)) + getCommandList().push_back("\t" + m_filter->reduceString(actor) + " >>> " + state); + etMutex_leave(&m_mutex); } -void MSCLogger::createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message) { - if (filter->applyTo(source) && filter->applyTo(target)) { - commandList.push_back( "\t"+filter->reduceString(source)+mid+filter->reduceString(target)+ " " + message); - } +void MSCLogger::addVisibleComment(const std::string& comment) { + etMutex_enter(&m_mutex); + getCommandList().push_back("# " + comment); + etMutex_leave(&m_mutex); +} + +void MSCLogger::createLine(const std::string& source, const std::string& mid, const std::string& target, + const std::string& message) { + //if (filter->applyTo(source) && filter->applyTo(target)) { + getCommandList().push_back( + "\t" + m_filter->reduceString(source) + mid + m_filter->reduceString(target) + " " + message); } void MSCLogger::close() { - if (is_open) { -// try { - //TODO: error handling - // Create file - std::ofstream myfile; - //TODO: where to create the file - // std::string dir = "tmp/log"; doesn't work on windows - std::string dir = ""; - myfile.open (std::string(dir + path + msc_name + ".seq").c_str(), std::ios::out); - if (myfile.is_open()) { /* ok, proceed with output */ - saveMSCforTrace2UML(myfile); - myfile.close(); - } -// }; + if (m_is_open) { + std::string path = m_path + m_msc_name + ".seq"; + etFileHandle handle = etLogger_fopen(path.c_str(), "w+"); + etMutex_enter(&m_mutex); + if (handle != 0) { + saveMSCforTrace2UML(handle); + etLogger_fclose(handle); + } } - is_open = false; + m_is_open = false; + etMutex_leave(&m_mutex); } -void MSCLogger::saveMSCforTrace2UML(std::ofstream& out) { - //try { - //TODO: errorhandling - out << "#generated MSC for Trace2UML"; - out << std::endl ; - std::list<std::string>::iterator it = commandList.begin(); - for ( ; it != commandList.end(); ++it) { - out << (*it) << std::endl; - } -// } catch (IOException e) { -// System.err.println("Error: " + e.getMessage()); -// } +void MSCLogger::saveMSCforTrace2UML(etFileHandle handle) { + etLogger_fprintf(handle, "; generated MSC for Trace2UML\n"); + std::list<std::string>::iterator it = getCommandList().begin(); + for (; it != getCommandList().end(); ++it){ + etLogger_fprintf(handle, (*it).c_str()); + etLogger_fprintf(handle, "\n"); + } } - } diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h index 01499863d..0074598d8 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/debugging/MSCLogger.h @@ -13,49 +13,53 @@ #ifndef MSCLOGGER_H_ #define MSCLOGGER_H_ -#include <string> -#include <list> +#include "osal/etMutex.h" #include <iostream> -#include <fstream> -#include "MSCFilter.h" +#include <list> +#include <string> namespace etRuntime { +class MSCFilter; + class MSCLogger { public: MSCLogger(); virtual ~MSCLogger(); - void setMSC(const std::string& msc_name_, const std::string& path_); + void setMSC(const std::string& msc_name, const std::string& path); - //TODO synchronized - void open() {is_open = true; }; - //TODO synchronized + /* synchronized */ + void open(); void addMessageAsyncOut(const std::string& source, const std::string& target, const std::string& message); - //TODO synchronized void addMessageAsyncIn(const std::string& source, const std::string& target, const std::string& message); - //TODO synchronized void addMessageSyncCall(const std::string& source, const std::string& target, const std::string& message); - //TODO synchronized void addMessageSyncReturn(const std::string& source, const std::string& target, const std::string& message); - //TODO synchronized + void addMessageActorCreate(const std::string& source, const std::string& target); + void addMessageActorDestroy(const std::string& source, const std::string& target); + void addNote(const std::string& actor, const std::string& note); + void addMessageCreate(const std::string& source, const std::string& target); void addActorState(const std::string& actor, const std::string& state); - //TODO synchronized + void addVisibleComment(const std::string& comment); void close(); + /* --- */ - const std::list<std::string>& getCommandList() { return commandList; }; - MSCFilter* getMSCFilter(){ return filter; }; + std::list<std::string>& getCommandList() { return m_commandList; }; + MSCFilter* getMSCFilter(){ return m_filter; }; private: + void createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message); - void saveMSCforTrace2UML(std::ofstream& out); + void saveMSCforTrace2UML(etFileHandle handle); + + std::list<std::string> m_commandList; + MSCFilter* m_filter; - std::list<std::string> commandList; - MSCFilter* filter; + std::string m_path; + std::string m_msc_name ; + etBool m_is_open; - std::string path; - std::string msc_name ; - bool is_open; + etMutex m_mutex; MSCLogger(const MSCLogger& right); MSCLogger& operator=(const MSCLogger& right); diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h index 7086a8ac3..d4a8f7897 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageReceiver.h @@ -23,26 +23,38 @@ namespace etRuntime { class AbstractMessageReceiver: public RTObject, public virtual IMessageReceiver { public: - Address getAddress() const { + + virtual ~AbstractMessageReceiver() {} + + virtual const Address& getAddress() const { return m_address; } - virtual ~AbstractMessageReceiver() {}; protected: - AbstractMessageReceiver(IRTObject* parent, Address address, std::string name) - : IMessageReceiver(), - RTObject(parent, name), - m_address(address) - { + AbstractMessageReceiver(IRTObject* parent, const std::string& name) : + RTObject(parent, name), + m_address(Address::EMPTY) { + } + + AbstractMessageReceiver(IRTObject* parent, const Address& address, const std::string& name) : + RTObject(parent, name), + m_address(address) { + } + + void setAddress(const Address& address) { + m_address = address; + } + virtual std::string toString() const { + return getName() + " " + m_address.toID(); } private: Address m_address; - AbstractMessageReceiver(); + AbstractMessageReceiver(AbstractMessageReceiver const&); + AbstractMessageReceiver& operator=(AbstractMessageReceiver const&); }; - } #endif /* ABSTRACTMESSAGERECEIVER_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageService.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageService.cpp new file mode 100644 index 000000000..a52351d1b --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageService.cpp @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +#include "common/messaging/AbstractMessageService.h" +#include <string> + +namespace etRuntime { + +AbstractMessageService::AbstractMessageService(IRTObject* parent, const std::string& name, int node, int thread) : + RTObject(parent, name), + m_address(node, thread, 0), + m_messageQueue(this, "Queue"), + m_messageDispatcher(this, m_address.createInc(), "Dispatcher") { +} + +Address AbstractMessageService::getFreeAddress() { + return m_messageDispatcher.getFreeAddress(); +} + +void AbstractMessageService::freeAddress(const Address& addr) { + m_messageDispatcher.freeAddress(addr); +} + +void AbstractMessageService::addMessageReceiver(IMessageReceiver& receiver) { + m_messageDispatcher.addMessageReceiver(receiver); +} + +void AbstractMessageService::removeMessageReceiver(IMessageReceiver& receiver) { + m_messageDispatcher.removeMessageReceiver(receiver); +} + +void AbstractMessageService::addPollingMessageReceiver(IMessageReceiver& receiver) { + m_messageDispatcher.addPollingMessageReceiver(receiver); +} + +void AbstractMessageService::removePollingMessageReceiver(IMessageReceiver& receiver) { + m_messageDispatcher.removePollingMessageReceiver(receiver); +} + +void AbstractMessageService::receive(const Message* msg) { + if (msg != 0) { + m_messageQueue.push(const_cast<Message*>(msg)); + } +} + +std::string AbstractMessageService::toString() const { + return getName() + " " + getAddress().toID(); +} + +} diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageService.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageService.h new file mode 100644 index 000000000..08032faf6 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/AbstractMessageService.h @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MESSAGING_ABSTRACTMESSAGESERVICE_H_ +#define SRC_COMMON_MESSAGING_ABSTRACTMESSAGESERVICE_H_ + +#include "common/messaging/Address.h" +#include "common/messaging/IMessageService.h" +#include "common/messaging/MessageDispatcher.h" +#include "common/messaging/MessageSeQueue.h" +#include <string> + +namespace etRuntime { + +class AbstractMessageService: public RTObject, public IMessageService { + +public: + virtual ~AbstractMessageService() {} + + virtual const Address& getAddress() const { return m_address; } + + virtual Address getFreeAddress(); + + virtual void freeAddress(const Address& addr); + + virtual void addMessageReceiver(IMessageReceiver& receiver); + virtual void removeMessageReceiver(IMessageReceiver& receiver); + + virtual void addPollingMessageReceiver(IMessageReceiver& receiver); + virtual void removePollingMessageReceiver(IMessageReceiver& receiver); + virtual void receive(const Message* msg); + +protected: + AbstractMessageService(IRTObject* parent, const std::string& name, int node, int thread); + + MessageSeQueue& getMessageQueue() { + return m_messageQueue; + } + MessageDispatcher& getMessageDispatcher() { + return m_messageDispatcher; + } + + std::string toString() const; + +private: + // TODO: add internal message queue for less locks (faster thread internal + // messaging) + Address m_address; + MessageSeQueue m_messageQueue; + MessageDispatcher m_messageDispatcher; + + AbstractMessageService(); + AbstractMessageService(AbstractMessageService const&); + AbstractMessageService& operator=(AbstractMessageService const&); +}; + +} +#endif /* SRC_COMMON_MESSAGING_ABSTRACTMESSAGESERVICE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp index 4adbf895e..2f622f31f 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.cpp @@ -10,34 +10,48 @@ * *******************************************************************************/ -#include "Address.h" -#include <sstream> -#include <iostream> +#include "common/messaging/Address.h" +#include <string> namespace etRuntime { +const Address Address::EMPTY(0, 0, 0); + Address::Address(int nodeID, int threadID, int objectID) : m_nodeID(nodeID), m_threadID(threadID), m_objectID(objectID) { -}; +} Address::Address(const Address & right) : m_nodeID(right.m_nodeID), m_threadID(right.m_threadID), m_objectID(right.m_objectID) { -}; +} -Address & Address::operator = (const Address& right) { +Address::~Address() { + *this = EMPTY; +} + +Address& Address::operator=(const Address& right) { if (this != &right) { - m_nodeID = right.m_nodeID; + m_nodeID = right.m_nodeID; m_threadID = right.m_threadID; m_objectID = right.m_objectID; } - return *this; + return *this; +} + +bool Address::operator==(const Address& right) const { + return m_nodeID == right.m_nodeID && m_threadID == right.m_threadID && m_objectID == right.m_objectID; } -bool Address::operator< (const Address& right) const { +bool Address::operator!=(const Address& right) const { + return !(*this == right); +} + +// needed for ordered containers e.g. std::map +bool Address::operator<(const Address& right) const { if (m_nodeID == right.m_nodeID) { if (m_threadID == right.m_threadID) { return (m_objectID < right.m_objectID); @@ -51,37 +65,15 @@ bool Address::operator< (const Address& right) const { } } -Address::~Address() { -} - -std::string Address::toString() const{ - std::stringstream strm; - strm << "Address(nodeID=" << m_nodeID - << ",threadID=" << m_threadID << ",objectID=" << m_objectID+")"; - return strm.str(); -} -std::string Address::toID() const{ - std::stringstream strm; - strm << m_nodeID << "_" << m_threadID << "_" << m_objectID; - return strm.str(); -} +std::string Address::toID() const { + char buffer[50]; + sprintf(buffer, "%i_%i_%i", m_nodeID, m_threadID, m_objectID); -Address Address::createInc(int i) { - return Address(m_nodeID, m_threadID, m_objectID+i); + return std::string(buffer); } -void Address::printAddrVector(const std::vector<std::vector<etRuntime::Address> >& addresses){ - std::vector<std::vector<etRuntime::Address> >::const_iterator outerIt = addresses.begin(); - std::cout << "{" ; - for (int i=0; outerIt!= addresses.end(); ++outerIt,++i) { - std::cout << "{" ; - std::vector<etRuntime::Address>::const_iterator it = (*outerIt).begin(); - for (int j=0; it!=(*outerIt).end(); ++it,++j) { - std::cout << (*it).toID() << ":" << addresses[i][j].toID() << ","; - } - std::cout << "}" << std::endl; - } - std::cout << "}" << std::endl; +Address Address::createInc() const { + return Address(m_nodeID, m_threadID, m_objectID + 1); } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h index 870e25500..01c0e9d30 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Address.h @@ -13,39 +13,43 @@ #ifndef ADDRESS_H_ #define ADDRESS_H_ +#include "etDatatypes.h" #include <string> -#include <vector> namespace etRuntime { class Address { - public: - explicit Address(int nodeID=0, int threadID=0, int objectID=0); - Address(const Address & right); - ~Address(); +public: - Address & operator = (const Address& right); - bool operator< (const Address& right) const; + static const Address EMPTY; - std::string toString() const; - std::string toID()const; + Address(int nodeID, int threadID, int objectID); + Address(const Address& right); + ~Address(); - Address createInc(int i); - bool isValid() const { - return (m_nodeID != 0) || (m_threadID != 0) || (m_objectID != 0); - }; + Address& operator =(const Address& right); + bool operator==(const Address& other) const; + bool operator!=(const Address& other) const; + bool operator< (const Address& right) const; - int m_nodeID; - int m_threadID; - int m_objectID; + std::string toString() const; + std::string toID() const; - //debug helper function - static void printAddrVector(const std::vector<std::vector<etRuntime::Address> >& addresses); + Address createInc() const; + + inline etBool isValid() const { + return *this != EMPTY; + } + + int m_nodeID; + int m_threadID; + int m_objectID; + +private: + Address(); - private: }; } /* namespace etRuntime */ #endif /* ADDRESS_H_ */ - diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h index a1136ab7a..289ad5e00 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.h @@ -19,14 +19,12 @@ namespace etRuntime { -class IMessageReceiver{ +class IMessageReceiver : public virtual IRTObject{ public: - IMessageReceiver(); - virtual ~IMessageReceiver(); + virtual ~IMessageReceiver() {} - virtual void receive(Message* msg) = 0; - virtual Address getAddress() const = 0; - virtual bool isMsgService() const { return false;}; + virtual void receive(const Message* msg) = 0; + virtual const Address& getAddress() const = 0; }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageService.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageService.h new file mode 100644 index 000000000..145d767d7 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageService.h @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MESSAGING_IMESSAGESERVICE_H_ +#define SRC_COMMON_MESSAGING_IMESSAGESERVICE_H_ + +#include "common/messaging/IMessageReceiver.h" + +namespace etRuntime { + +class IMessageService: public virtual IRTObject, public virtual IMessageReceiver { + +public: + + virtual ~IMessageService() {} + + enum ExecMode { + POLLED, BLOCKED, MIXED + }; + + virtual void start() = 0; + virtual void terminate() = 0; + + virtual Address getFreeAddress() = 0; + + virtual void freeAddress(const Address& addr) = 0; + + virtual void addMessageReceiver(IMessageReceiver& receiver) = 0; + virtual void removeMessageReceiver(IMessageReceiver& receiver) = 0; + + virtual void addPollingMessageReceiver(IMessageReceiver& receiver) = 0; + virtual void removePollingMessageReceiver(IMessageReceiver& receiver) = 0; + + // TODO Thread +// void setThread(Thread thread); +// +// Thread getThread(); + +}; + +} + +#endif /* SRC_COMMON_MESSAGING_IMESSAGESERVICE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp index edf5ee57d..af6adef7b 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.cpp @@ -1,20 +1,20 @@ /******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) + * Juergen Haug (initial contribution) * *******************************************************************************/ -#include "IRTObject.h" +#include "common/messaging/IRTObject.h" +#include <string> namespace etRuntime { const std::string IRTObject::NO_NAME = "<no name>"; } - diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h index d10dd8022..4fd02181c 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IRTObject.h @@ -14,20 +14,35 @@ #define IRTOBJECT_H_ #include <string> +#include <vector> namespace etRuntime { class IRTObject { public: - virtual ~IRTObject() {}; + virtual ~IRTObject() { + } static const char PATH_DELIM = '/'; static const char PATHNAME_DELIM = '_'; static const std::string NO_NAME; + virtual const std::string& getName() const = 0; virtual const std::string& getInstancePath() const = 0; virtual const std::string& getInstancePathName() const = 0; + + virtual std::vector<IRTObject*>& getChildren() = 0; + + virtual IRTObject* getParent() const = 0; + + virtual IRTObject* getRoot() const = 0; + + virtual IRTObject* getChild(const std::string& name) const = 0; + + virtual IRTObject* getObject(const std::string& path) const = 0; + + virtual int getThreadForPath(const std::string& path) const = 0; }; } diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp index 0a4aa42bb..9f41aea52 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.cpp @@ -1,33 +1,67 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#include "Message.h" - -#include <sstream> - -namespace etRuntime { - - -Message::~Message() { - m_next = 0; -} - -std::string Message::toString(){ - std::stringstream strm; - strm << "EventMessage(" << m_address.toString() << ", evt=" << m_evtId << ")"; - if (m_data) { - strm << std::showbase << std::hex << m_data; - } - return strm.str(); -} - -} /* namespace etRuntime */ +/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "common/messaging/Message.h"
+#include <iostream>
+#include <string>
+#include <cstring>
+#include <cstdlib>
+
+namespace etRuntime {
+
+Message::Message(const Address& addr, int evtId, const void* dataToCopy, std::size_t dataSize) :
+ m_address(addr),
+ m_evtId(evtId),
+ m_next(0),
+ m_dataSize(0),
+ m_data(0){
+ if(dataToCopy != 0 && dataSize > 0){
+ m_data = std::malloc(dataSize);
+ if(m_data != 0){
+ m_dataSize = dataSize;
+ std::memcpy(m_data, dataToCopy, dataSize);
+ }
+ }
+}
+Message::Message(const Address& addr, int evtId, void* dataPtr) :
+ m_address(addr),
+ m_evtId(evtId),
+ m_next(0),
+ m_dataSize(0),
+ m_data(dataPtr) {
+}
+Message::Message(const Address& addr, int evtId) :
+ m_address(addr),
+ m_evtId(evtId),
+ m_next(0),
+ m_dataSize(0),
+ m_data(0) {
+}
+Message::~Message() {
+ m_evtId = 0;
+ m_next = 0;
+ if(m_dataSize > 0)
+ std::free(m_data);
+ m_data = 0;
+ m_dataSize = 0;
+}
+
+std::string Message::toString() const {
+ std::stringstream strm;
+ strm << "Message(" << m_address.toID() << ", evt=" << m_evtId << ")";
+ if (m_data) {
+ strm << std::showbase << std::hex << m_data;
+ }
+ return strm.str();
+}
+
+} /* namespace etRuntime */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h index 2307a1ead..ad1f064cc 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/Message.h @@ -1,62 +1,76 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#ifndef MESSAGE_H_ -#define MESSAGE_H_ - -#include "common/messaging/Address.h" -#include "etDatatypes.h" -#include <string> - -namespace etRuntime { - -class Message { -public: - Message(Address addr, int evtId, void* data, size_t dataSize) : - m_address(addr), m_evtId(evtId), m_next(0), - m_dataSize(dataSize), m_data(data), m_logFlag(true) - {} - Message(Address addr, int evtId) : - m_address(addr), m_evtId(evtId), m_next(0), - m_dataSize(0), m_data(0), m_logFlag(true) - {} - virtual ~Message(); - - void setNext(Message* msg){m_next = msg;} - Message* getNext() const {return m_next;} - - void setAddress(Address address){m_address = address; } - Address getAddress() const { return m_address; }; - - int getEvtId() const { return m_evtId; } - void* getData() const { return m_data; } - bool hasDebugFlagSet() const { return m_logFlag; }; - - std::string toString(); - -private: - Address m_address; - int m_evtId; - - Message* m_next; - size_t m_dataSize; - void* m_data; - bool m_logFlag; - - Message(); - Message(const Message & right); - Message & operator = (const Message& right); - -}; - -} /* namespace etRuntime */ -#endif /* MESSAGE_H_ */ +/*******************************************************************************
+ * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Peter Karlitschek (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef MESSAGE_H_
+#define MESSAGE_H_
+
+#include "common/messaging/Address.h"
+#include "stddef.h"
+#include <iostream>
+#include <sstream>
+#include <string>
+
+namespace etRuntime {
+
+class Message {
+
+public:
+
+ // Messages with data TODO MessageBuffer
+ Message(const Address& addr, int evtId, const void* dataToCopy, std::size_t dataSize);
+ Message(const Address& addr, int evtId, void* dataPtr);
+
+ Message(const Address& addr, int evtId);
+ ~Message();
+
+ const Address& getAddress() const {
+ return m_address;
+ }
+
+ int getEvtId() const {
+ return m_evtId;
+ }
+
+ /** Pointer to data */
+ void* getData() const {
+ return m_data;
+ }
+
+ std::string toString() const;
+
+protected:
+ friend class MessageSeQueue;
+
+ void setNext(Message* msg) {
+ m_next = msg;
+ }
+
+ Message* getNext() const {
+ return m_next;
+ }
+
+private:
+ Address m_address;
+ int m_evtId;
+
+ Message* m_next;
+ size_t m_dataSize;
+ void* m_data;
+
+ Message();
+ Message(Message const&);
+ Message& operator =(Message const&);
+
+};
+
+} /* namespace etRuntime */
+#endif /* MESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp index 9f5e2b759..e8035b12a 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.cpp @@ -10,68 +10,85 @@ * *******************************************************************************/ -#include "MessageDispatcher.h" +#include "common/messaging/Message.h" +#include "common/messaging/MessageDispatcher.h" namespace etRuntime { +MessageDispatcher::MessageDispatcher(IRTObject* parent, const Address& addr, const std::string& name) : + RTObject(parent, name), + m_local_map(), + m_freeAdresses(), + m_pollingMessageReceiver(), + m_address(addr), + m_nextFreeObjId(addr.m_objectID + 1) { + m_local_map[addr.m_objectID] = this; +} + +Address MessageDispatcher::getFreeAddress() { + if (m_freeAdresses.empty()) { + return Address(getAddress().m_nodeID, getAddress().m_threadID, m_nextFreeObjId++); + } else { + Address address = m_freeAdresses.front(); + m_freeAdresses.pop(); -MessageDispatcher::~MessageDispatcher() { + return address; + } } +void MessageDispatcher::freeAddress(const Address& addr) { + m_freeAdresses.push(addr); +} +void MessageDispatcher::addMessageReceiver(IMessageReceiver& receiver) { + if (!receiver.getAddress().isValid()) + return; + + if (receiver.getAddress().m_nodeID == m_address.m_nodeID + && receiver.getAddress().m_threadID == m_address.m_threadID) { + + m_local_map[receiver.getAddress().m_objectID] = &receiver; + } -MessageDispatcher::MessageDispatcher(IRTObject* parent, Address addr, std::string name) -: RTObject(parent, name) , - IMessageReceiver(), - m_local_map(), - m_thread_map(), - m_node_map(), - m_address(addr) -{}; - -void MessageDispatcher::addMessageReceiver(IMessageReceiver& receiver){ -if (! receiver.getAddress().isValid() ) - return; - -// TODO: does only work same thread (else) -if (receiver.getAddress().m_nodeID != m_address.m_nodeID){ - m_node_map[receiver.getAddress().m_objectID] = &receiver; } -else if(receiver.getAddress().m_threadID != m_address.m_threadID){ - m_thread_map[receiver.getAddress().m_threadID] = &receiver; + +void MessageDispatcher::removeMessageReceiver(IMessageReceiver& receiver) { + if (!receiver.getAddress().isValid()) + return; + + m_local_map.erase(receiver.getAddress().m_objectID); } -else { - m_local_map[receiver.getAddress().m_objectID] = &receiver; + +void MessageDispatcher::addPollingMessageReceiver(IMessageReceiver& receiver) { + m_pollingMessageReceiver.insert(&receiver); } -}; - -void MessageDispatcher::receive(Message* msg) { -// TODO: does only work same thread (else) - //TODO: assert msg != 0 -IMessageReceiver* receiver = 0; -std::map<int, IMessageReceiver*>::iterator it; -if (msg->getAddress().m_nodeID != m_address.m_nodeID){ - it = m_node_map.find(msg->getAddress().m_objectID); - if (it != m_node_map.end() ) { - receiver = (*it).second; - } +void MessageDispatcher::removePollingMessageReceiver(IMessageReceiver& receiver) { + m_pollingMessageReceiver.erase(&receiver); } -else if(msg->getAddress().m_threadID != m_address.m_threadID){ - it = m_thread_map.find(msg->getAddress().m_objectID); - if (it != m_thread_map.end() ) { - receiver = (*it).second; + +void MessageDispatcher::receive(const Message* msg) { + + IMessageReceiver* receiver = 0; + if (msg->getAddress().m_nodeID == m_address.m_nodeID && msg->getAddress().m_threadID == m_address.m_threadID) { + std::map<int, IMessageReceiver*>::iterator it; + it = m_local_map.find(msg->getAddress().m_objectID); + if (it != m_local_map.end()) { + receiver = it->second; + } } -} -else { - // Same node, same thread -> local call Dispatch Map - it = m_local_map.find(msg->getAddress().m_objectID); - if (it != m_local_map.end() ) { - receiver = (*it).second; + if (receiver == this) { + for (std::set<IMessageReceiver*>::iterator it = m_pollingMessageReceiver.begin(); + it != m_pollingMessageReceiver.end(); ++it) { + (*it)->receive(msg); + } + } else if (receiver != 0) { + receiver->receive(msg); + // TODO: error handling for not found addresses + + delete msg; } } -if (receiver!=0) -{ - receiver->receive(msg); - // TODO: error handling for not found addresses -} + +std::string MessageDispatcher::toString() const { + return getName() + " " + getAddress().toID(); } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h index 57b50e5f6..359acff43 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageDispatcher.h @@ -13,33 +13,46 @@ #ifndef MESSAGEDISPATCHER_H_ #define MESSAGEDISPATCHER_H_ +#include "common/messaging/Address.h" #include "common/messaging/IMessageReceiver.h" -#include "common/messaging/IRTObject.h" #include "common/messaging/RTObject.h" #include <map> +#include <queue> +#include <set> #include <string> + + namespace etRuntime { -class MessageDispatcher : public RTObject, public IMessageReceiver { +class MessageDispatcher : public RTObject, public virtual IMessageReceiver { public: - MessageDispatcher(IRTObject* parent, Address addr, std::string name); - virtual ~MessageDispatcher(); + MessageDispatcher(IRTObject* parent, const Address& addr, const std::string& name); + virtual ~MessageDispatcher() {} + Address getFreeAddress(); + void freeAddress(const Address& addr); void addMessageReceiver(IMessageReceiver& receiver); - void receive(Message* msg); + void removeMessageReceiver(IMessageReceiver& receiver); + void addPollingMessageReceiver(IMessageReceiver& receiver); + void removePollingMessageReceiver(IMessageReceiver& receiver); + void receive(const Message* msg); + + const Address& getAddress() const { return m_address; }; - Address getAddress() const { return m_address; }; + protected: + std::string toString() const; private: std::map<int, IMessageReceiver*> m_local_map; - std::map<int, IMessageReceiver*> m_thread_map; - std::map<int, IMessageReceiver*> m_node_map; + std::queue<Address> m_freeAdresses; + std::set<IMessageReceiver*> m_pollingMessageReceiver; Address m_address; + int m_nextFreeObjId; MessageDispatcher(); - MessageDispatcher(const MessageDispatcher& right); - MessageDispatcher& operator=(const MessageDispatcher& right); + MessageDispatcher(MessageDispatcher const&); + MessageDispatcher& operator=(MessageDispatcher const&); }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp index ab2f54a8b..05acc694d 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.cpp @@ -14,13 +14,7 @@ namespace etRuntime { - -MessageSeQueue::~MessageSeQueue() { - m_first = 0; - m_last = 0; -} - -MessageSeQueue::MessageSeQueue(IRTObject* parent, std::string name) +MessageSeQueue::MessageSeQueue(IRTObject* parent, const std::string& name) : RTObject(parent, name), m_first(0), m_last(0), @@ -29,6 +23,11 @@ MessageSeQueue::MessageSeQueue(IRTObject* parent, std::string name) { } +MessageSeQueue::~MessageSeQueue() { + m_first = 0; + m_last = 0; +} + void MessageSeQueue::push(Message* msg) { // TODO: optimize queue for concurrent push / pop if (m_first == 0) { @@ -42,7 +41,7 @@ void MessageSeQueue::push(Message* msg) { } -Message* MessageSeQueue::pop() { +const Message* MessageSeQueue::pop() { // TODO: optimize queue for concurrent push / pop Message* pop_msg = m_first; if (m_first == 0) { diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h index 1468cea16..e2b42e67f 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageSeQueue.h @@ -14,34 +14,45 @@ #define MESSAGESEQUEUE_H_ #include "common/messaging/RTObject.h" -#include <string> #include "common/messaging/Message.h" +#include "etDatatypes.h" +#include <string> namespace etRuntime { class MessageSeQueue: public RTObject { - public: - MessageSeQueue(IRTObject* parent, std::string name); - virtual ~MessageSeQueue(); - - void push(Message* msg); - Message* pop(); - - long getSize() const {return m_size; } - Message* getFirst() const {return m_first; } - Message* getLast() const { return m_last; } - bool isNotEmpty() const { return m_last != 0; } - long getHightWaterMark() const { return m_highWaterMark; } - - private: - Message* m_first; - Message* m_last; - long m_highWaterMark; - long m_size; - - MessageSeQueue(); - MessageSeQueue(const MessageSeQueue& right); - MessageSeQueue& operator=(const MessageSeQueue& right); +public: + MessageSeQueue(IRTObject* parent, const std::string& name); + virtual ~MessageSeQueue(); + + void push(Message* msg); + const Message* pop(); + + long getSize() const { + return m_size; + } + Message* getFirst() const { + return m_first; + } + Message* getLast() const { + return m_last; + } + etBool isNotEmpty() const { + return m_last != 0; + } + long getHightWaterMark() const { + return m_highWaterMark; + } + +private: + Message* m_first; + Message* m_last; + long m_highWaterMark; + long m_size; + + MessageSeQueue(); + MessageSeQueue(MessageSeQueue const&); + void operator=(MessageSeQueue const&); }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp index 21153ce56..b6ef64a55 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.cpp @@ -10,147 +10,158 @@ * *******************************************************************************/ -#include "MessageService.h" -#include <iostream> -#include <stdlib.h> -#include <unistd.h> +#include "common/messaging/MessageDispatcher.h" +#include "common/messaging/MessageSeQueue.h" +#include "common/messaging/MessageService.h" +#include "common/messaging/MessageServiceController.h" +#include "common/messaging/RTServices.h" +#include "osal/etTime.h" +#include <string> namespace etRuntime { -extern "C" { - void* threadStarter(void* arg) { - MessageService* thisPtr = static_cast<MessageService*>(arg); - std::cout << "Thread " << thisPtr->getName() << " is started." << std::endl; - thisPtr->run(); - return arg; - // pthread_exit(NULL); - } + +MessageService::MessageService(IRTObject* parent, IMessageService::ExecMode mode, int node, int thread, const std::string& name, int priority) : + AbstractMessageService(parent, name, node, thread), + m_running(false), + m_execMode(mode), + m_lastMessageTimestamp(0), + m_pollingMessage(getMessageDispatcher().getAddress(), 0) { + + etTime interval; + interval.sec = 0; + interval.nSec = 0; + MessageService_init(interval, priority); } -MessageService::MessageService(IRTObject* parent, Address addr, std::string name, int priority) - : IMessageReceiver(), - RTObject(parent, name), +MessageService::MessageService(IRTObject* parent, IMessageService::ExecMode mode, etTime interval, int node, int thread, + const std::string& name, int priority) : + AbstractMessageService(parent, name, node, thread), m_running(false), - m_thread(), - m_mutex(), - m_mutexAttr(), - m_conditionVar(), - m_threadAttr(), - m_messageQueue(this, "Queue"), - m_messageDispatcher( this, - Address(addr.m_nodeID, addr.m_threadID, addr.m_objectID + 1), - "Dispatcher"), - m_address(addr), + m_execMode(mode), m_lastMessageTimestamp(0), - m_asyncActors() -{ - pthread_mutexattr_init(&m_mutexAttr); - pthread_mutexattr_settype(&m_mutexAttr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&m_mutex, &m_mutexAttr); - pthread_cond_init (&m_conditionVar, NULL); - pthread_attr_init(&m_threadAttr); - pthread_attr_setdetachstate(&m_threadAttr, PTHREAD_CREATE_JOINABLE); + m_pollingMessage(getMessageDispatcher().getAddress(), 0) { + + MessageService_init(interval, priority); +} + +void MessageService::MessageService_init(etTime interval, int priority) { + + /* init mutexes and semaphores */ + etMutex_construct(&m_mutex); + etSema_construct(&m_executionSemaphore); + + /* init thread */ + etThread_construct(&m_thread, static_cast<etStacksize>(1024), static_cast<etPriority>(priority), (etThreadname)"MessageService", + MessageService::run, static_cast<void *>(this)); // check and set priority // assert priority >= Thread.MIN_PRIORITY : ("priority smaller than Thread.MIN_PRIORITY (1)"); // assert priority <= Thread.MAX_PRIORITY : ("priority bigger than Thread.MAX_PRIORITY (10)"); // this.setPriority(priority); + if (m_execMode == IMessageService::POLLED || m_execMode == IMessageService::MIXED) { + /* init timer */ + etTimer_construct(&m_timer, &interval, MessageService::pollingTask, static_cast<void *>(this)); + } } MessageService::~MessageService() { - pthread_attr_destroy(&m_threadAttr); - pthread_mutex_destroy(&m_mutex); - pthread_cond_destroy(&m_conditionVar); - pthread_exit(NULL); - + std::cout << "~MessageService" << std::endl; + etMutex_destruct(&m_mutex); + etSema_destruct(&m_executionSemaphore); + etThread_destruct(&m_thread); + if (m_execMode == IMessageService::POLLED || m_execMode == IMessageService::MIXED) { + etTimer_destruct(&m_timer); + } } -void MessageService::start(bool singlethreaded) { - if (singlethreaded) { - std::cout << "starting message service " << getName() << " singlethreaded" << std::endl; - } - else { - std::cout << "starting message service " << getName() << " on own thread" << std::endl; - int rc = pthread_create(&m_thread, &m_threadAttr, threadStarter, static_cast<void *>(this)); - if (rc){ - std::cout << "ERROR; return code from pthread_create() is " << rc << std::endl; - exit(-1); - } +void MessageService::start() { + etThread_start(&m_thread); + if (m_execMode == IMessageService::POLLED || m_execMode == IMessageService::MIXED) { + etTimer_start(&m_timer); } } -void MessageService::join() { - void *status; - int rc = pthread_join(m_thread, &status); - if (rc){ - std::cout << "ERROR; return code from pthread_join() is " << rc << std::endl; - exit(-1); - } -} void MessageService::run() { m_running = true; while (m_running) { - pollOneMessage(); - usleep(10000); + etMutex_enter(&m_mutex); + const Message* msg = getMessageQueue().pop(); // get next Message from Queue + etMutex_leave(&m_mutex); + if (msg == 0) { + // no message in queue -> wait till Thread is notified + etSema_waitForWakeup(&m_executionSemaphore); + } else { + //TODO: set timestamp + // m_lastMessageTimestamp = System.currentTimeMillis(); + getMessageDispatcher().receive(msg); + } } - std::cout << "ending message service " << getName() << " on own thread" << std::endl; + + RTServices::getInstance().getMsgSvcCtrl().setMsgSvcTerminated(*this); } -void MessageService::runOnce() { - pollAsyncActors(); - while (m_messageQueue.isNotEmpty()){ - Message* msg = m_messageQueue.pop(); // get next Message from Queue - if (msg != 0) { - m_messageDispatcher.receive(msg); - } - } +void MessageService::receive(const Message* msg) { + etMutex_enter(&m_mutex); + AbstractMessageService::receive(msg); + etSema_wakeup(&m_executionSemaphore); + etMutex_leave(&m_mutex); } -void MessageService::receive(Message* msg) { - pthread_mutex_lock(&m_mutex); - if (msg != 0) { - m_messageQueue.push(msg); - pthread_cond_signal(&m_conditionVar); // wake up thread to compute message - } - pthread_mutex_unlock(&m_mutex); +Address MessageService::getFreeAddress() { + etMutex_enter(&m_mutex); + Address address = AbstractMessageService::getFreeAddress(); + etMutex_leave(&m_mutex); + + return address; } +void MessageService::freeAddress(const Address& addr) { + etMutex_enter(&m_mutex); + AbstractMessageService::freeAddress(addr); + etMutex_leave(&m_mutex); +} -// TODO: synchronized -void MessageService::terminate() { - pthread_mutex_lock(&m_mutex); - if (m_running) { - m_running = false; - pthread_cond_signal(&m_conditionVar); // wake up thread to terminate - } - pthread_mutex_unlock(&m_mutex); +void MessageService::addMessageReceiver(IMessageReceiver& receiver) { + etMutex_enter(&m_mutex); + AbstractMessageService::addMessageReceiver(receiver); + etMutex_leave(&m_mutex); } -void MessageService::pollOneMessage() { - pthread_mutex_lock(&m_mutex); - Message* msg = m_messageQueue.pop(); // get next Message from Queue - if (msg == 0) { - // no message in queue -> wait till Thread is notified - pthread_cond_wait(&m_conditionVar, &m_mutex); - } else { - //TODO: set timestamp - // m_lastMessageTimestamp = System.currentTimeMillis(); - m_messageDispatcher.receive(msg); - } - pthread_mutex_unlock(&m_mutex); +void MessageService::removeMessageReceiver(IMessageReceiver& receiver) { + etMutex_enter(&m_mutex); + AbstractMessageService::removeMessageReceiver(receiver); + etMutex_leave(&m_mutex); +} +void MessageService::addPollingMessageReceiver(IMessageReceiver& receiver) { + etMutex_enter(&m_mutex); + AbstractMessageService::addPollingMessageReceiver(receiver); + etMutex_leave(&m_mutex); } -void MessageService::addAsyncActor(IEventReceiver& evtReceiver) { - m_asyncActors.push_back(&evtReceiver); +void MessageService::removePollingMessageReceiver(IMessageReceiver& receiver) { + etMutex_enter(&m_mutex); + AbstractMessageService::removePollingMessageReceiver(receiver); + etMutex_leave(&m_mutex); } -void MessageService::pollAsyncActors() { - std::vector<IEventReceiver*>::iterator it = m_asyncActors.begin(); - for ( ; it != m_asyncActors.end(); ++it) { - // polling event - (*it)->receiveEvent(0,0,0); +void MessageService::terminate() { + if (m_execMode == IMessageService::POLLED || m_execMode == IMessageService::MIXED) { + etTimer_stop(&m_timer); + } + if (m_running) { + m_running = false; + etSema_wakeup(&m_executionSemaphore); + } + +} + +// called by osal timer, thread ? +void MessageService::pollingTask() { + if (m_running) { + receive(&m_pollingMessage); } } diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h index 3a9a91f61..f27ce2e93 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageService.h @@ -13,70 +13,80 @@ #ifndef MESSAGESERVICE_H_ #define MESSAGESERVICE_H_ +#include "common/messaging/AbstractMessageService.h" + +#include "common/messaging/IMessageService.h" +#include "common/messaging/Message.h" +#include "etDatatypes.h" +#include "osal/etMutex.h" +#include "osal/etSema.h" +#include "osal/etThread.h" +#include "osal/etTimer.h" #include <string> -#include <vector> -#include <pthread.h> -#include "common/messaging/MessageDispatcher.h" -#include "common/messaging/Address.h" -#include "common/modelbase/IEventReceiver.h" -#include "MessageSeQueue.h" namespace etRuntime { -//TODO: abstraction from posix threads missing +class MessageService: public AbstractMessageService { -class MessageService: public IMessageReceiver, public RTObject { public: - MessageService(IRTObject* parent, Address addr, std::string name, int priority = 0); - virtual ~MessageService(); - Address getAddress() const { return m_address; } ; + enum ExecMode { + POLLED, BLOCKED, MIXED + }; + + MessageService(IRTObject* parent, IMessageService::ExecMode mode, int node, int thread, const std::string& name, int priority = 0); + MessageService(IRTObject* parent, IMessageService::ExecMode mode, etTime interval, int node, int thread, const std::string& name, int priority = 0); + virtual ~MessageService(); - void start(bool singlethreaded); void run(); - // for single threaded configuration only - void runOnce(); - void join(); - void terminate(); - void receive(Message* msg); + virtual void start(); + virtual void terminate(); - virtual MessageDispatcher& getMessageDispatcher() { return m_messageDispatcher; } - virtual bool isMsgService() const { return true;}; + virtual Address getFreeAddress(); - void addAsyncActor(IEventReceiver& evtReceiver); - void pollAsyncActors(); + virtual void freeAddress(const Address& addr); + virtual void addMessageReceiver(IMessageReceiver& receiver); + virtual void removeMessageReceiver(IMessageReceiver& receiver); + + virtual void addPollingMessageReceiver(IMessageReceiver& receiver); + virtual void removePollingMessageReceiver(IMessageReceiver& receiver); + virtual void receive(const Message* msg); - // protected methods for sole use by test cases protected: - MessageSeQueue& getMessageQueue() { return m_messageQueue; } - long getLastMessageTimestamp() const { return m_lastMessageTimestamp; } + + long getLastMessageTimestamp() const { + return m_lastMessageTimestamp; + } + + void pollingTask(); private: - //TODO: synchronized - void pollOneMessage(); - - bool m_running; - pthread_t m_thread; - pthread_mutex_t m_mutex; - pthread_mutexattr_t m_mutexAttr; - pthread_cond_t m_conditionVar; - pthread_attr_t m_threadAttr; - - // TODO: add internal message queue for less locks (faster thread internal - // messaging) - MessageSeQueue m_messageQueue; - MessageDispatcher m_messageDispatcher; - Address m_address; + // static functions for c calls + static void run(void* self) { + static_cast<MessageService*>(self)->run(); + } + + static void pollingTask(void* self) { + static_cast<MessageService*>(self)->pollingTask(); + } + + etBool m_running; + IMessageService::ExecMode m_execMode; long m_lastMessageTimestamp; + Message m_pollingMessage; - std::vector<IEventReceiver*> m_asyncActors; + etMutex m_mutex; + etSema m_executionSemaphore; + etThread m_thread; + etTimer m_timer; - MessageService(); - MessageService(const MessageService& right); - MessageService& operator=(const MessageService& right); + void MessageService_init(etTime interval, int priority); // common ctor + MessageService(); + MessageService(MessageService const&); + MessageService& operator=(MessageService const&); }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp index 6a71f9a81..f6af90682 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.cpp @@ -14,68 +14,85 @@ namespace etRuntime { +MessageServiceController::MessageServiceController() : + m_messageServices(), + m_freeIDs(), + m_running(false), + m_nextFreeID(0), + m_terminateServices(){ + etMutex_construct(&m_mutex); + etSema_construct(&m_terminateSema); +} + +int MessageServiceController::getNewID() { + etMutex_enter(&m_mutex); + int newID; + if (m_freeIDs.empty()) + newID = m_nextFreeID++; + else { + newID = m_freeIDs.back(); + m_freeIDs.pop(); + } + etMutex_leave(&m_mutex); -MessageServiceController::~MessageServiceController() { - // TODO Auto-generated destructor stub + return newID; } -MessageServiceController::MessageServiceController(/*IRTObject parent*/) - : m_messageServiceList(), - m_running(false) { - // TODO: Who is parent of MessageServices and Controller? - // this.parent = parent; +void MessageServiceController::freeID(int id) { + etMutex_enter(&m_mutex); + m_freeIDs.push(id); + etMutex_leave(&m_mutex); } -void MessageServiceController::addMsgSvc(MessageService& msgSvc) { - // TODO TS: Who is parent of MessageServices ? - //TODO assert - //assert(msgSvc.getAddress().m_threadID == m_messageServiceList.size()); - m_messageServiceList.push_back(&msgSvc); +void MessageServiceController::addMsgSvc(IMessageService& msgSvc) { + etMutex_enter(&m_mutex); + if (m_nextFreeID <= msgSvc.getAddress().m_threadID) + m_nextFreeID = msgSvc.getAddress().m_threadID + 1; + + m_messageServices[msgSvc.getAddress().m_threadID] = &msgSvc; + etMutex_leave(&m_mutex); } -MessageService* MessageServiceController::getMsgSvc(int threadID) { - return m_messageServiceList.at(threadID); +void MessageServiceController::removeMsgSvc(IMessageService& msgSvc) { + etMutex_enter(&m_mutex); + m_messageServices.erase(msgSvc.getAddress().m_threadID); + etMutex_leave(&m_mutex); } -void MessageServiceController::connectAll() { - for (size_t i = 0; i < m_messageServiceList.size(); i++) { - MessageDispatcher& dispatcher = getMsgSvc(i)->getMessageDispatcher(); - for (size_t j = 0; j < m_messageServiceList.size(); j++) { - if (i != j) { - dispatcher.addMessageReceiver(*RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(j)); - } - } - } +IMessageService* MessageServiceController::getMsgSvc(int id) { + IMessageService* msgSvc = 0; + etMutex_enter(&m_mutex); + std::map<int, IMessageService*>::iterator it = m_messageServices.find(id); + if(it != m_messageServices.end()) + msgSvc = it->second; + etMutex_leave(&m_mutex); + + return msgSvc; } -void MessageServiceController::start(bool singlethreaded) { +void MessageServiceController::start() { // start all message services - for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin(); - it != m_messageServiceList.end(); ++it) { - (*it)->start(singlethreaded); + for (std::map<int, IMessageService*>::iterator it = m_messageServices.begin(); it != m_messageServices.end(); ++it) { + (it->second)->start(); // TODO TS: start in order of priorities } m_running = true; } -void MessageServiceController::stop(bool singlethreaded) { +void MessageServiceController::stop() { + if (!m_running) + return; + //dumpThreads("org.eclipse.etrice.runtime.java.messaging.MessageServiceController.stop()"); - if (! singlethreaded) { - terminate(); - waitTerminate(); - } -} + terminate(); + waitTerminate(); -void MessageServiceController::waitTerminate() { - for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin(); - it != m_messageServiceList.end(); ++it) { - (*it)->join(); - } + m_running = false; } void MessageServiceController::dumpThreads(std::string msg) { - std::cout << "<<< begin dump threads <<<" << std::endl; - std::cout << "=== " << msg << std::endl; +// std::cout << "<<< begin dump threads <<<" << std::endl; +// std::cout << "=== " << msg << std::endl; //TODO dump stack traces // Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces(); // for (Thread thread : traces.keySet()) { @@ -88,32 +105,51 @@ void MessageServiceController::dumpThreads(std::string msg) { // std::cout << " " << elements[i].toString() << std::endl; // } // } - std::cout <<(">>> end dump threads >>>"); +// std::cout <<(">>> end dump threads >>>"); } void MessageServiceController::terminate() { - if (!m_running) { - return; - } - m_running = false; - // terminate all message services - for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin(); - it != m_messageServiceList.end(); ++it) { - (*it)->terminate(); + etMutex_enter(&m_mutex); + m_terminateServices = m_messageServices; + etMutex_leave(&m_mutex); + + std::map<int, IMessageService*>::iterator it = m_terminateServices.begin(); + for (; it != m_terminateServices.end(); ++it) { + (it->second)->terminate(); //TODO TS: stop in order of priorities } } -void MessageServiceController::runOnce() { - if (!m_running) { - return; +void MessageServiceController::waitTerminate() { + etBool wait = true; + + while(wait){ + etMutex_enter(&m_mutex); + wait = !m_terminateServices.empty(); + etMutex_leave(&m_mutex); + + if(wait) + etSema_waitForWakeup(&m_terminateSema); } +} - for (std::vector<MessageService*>::iterator it = m_messageServiceList.begin(); - it != m_messageServiceList.end(); ++it) { - (*it)->runOnce(); +void MessageServiceController::resetAll() { + stop(); + etMutex_enter(&m_mutex); + m_messageServices.clear(); + while (!m_freeIDs.empty()) { + m_freeIDs.pop(); } + m_nextFreeID = 0; + etMutex_leave(&m_mutex); +} + +void MessageServiceController::setMsgSvcTerminated(const IMessageService& msgSvc){ + etMutex_enter(&m_mutex); + m_terminateServices.erase(msgSvc.getAddress().m_threadID); + etSema_wakeup(&m_terminateSema); + etMutex_leave(&m_mutex); } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h index 5f79bbea0..4771b38b9 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/MessageServiceController.h @@ -13,57 +13,54 @@ #ifndef MESSAGESERVICECONTROLLER_H_ #define MESSAGESERVICECONTROLLER_H_ -#include "common/messaging/MessageService.h" -#include "common/messaging/RTServices.h" -#include <vector> +#include "common/messaging/IMessageService.h" +#include "osal/etMutex.h" +#include "osal/etSema.h" +#include <map> +#include <queue> #include <string> -#include <iostream> -#include <algorithm> namespace etRuntime { class MessageServiceController { public: - MessageServiceController(/*IRTObject parent*/); - virtual ~MessageServiceController(); - - void addMsgSvc(MessageService& msgSvc); - //raises an exception if the service does not exist for this threadID - MessageService* getMsgSvc(int threadID); - - void addAsyncActor(IEventReceiver& evtReceiver); - void pollAsyncActors(); - - //the connectAll method connects all messageServices - //it is included for test purposes - //currently it is not called - void connectAll(); - void start(bool singlethreaded); - void stop(bool singlethreaded); - - //TODO: this is only for single threaded configurations - void runOnce(); + MessageServiceController(); + virtual ~MessageServiceController() {} + + int getNewID(); + void freeID(int id); + void addMsgSvc(IMessageService& msgSvc); + void removeMsgSvc(IMessageService& msgSvc); + IMessageService* getMsgSvc(int threadID); + void start(); + void stop(); + void resetAll(); /** * waitTerminate waits blocking for all MessageServices to terminate - * ! not threadsafe ! + * ! not thread safe ! */ void waitTerminate(); + void setMsgSvcTerminated(const IMessageService& msgSvc); + protected: void dumpThreads(std::string msg); private: void terminate(); - MessageServiceController(const MessageServiceController& right); - MessageServiceController& operator=(const MessageServiceController& right); - + std::map<int, IMessageService*> m_messageServices; + std::queue<int> m_freeIDs; + etBool m_running; + int m_nextFreeID; - std::vector<MessageService*> m_messageServiceList; - // IRTObject parent = null; - bool m_running; + etMutex m_mutex; + etSema m_terminateSema; + std::map<int, IMessageService*> m_terminateServices; + MessageServiceController(MessageServiceController const&); + MessageServiceController& operator=(MessageServiceController const&); }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp index 68ba311fa..19e146ab0 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.cpp @@ -10,64 +10,128 @@ * *******************************************************************************/ -#include "RTObject.h" +#include "common/messaging/RTObject.h" +#include "etDatatypes.h" +#include <iterator> +#include <string> +#include <vector> namespace etRuntime { -RTObject::RTObject() : - IRTObject(), - m_parent(0), - m_name(NO_NAME) , - m_instancePath(), - m_instancePathName() -{ - setPathNames(); +RTObject::RTObject(IRTObject* parent, const std::string& name) : + m_name(name), + m_parent(parent), + m_children() { + + if (m_parent != 0) { + m_parent->getChildren().push_back(this); + m_instancePath = m_parent->getInstancePath() + PATH_DELIM + m_name; + m_instancePathName = m_parent->getInstancePathName() + PATHNAME_DELIM + m_name; + } else { + m_instancePath = PATH_DELIM + m_name; + m_instancePathName = PATHNAME_DELIM + m_name; + } } -RTObject::RTObject(IRTObject* parent, std::string name) : - IRTObject(), - m_parent(parent), - m_name(name), - m_instancePath(), - m_instancePathName() -{ - setPathNames(); +RTObject::~RTObject() { + for (std::vector<IRTObject*>::iterator it = m_children.begin(); it != m_children.end(); ++it) { + delete *it; + } } -RTObject::RTObject(const RTObject & right) : - m_parent(right.m_parent), - m_name(right.m_name), - m_instancePath(right.m_instancePath), - m_instancePathName(right.m_instancePathName) -{ +void RTObject::destroy() { + for (std::vector<IRTObject*>::iterator it = m_children.begin(); it != m_children.end(); ++it) { + RTObject* child = dynamic_cast<RTObject*>(*it); + if (child != 0) { + child->destroy(); + } + } + + // no removal in parent to maintain reference for deletion + m_parent = 0; } -RTObject & RTObject::operator = (RTObject right) { - std::swap(right, *this); - return *this; +IRTObject* RTObject::getRoot() const { + IRTObject* root = const_cast<RTObject*>(this); + while (root->getParent() != 0) + root = root->getParent(); + + return root; } -RTObject::~RTObject() { - m_parent = 0; +IRTObject* RTObject::getChild(const std::string& name) const { + for (std::vector<IRTObject*>::const_iterator it = m_children.begin(); it != m_children.end(); ++it) { + if (name == ((*it)->getName())) { + return *it; + } + } + + return 0; } -void RTObject::setPathNames() { - if (m_parent != 0) { - m_instancePath = m_parent->getInstancePath() + PATH_DELIM + m_name; - m_instancePathName = m_parent->getInstancePathName() + PATHNAME_DELIM + m_name; +IRTObject* RTObject::getObject(const std::string& path) const { + etBool isAbsolute = (path[0] == PATH_DELIM); + if (isAbsolute && getParent() != 0) + return getParent()->getObject(path); + + std::string segment; + std::size_t last = 0; + if (isAbsolute) { + last = 1; + size_t first = path.find(PATH_DELIM, last); + segment = path.substr(last, (first == std::string::npos) ? std::string::npos : first - 1); + if (segment != m_name) + return 0; + + last = first; } - else { - m_instancePath = PATH_DELIM + m_name; - m_instancePathName = PATHNAME_DELIM + m_name; + + IRTObject* current = const_cast<RTObject*>(this); + std::size_t next; + while ((next = path.find(PATH_DELIM, last)) != std::string::npos) { + if (next > last + 1) { + segment = path.substr(last, next - last); + current = current->getChild(segment); + if (current == 0) + return 0; + } + last = next + 1; + } + if (last < path.length() - 1) { + segment = path.substr(last); + current = current->getChild(segment); } + + return current; +} + +int RTObject::getThreadForPath(const std::string& path) const { + if (m_parent != 0) + return m_parent->getThreadForPath(path); + + return -1; +} + +std::string RTObject::toStringRecursive(const std::string& indent) const { + std::string result(indent + toString() + "\n"); + + std::string indentInc(" " + indent); + std::vector<IRTObject*>::const_iterator it = m_children.begin(); + for (; it != m_children.end(); ++it) { + RTObject* child = dynamic_cast<RTObject*>(*it); + if (child != 0) + result += child->toStringRecursive(indentInc); + } + + return result; } -const std::string& RTObject::getInstancePath() const{ - return m_instancePath; +std::string RTObject::toStringRecursive() const { + return toStringRecursive(""); } -const std::string& RTObject::getInstancePathName() const{ - return m_instancePathName; +std::string RTObject::toString() const { + return getName(); } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h index e70059035..a4bb6cd66 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTObject.h @@ -13,36 +13,64 @@ #ifndef RTOBJECT_H_ #define RTOBJECT_H_ -#include <string> #include "common/messaging/IRTObject.h" +#include <string> +#include <vector> namespace etRuntime { -class RTObject : public virtual IRTObject{ +class RTObject: public virtual IRTObject { public: - RTObject(); - RTObject(IRTObject* parent, std::string name); - RTObject(const RTObject & right); - RTObject & operator = (RTObject right); + RTObject(IRTObject* parent, const std::string& name); virtual ~RTObject(); - IRTObject* getParent() const { return m_parent; }; - const std::string& getName() const { return m_name; }; + virtual const std::string& getName() const { + return m_name; + } + virtual const std::string& getInstancePath() const { + return m_instancePath; + } + virtual const std::string& getInstancePathName() const { + return m_instancePathName; + } + + virtual std::vector<IRTObject*>& getChildren() { + return m_children; + } + + virtual IRTObject* getParent() const { + return m_parent; + } + + virtual IRTObject* getRoot() const; + + virtual IRTObject* getChild(const std::string& name) const; - virtual const std::string& getInstancePath() const; - virtual const std::string& getInstancePathName() const; + virtual IRTObject* getObject(const std::string& path) const; + + virtual int getThreadForPath(const std::string& path) const; + +protected: + virtual void destroy(); + + std::string toStringRecursive(const std::string& indent) const; + std::string toStringRecursive() const; + virtual std::string toString() const; private: - void setPathNames(); - IRTObject* m_parent; std::string m_name; // for speed optimization the instance paths are created at instantiation // and used as const ref parameters in the logging methods to avoid copying std::string m_instancePath; std::string m_instancePathName; + IRTObject* m_parent; + std::vector<IRTObject*> m_children; + RTObject(); + RTObject(RTObject const&); + RTObject& operator=(RTObject const&); }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp deleted file mode 100644 index 6aa7b5656..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#include "RTServices.h" - -namespace etRuntime { - -RTServices* RTServices::s_instance = 0; - -RTServices::RTServices() - : m_subSystem(0), - m_messageServiceController( new MessageServiceController()) -{ -} - -RTServices::~RTServices() { - // TODO Auto-generated destructor stub -} - -void RTServices::destroy() { - // TODO: also clean up all sub elements - m_subSystem = 0; - m_messageServiceController = 0; - //TODO is delete necessary here?? - //delete s_instance; - s_instance = 0; -} - -MessageServiceController& RTServices::getMsgSvcCtrl() { - //TODO - //assert(m_messageServiceController != 0); - return *m_messageServiceController; -} - -} /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h index fe9c36395..3d71bd9cd 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTServices.h @@ -12,39 +12,48 @@ #ifndef RTSERVICES_H_ #define RTSERVICES_H_ + #include "common/messaging/MessageServiceController.h" namespace etRuntime { class SubSystemClassBase; -class MessageServiceController; - class RTServices { public: - virtual ~RTServices(); - static RTServices& getInstance() { - if (s_instance == 0) { - s_instance = new RTServices(); - } - return *s_instance; + static RTServices s_instance; + + return s_instance; } - void destroy(); - MessageServiceController& getMsgSvcCtrl(); - SubSystemClassBase* getSubSystem() { return m_subSystem; }; - void setSubSystem(SubSystemClassBase* subSystem) { m_subSystem = subSystem; }; + virtual ~RTServices() { + m_subSystem = 0; + } -private: - static RTServices* s_instance; + void destroy() { + } + MessageServiceController& getMsgSvcCtrl() { + return m_messageServiceController; + } + SubSystemClassBase* getSubSystem() const { + return m_subSystem; + } + void setSubSystem(SubSystemClassBase* subSystem) { + m_subSystem = subSystem; + } + +private: SubSystemClassBase* m_subSystem; - MessageServiceController* m_messageServiceController; + MessageServiceController m_messageServiceController; - RTServices(); - RTServices(const RTServices & right); - RTServices & operator = (const RTServices& right); + RTServices() : + m_subSystem(0), + m_messageServiceController() { + } + RTServices(RTServices const&); + void operator=(RTServices const&); }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp deleted file mode 100644 index 34ab12c46..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#include "RTSystemServicesProtocol.h" -#include "common/debugging/DebuggingService.h" - -namespace etRuntime { - -std::string RTSystemServicesProtocol::s_messageStrings[] = - { "MIN", - "dummy", - "executeInitialTransition", - "startDebugging", - "stopDebugging", - "MAX"}; - -std::string RTSystemServicesProtocol::getMessageString(int msg_id) { - if ((MSG_MIN < msg_id ) && ( msg_id < MSG_MAX )) { - return s_messageStrings[msg_id]; - } else { - // id out of range - return "Message ID out of range"; - } -} - -//------------------------------------------------------------------ -// RTSystemServicesProtocol: surrounding class -//------------------------------------------------------------------ - - -RTSystemServicesProtocol::RTSystemServicesProtocol() { -} - -RTSystemServicesProtocol::~RTSystemServicesProtocol() { -} - - -//------------------------------------------------------------------ -// RTSystemServicesProtocolPort -//------------------------------------------------------------------ - -RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name, - int localId, Address addr, Address peerAddress, bool doRegistration) -:PortBase(actor, parent, name, localId, 0, addr, peerAddress) -{ - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } -}; - -RTSystemServicesProtocolPort::RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name, - int localId, int idx, Address addr, Address peerAddress, bool doRegistration) -: PortBase(actor, parent, name, localId, idx, addr, peerAddress) -{ - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } -}; - -void RTSystemServicesProtocolPort::receive(Message* msg) { - if (! RTSystemServicesProtocol::isValidIncomingEvtID(msg->getEvtId())) { - std::cout << "unknown" << std::endl; - } - else { - if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag - DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId())); - } - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); - } -}; - -// sent messages - -void RTSystemServicesProtocolPort::dummy() { - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::OUT_dummy)); - PortBase::send(RTSystemServicesProtocol::OUT_dummy); -}; - -//------------------------------------------------------------------ -// RTSystemServicesProtocolPortRepl -//------------------------------------------------------------------ - - -RTSystemServicesProtocolPortRepl:: -RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address> peerAddress) -: m_replication(addr.size()), - m_ports() -{ - char numstr[10]; // enough to hold all numbers up to 32-bits - - //m_ports.reserve(m_replication); - m_ports = reinterpret_cast<RTSystemServicesProtocolPort*> (new char[sizeof(RTSystemServicesProtocolPort) * addr.size()]); - - for (int i = 0; i < m_replication; ++i) { - snprintf(numstr, sizeof(numstr), "%d", i); - new (&m_ports[i]) RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]); - - //m_ports.push_back(std::auto_ptr_ref<RTSystemServicesProtocolPort>(new RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i], false))); - //m_ports[i] = std::auto_ptr<RTSystemServicesProtocolPort>(new RTSystemServicesProtocolPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i])); - } -// for (int i = 0; i < m_replication; ++i) { -// DebuggingService::getInstance().addPortInstance(m_ports.at(i)); -// } - -}; - -// outgoing messages - -void RTSystemServicesProtocolPortRepl::dummy() { - for (int i = 0; i < m_replication; ++i) { - m_ports[i].dummy(); - } -}; - -//------------------------------------------------------------------ -// RTSystemServicesProtocolConjPort -//------------------------------------------------------------------ - -RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent, - std::string name, int localId, Address addr, Address peerAddress, bool doRegistration) - : PortBase(actor, parent, name, localId, 0, addr, peerAddress) -{ - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } -} -RTSystemServicesProtocolConjPort::RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent, - std::string name, int localId, int idx, Address addr, - Address peerAddress, bool doRegistration) -: PortBase(actor, parent, name, localId, idx, addr, peerAddress) -{ - if (doRegistration) { - DebuggingService::getInstance().addPortInstance(*this); - } -} - -void RTSystemServicesProtocolConjPort::receive(Message* msg) { - if (! RTSystemServicesProtocol::isValidOutgoingEvtID(msg->getEvtId())) { //conjugated port receives out-messages - std::cout << "unknown" << std::endl; - } - else { - if (msg->hasDebugFlagSet()) { // TODO: model switch for activation of this flag - DebuggingService::getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), RTSystemServicesProtocol::getMessageString(msg->getEvtId())); - } - getEventReceiver().receiveEvent(this, msg->getEvtId(), msg->getData()); - } -} - -// sent messages - -void RTSystemServicesProtocolConjPort::executeInitialTransition() { - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_executeInitialTransition)); - PortBase::send(RTSystemServicesProtocol::IN_executeInitialTransition); -} - -void RTSystemServicesProtocolConjPort::startDebugging() { - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_startDebugging)); - PortBase::send(RTSystemServicesProtocol::IN_startDebugging); -} - -void RTSystemServicesProtocolConjPort::stopDebugging() { - DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), - RTSystemServicesProtocol::getMessageString(RTSystemServicesProtocol::IN_stopDebugging)); - PortBase::send(RTSystemServicesProtocol::IN_stopDebugging); -} - -//------------------------------------------------------------------ -// RTSystemServicesProtocolConjPortRepl -//------------------------------------------------------------------ - -RTSystemServicesProtocolConjPortRepl:: -RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, const std::vector<Address>& addr, const std::vector<Address>& peerAddress) -: m_replication(addr.size()), - m_ports() -{ - char numstr[10]; // enough to hold all numbers up to 32-bits - m_ports = reinterpret_cast<RTSystemServicesProtocolConjPort*> (new char[sizeof(RTSystemServicesProtocolConjPort) * addr.size()]); - for (int i = 0; i < m_replication; ++i) { - snprintf(numstr, sizeof(numstr), "%d", i); - //placement new to avoid copy construction, therefore no vector is used - new (&m_ports[i]) RTSystemServicesProtocolConjPort(actor, parent, name + numstr, localId, i, addr[i], peerAddress[i]); - } - -}; - -// sent messages - -void RTSystemServicesProtocolConjPortRepl::executeInitialTransition() { - for (int i = 0; i < m_replication; ++i) { - m_ports[i].executeInitialTransition(); - } -} - -void RTSystemServicesProtocolConjPortRepl::startDebugging() { - for (int i = 0; i < m_replication; ++i) { - m_ports[i].startDebugging(); - } -} - -void RTSystemServicesProtocolConjPortRepl::stopDebugging() { - for (int i = 0; i < m_replication; ++i) { - m_ports[i].stopDebugging(); - } -} - - -} /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h deleted file mode 100644 index d2646df61..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/RTSystemServicesProtocol.h +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#ifndef RTSYSTEMSERVICESPROTOCOL_H_ -#define RTSYSTEMSERVICESPROTOCOL_H_ - -#include "common/modelbase/PortBase.h" -#include "common/modelbase/IEventReceiver.h" -#include "common/messaging/Address.h" -#include <vector> -#include <string> -#include <memory> - -namespace etRuntime { - -//--------------------------------------------------- -// interface for port class -//--------------------------------------------------- -class IRTSystemServicesProtocolPort { -public: - virtual ~IRTSystemServicesProtocolPort() {}; - virtual void dummy() = 0; -}; - -//--------------------------------------------------- -// interface for conjugated port class -//--------------------------------------------------- -class IRTSystemServicesProtocolConjPort { -public: - virtual ~IRTSystemServicesProtocolConjPort() {}; - virtual void executeInitialTransition() = 0; - virtual void startDebugging() = 0; - virtual void stopDebugging() = 0; -}; - - -class RTSystemServicesProtocol { -public: - enum eventIDs { - MSG_MIN = 0, - OUT_dummy = 1, - MSG_SEP = 2, - IN_executeInitialTransition = 2, - IN_startDebugging = 3, - IN_stopDebugging = 4, - MSG_MAX = 5 - }; - static bool isValidEvtID(int evtId) { - return ((MSG_MIN < evtId) && (evtId < MSG_MAX)); - }; - static bool isValidOutgoingEvtID(int evtId) { - return ((MSG_MIN < evtId) && (evtId < MSG_SEP)); - }; - static bool isValidIncomingEvtID(int evtId) { - return ((MSG_SEP <= evtId) && (evtId < MSG_MAX)); - }; - static std::string getMessageString(int msg_id); - - private: - static std::string s_messageStrings[]; - - RTSystemServicesProtocol(); - virtual ~RTSystemServicesProtocol(); -}; - - //--------------------------------------------------- - // port class - //--------------------------------------------------- - class RTSystemServicesProtocolPort : public PortBase , public IRTSystemServicesProtocolPort { - public: - RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name, - int localId, Address addr, Address peerAddress, bool doRegistration = true); - - RTSystemServicesProtocolPort(IEventReceiver& actor, IRTObject* parent, std::string name, - int localId, int idx, Address addr, Address peerAddress, bool doRegistration = true); - - virtual void receive(Message* m); - // sent messages - void dummy(); - }; - - //--------------------------------------------------- - // replicated port class - //--------------------------------------------------- - class RTSystemServicesProtocolPortRepl: public IRTSystemServicesProtocolPort { - private: - int m_replication; - RTSystemServicesProtocolPort* m_ports; - - public: - RTSystemServicesProtocolPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, - const std::vector<Address>& addr, const std::vector<Address> peerAddress); - - int getReplication() const { return m_replication; } ; - RTSystemServicesProtocolPort& get(int i) { return m_ports[i]; }; - // outgoing messages - void dummy(); - }; - - - //--------------------------------------------------- - // conjugated port class - //--------------------------------------------------- - class RTSystemServicesProtocolConjPort : public PortBase, public IRTSystemServicesProtocolConjPort{ - public: - RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent, - std::string name, int localId, Address addr, Address peerAddress, bool doRegistration = true); - RTSystemServicesProtocolConjPort(IEventReceiver& actor, IRTObject* parent, - std::string name, int localId, int idx, Address addr, - Address peerAddress, bool doRegistration = true); - - virtual void receive(Message* m); - void executeInitialTransition(); - void startDebugging(); - void stopDebugging(); - }; - - //--------------------------------------------------- - // replicated conjugated port class - //--------------------------------------------------- - class RTSystemServicesProtocolConjPortRepl : public IRTSystemServicesProtocolConjPort{ - private: - int m_replication; - RTSystemServicesProtocolConjPort* m_ports; //dynamic array used instead of vector to avoid copy construction - - public: - RTSystemServicesProtocolConjPortRepl(IEventReceiver& actor, IRTObject* parent, std::string name, int localId, - const std::vector<Address>& addr, const std::vector<Address>& peerAddress); - - int getReplication() const { return m_replication; } ; - RTSystemServicesProtocolConjPort& get(int i) { return m_ports[i]; }; - - void executeInitialTransition(); - void startDebugging(); - void stopDebugging(); - }; - -} /* namespace etRuntime */ -#endif /* RTSYSTEMSERVICESPROTOCOL_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp index 6cfc0cc92..931449b55 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.cpp @@ -11,32 +11,68 @@ *******************************************************************************/ #include "ActorClassBase.h" +#include "common/modelbase/InterfaceItemBase.h" +#include "common/modelbase/RTSystemServicesProtocol.h" +#include "common/modelbase/SystemPortOwner.h" +#include "etDatatypes.h" +#include <iterator> +#include <string> +#include <vector> + namespace etRuntime { -ActorClassBase::ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr) - : EventReceiver(parent, name), - IMessageReceiver(), +ActorClassBase::ActorClassBase(IRTObject* parent, const std::string& name) : + SystemPortOwner(parent, name), m_state(0), - history(0), //to be instantiated by derived class - m_RTSystemPort(0), - m_className("noname"), - m_ownAddr(ownAddr), - m_ownMsgsvc(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddr.m_threadID)) { - - // own ports - m_RTSystemPort = new RTSystemServicesProtocolPort(*this, this, "RTSystemPort", 0, 0, ownAddr, - systemPortPeerAddr); + m_RTSystemPort(this, IFITEM_RTSystemPort), + m_className("noname") { } ActorClassBase::~ActorClassBase() { - delete m_RTSystemPort; - m_RTSystemPort = 0; - delete history; - history = 0; + m_state = 0; +} + +//SubSystemClassBase* ActorClassBase::getSubSystem() const { +// return 0; // TODO JH +//} + +//--------------------- life cycle functions +void ActorClassBase::init() { + ActorClassBase* child = 0; + for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) { + if ((child = dynamic_cast<ActorClassBase*>(*it)) != 0) + child->init(); + } + + initUser(); +} + +void ActorClassBase::start() { + ActorClassBase* child = 0; + for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) { + if ((child = dynamic_cast<ActorClassBase*>(*it)) != 0) + child->start(); + } + + startUser(); } -bool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) { +void ActorClassBase::stop() { + stopUser(); + + ActorClassBase* child = 0; + for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) { + if ((child = dynamic_cast<ActorClassBase*>(*it)) != 0) + child->stop(); + } +} + +void ActorClassBase::destroy() { + SystemPortOwner::destroy(); +} + +etBool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) { if ((ifitem != 0) && (ifitem->getLocalId() != 0)) { return false; } @@ -55,8 +91,12 @@ bool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* return true; } -std::string ActorClassBase::toString() { - return "ActorClass(className=" + m_className + ", instancePath=" + getInstancePath() + ")"; +std::string ActorClassBase::toString() const { + ActorClassBase* thisPtr = const_cast<ActorClassBase*>(this); + char buffer[10]; + sprintf(buffer, "%i", thisPtr->getThread()); + + return getName() + " : " + getClassName() + " thread:" + buffer; } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h index 3efca3121..7bd002ca9 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ActorClassBase.h @@ -13,64 +13,86 @@ #ifndef ACTORCLASSBASE_H_ #define ACTORCLASSBASE_H_ -#include "common/modelbase/EventReceiver.h" +#include "common/messaging/Address.h" #include "common/messaging/IMessageReceiver.h" -#include "common/messaging/RTServices.h" -#include "common/messaging/RTSystemServicesProtocol.h" +#include "common/modelbase/RTSystemProtocol.h" +#include "common/modelbase/SystemPortOwner.h" +#include "etDatatypes.h" +#include <string> namespace etRuntime { -class ActorClassBase: public EventReceiver, public IMessageReceiver { + + +class ActorClassBase: public SystemPortOwner, public virtual IMessageReceiver { public: - ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr); + virtual ~ActorClassBase(); - std::string toString(); - std::string getClassName() const { return m_className; } - void setClassName(std::string className) { m_className = className; } - virtual Address getAddress() const { + const std::string& getClassName() const { + return m_className; + } + + void setClassName(const std::string& className) { + m_className = className; + } + + virtual const Address& getAddress() const { // TODO: Actor should have its own address for services and debugging - return Address(0,0,0); + return Address::EMPTY; } + //SubSystemClassBase* getSubSystem() const; + //--------------------- lifecycle functions // automatically generated lifecycle functions - virtual void init() = 0; - virtual void start() = 0; - virtual void stop() = 0; - virtual void destroy() = 0; + virtual void init(); + virtual void start(); + virtual void stop(); + virtual void destroy(); virtual void executeInitTransition() = 0; // not automatically generated lifecycle functions // are called, but with empty implementation -> can be overridden by user - void initUser() { } - void startUser() { } - void stopUser() { } - void destroyUser() { } - virtual void receive(Message* msg) { } + virtual void initUser() { + } + virtual void startUser() { + } + virtual void stopUser() { + } + + virtual void receive(const Message* msg) { + } - int getState() const { return m_state; } - MessageService* getMsgsvc() const { return m_ownMsgsvc; } + int getState() const { + return m_state; + } protected: + + ActorClassBase(IRTObject* parent, const std::string&); + static const int EVT_SHIFT = 1000; // TODOHRR: use 256 or shift operation later static const int NO_STATE = 0; static const int STATE_TOP = 1; static const int NOT_CAUGHT = 0; + static const int IFITEM_RTSystemPort = 0; /** * the current state */ int m_state; - int* history; //Todo pka: name is not prefixed by m_ because generic generator uses this member - RTSystemServicesProtocolPort* m_RTSystemPort; + RTSystemPort m_RTSystemPort; - virtual bool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data); + virtual etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data); + std::string toString() const; private: std::string m_className; - Address m_ownAddr; - MessageService* m_ownMsgsvc; + + ActorClassBase(); + ActorClassBase(ActorClassBase const&); + ActorClassBase& operator=(ActorClassBase const&); }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp new file mode 100644 index 000000000..5726012ac --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.cpp @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +#include "common/modelbase/DataPort.h" +#include <string> + +namespace etRuntime { + +void DataPortBase::connect(IRTObject* obj, const std::string& path1, const std::string& path2) { + IRTObject* obj1 = obj->getObject(path1); + IRTObject* obj2 = obj->getObject(path2); + + DataReceivePort* recvPort = dynamic_cast<DataReceivePort*>(obj1); + DataSendPort* sendPort = dynamic_cast<DataSendPort*>(obj2); + if (recvPort == 0 || sendPort == 0) { + recvPort = dynamic_cast<DataReceivePort*>(obj2); + sendPort = dynamic_cast<DataSendPort*>(obj1); + } + + if (recvPort != 0 && sendPort != 0) + recvPort->connect(sendPort); +} + +} + diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h new file mode 100644 index 000000000..eac2b6b21 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/DataPort.h @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_DATAPORT_H_ +#define SRC_COMMON_MODELBASE_DATAPORT_H_ + +#include "common/messaging/RTObject.h" +#include <string> + +namespace etRuntime { + +class DataPortBase: public RTObject { +public: + static void connect(IRTObject* obj, const std::string& path1, const std::string& path2); + + DataPortBase(IRTObject* parent, const std::string& name, int localId) : + RTObject(parent, name), + m_localId(localId) { + } + + int getLocalId() const { + return m_localId; + } + +private: + int m_localId; + + DataPortBase(); + DataPortBase(DataPortBase const&); + DataPortBase& operator=(DataPortBase const&); +}; + +class DataSendPort: public DataPortBase { +public: + DataSendPort(IRTObject* parent, const std::string& name, int localId) : + DataPortBase(parent, name, localId) { + } + +private: + + DataSendPort(DataSendPort const&); + DataSendPort& operator=(DataSendPort const&); +}; + +class DataReceivePort: public DataPortBase { + friend class DataPortBase; +public: + DataReceivePort(IRTObject* parent, const std::string& name, int localId) : + DataPortBase(parent, name, localId) { + } + + virtual void connect(DataSendPort* dataSendPort) = 0; +private: + + DataReceivePort(DataReceivePort const&); + DataReceivePort& operator=(DataReceivePort const&); +}; + +} /* namespace etRuntime */ + +#endif /* SRC_COMMON_MODELBASE_DATAPORT_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp index 818229e9f..9ca651026 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.cpp @@ -10,12 +10,29 @@ * *******************************************************************************/ -#include "EventReceiver.h" +#include "common/modelbase/EventReceiver.h" +#include <string> namespace etRuntime { +EventReceiver::EventReceiver(IRTObject* parent, const std::string& name) : + RTObject(parent, name), + m_thread(-1) { +} + +int EventReceiver::getThread() { + if (m_thread < 0) { + m_thread = getThreadForPath(getInstancePath()); + if (m_thread < 0) { + IEventReceiver* parent = dynamic_cast<IEventReceiver*>(getParent()); + if (parent != 0) + m_thread = parent->getThread(); + else + m_thread = 0; + } + } -EventReceiver::~EventReceiver() { + return m_thread; } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h index 6a2dfae38..e67df44b9 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/EventReceiver.h @@ -19,18 +19,22 @@ namespace etRuntime { -class EventReceiver : public RTObject, public IEventReceiver{ +class EventReceiver : public RTObject, public virtual IEventReceiver{ public: - EventReceiver(IRTObject* parent, std::string name) - : RTObject(parent, name), - IEventReceiver() - {}; - virtual ~EventReceiver(); + + virtual ~EventReceiver() {} + + virtual int getThread(); + +protected: + EventReceiver(IRTObject* parent, const std::string& name); private: - EventReceiver(); - EventReceiver(const EventReceiver& right); - EventReceiver& operator=(const EventReceiver& right); + + int m_thread; + + EventReceiver(EventReceiver const&); + EventReceiver& operator=(EventReceiver const&); }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h index 627195838..5edcc8754 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.h @@ -16,15 +16,15 @@ #include "common/messaging/IRTObject.h" namespace etRuntime { - class InterfaceItemBase; -class IEventReceiver { +class InterfaceItemBase; + +class IEventReceiver: public virtual IRTObject { public: - IEventReceiver(); - virtual ~IEventReceiver(); + virtual ~IEventReceiver() {} virtual void receiveEvent(InterfaceItemBase* ifitem, int evt, void* data) = 0; - + virtual int getThread() = 0; }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IInterfaceItem.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IInterfaceItem.h new file mode 100644 index 000000000..6796a3ff4 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IInterfaceItem.h @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_IINTERFACEITEM_H_ +#define SRC_COMMON_MODELBASE_IINTERFACEITEM_H_ + +#include "common/messaging/IRTObject.h" + +namespace etRuntime { + +class IInterfaceItem : public virtual IRTObject { +public: + virtual ~IInterfaceItem() {} + virtual IInterfaceItem* connectWith(IInterfaceItem* peer) = 0; +}; + +} /* namespace etRuntime */ + +#endif /* SRC_COMMON_MODELBASE_IINTERFACEITEM_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IInterfaceItemOwner.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IInterfaceItemOwner.h new file mode 100644 index 000000000..0c705419d --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IInterfaceItemOwner.h @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_IINTERFACEITEMOWNER_H_ +#define SRC_COMMON_MODELBASE_IINTERFACEITEMOWNER_H_ + +#include "common/messaging/IRTObject.h" + +namespace etRuntime { + +class IReplicatedInterfaceItem; +class IEventReceiver; + +class IInterfaceItemOwner: public virtual IRTObject { +public: + virtual ~IInterfaceItemOwner() {} + virtual IEventReceiver* getEventReceiver() const = 0; + virtual IReplicatedInterfaceItem* getSystemPort() const = 0; +}; + +} /* namespace etRuntime */ +#endif /* SRC_COMMON_MODELBASE_IINTERFACEITEMOWNER_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IReplicatedInterfaceItem.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IReplicatedInterfaceItem.h new file mode 100644 index 000000000..0713ee808 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IReplicatedInterfaceItem.h @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_IREPLICATEDINTERFACEITEM_H_ +#define SRC_COMMON_MODELBASE_IREPLICATEDINTERFACEITEM_H_ + +#include "common/modelbase/IInterfaceItem.h" + +namespace etRuntime { + +class InterfaceItemBase; + +class IReplicatedInterfaceItem: public virtual IInterfaceItem { +public: + virtual ~IReplicatedInterfaceItem() {} + + virtual InterfaceItemBase* createSubInterfaceItem() = 0; + virtual void removeItem(InterfaceItemBase& item) = 0; +}; +} /* namespace etRuntime */ + +#endif /* SRC_COMMON_MODELBASE_IREPLICATEDINTERFACEITEM_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp index c689f5feb..2834ff487 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.cpp @@ -10,51 +10,137 @@ * *******************************************************************************/ -#include "InterfaceItemBase.h" -#include "common/messaging/AbstractMessageReceiver.h" +#include "common/messaging/MessageServiceController.h" +#include "common/messaging/RTObject.h" #include "common/messaging/RTServices.h" +#include "common/modelbase/IEventReceiver.h" +#include "common/modelbase/IInterfaceItemOwner.h" +#include "common/modelbase/InterfaceItemBase.h" +#include "common/modelbase/IReplicatedInterfaceItem.h" +#include <string> namespace etRuntime { -InterfaceItemBase::InterfaceItemBase (IEventReceiver& evtReceiver, IRTObject* parent, std::string name, int localId, int idx, Address ownAddress, Address peerAddress) -: AbstractMessageReceiver(parent, ownAddress, name), - m_idx(idx), - m_localId(localId), - m_actorPath(name), - m_peerAddress(peerAddress), - m_ownMsgReceiver(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddress.m_threadID)), - m_peerMsgReceiver(peerAddress.isValid()? RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(peerAddress.m_threadID): 0), - m_eventReceiver(&evtReceiver) -{ - if (getAddress().isValid() && m_ownMsgReceiver->isMsgService()) { - MessageService* ms = static_cast<MessageService*>(m_ownMsgReceiver); - // register at the own dispatcher to receive messages - ms->getMessageDispatcher().addMessageReceiver(*this); - } - if (parent) { - m_actorPath = parent->getInstancePath(); +void InterfaceItemBase::connect(IRTObject* obj, const std::string& path1, const std::string& path2) { + IRTObject* obj1 = obj->getObject(path1); + IRTObject* obj2 = obj->getObject(path2); + + IInterfaceItem* ifItem1 = dynamic_cast<IInterfaceItem*>(obj1); + IInterfaceItem* ifItem2 = dynamic_cast<IInterfaceItem*>(obj2); + + if (ifItem1 != 0 && ifItem2 != 0) { + ifItem1->connectWith(ifItem2); } } -InterfaceItemBase::InterfaceItemBase(const InterfaceItemBase & right) -: AbstractMessageReceiver(right), - m_idx(right.m_idx), - m_localId(right.m_localId), - m_actorPath(right.m_actorPath), - m_peerAddress(right.m_peerAddress), - m_ownMsgReceiver(right.m_ownMsgReceiver), - m_peerMsgReceiver(right.m_peerMsgReceiver), - m_eventReceiver(right.m_eventReceiver) -{ +InterfaceItemBase::InterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId, int idx) : + AbstractMessageReceiver(owner->getEventReceiver(), name), + m_localId(localId), + m_idx(idx), + m_peerAddress(Address::EMPTY), + m_peer(0), + m_ownMsgReceiver(0), + m_peerMsgReceiver(0), + m_replicator(0) { -} + m_replicator = dynamic_cast<IReplicatedInterfaceItem*>(owner); + int thread = owner->getEventReceiver()->getThread(); + if (thread >= 0) { + IMessageService* msgSvc = RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(thread); + Address addr = msgSvc->getFreeAddress(); + setAddress(addr); + msgSvc->addMessageReceiver(*this); + + m_ownMsgReceiver = msgSvc; + } +} InterfaceItemBase::~InterfaceItemBase() { + m_peerAddress = Address::EMPTY; m_ownMsgReceiver = 0; m_peerMsgReceiver = 0; - m_eventReceiver = 0; +} + +IInterfaceItem* InterfaceItemBase::connectWith(IInterfaceItem* peer) { + if (peer != 0) { + m_peer = peer; + +// if (peer instanceof IInterfaceItemBroker) { +// this.peer = peer.connectWith(this); +// return this.peer; +// } + + IReplicatedInterfaceItem* replPeer = dynamic_cast<IReplicatedInterfaceItem*>(m_peer); + if (replPeer != 0) { + m_peer = replPeer->createSubInterfaceItem(); + } + + InterfaceItemBase* ifItemPeer = dynamic_cast<InterfaceItemBase*>(m_peer); + if (ifItemPeer != 0) { + // connect with each other + m_peerAddress = ifItemPeer->getAddress(); + ifItemPeer->m_peerAddress = getAddress(); + m_peerMsgReceiver = ifItemPeer->m_ownMsgReceiver; + ifItemPeer->m_peerMsgReceiver = m_ownMsgReceiver; + } + + } + + return peer; +} + +void InterfaceItemBase::disconnect() { + disconnectInternal(); + if (m_peer != 0) { + InterfaceItemBase* peer = dynamic_cast<InterfaceItemBase*>(m_peer); + if (peer != 0) + peer->disconnectInternal(); + m_peer = 0; + } +} + +void InterfaceItemBase::disconnectInternal() { + m_peerAddress = Address::EMPTY; + m_peerMsgReceiver = 0; + + if (m_replicator != 0) + destroy(); +} + +IEventReceiver* InterfaceItemBase::getActor() const { + return dynamic_cast<IEventReceiver*>(getParent()); +} + +void InterfaceItemBase::destroy() { + if (m_peerAddress.isValid()) { + disconnect(); + } + + if (m_replicator != 0) { + m_replicator->removeItem(*this); + } + + m_ownMsgReceiver->removeMessageReceiver(*this); + m_ownMsgReceiver->freeAddress(getAddress()); + + AbstractMessageReceiver::destroy(); +} + +std::string InterfaceItemBase::toString() const { + std::stringstream result; + + result << ((m_replicator != 0) ? "sub " : ""); + result << "port " + getName() << " " << getAddress().toID() << " "; + if(m_peerMsgReceiver == 0) + result << "UNCONNECTED"; + else { + result << " -> "; + result << ((m_peer != 0) ? m_peer->getName() : "?"); + result << " " << m_peerAddress.toID(); + } + return result.str(); } } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h index 70187be3e..0cc5de218 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/InterfaceItemBase.h @@ -13,48 +13,72 @@ #ifndef INTERFACEITEMBASE_H_ #define INTERFACEITEMBASE_H_ -#include "common/messaging/Address.h" -#include "common/messaging/IMessageReceiver.h" -#include "common/modelbase/IEventReceiver.h" #include "common/messaging/AbstractMessageReceiver.h" +#include "common/messaging/Address.h" +#include "common/messaging/IMessageService.h" +#include "common/modelbase/IInterfaceItem.h" #include <string> namespace etRuntime { -class IEventReceiver; +class IReplicatedInterfaceItem; +class IInterfaceItemOwner; +class IEventReceiver; +class IMessageService; -class InterfaceItemBase : public AbstractMessageReceiver{ +class InterfaceItemBase: public AbstractMessageReceiver, public virtual IInterfaceItem { public: - InterfaceItemBase (IEventReceiver& evtReceiver, IRTObject* parentActor, std::string name, int localId, int idx, Address ownAddress, Address peerAddress); - InterfaceItemBase(const InterfaceItemBase & right); + static void connect(IRTObject* obj, const std::string& path1, const std::string& path2); + virtual ~InterfaceItemBase(); - int getIdx() const { return m_idx; } ; - IEventReceiver& getEventReceiver() { return *m_eventReceiver; }; - std::string& getActorPath() { return m_actorPath; }; - int getLocalId() const {return m_localId; }; + // TODO JH sync on several member functions needed + IInterfaceItem* connectWith(IInterfaceItem* peer); + void disconnect(); + int getLocalId() const { + return m_localId; + } + + int getIdx() const { + return m_idx; + } - void setMsgReceiver(IMessageReceiver& msgReceiver) { m_ownMsgReceiver = &msgReceiver; }; + IEventReceiver* getActor() const; + virtual std::string toString() const; protected: - IMessageReceiver* getMsgReceiver() const{ return m_ownMsgReceiver; }; - IMessageReceiver* getPeerMsgReceiver() const { return m_peerMsgReceiver; }; - Address getPeerAddress() const { return m_peerAddress; }; + InterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId, int idx); -private: + IMessageReceiver* getMsgReceiver() const { + return m_ownMsgReceiver; + } - int m_idx; - int m_localId; + const Address& getPeerAddress() const { + return m_peerAddress; + } + + IMessageReceiver* getPeerMsgReceiver() const { + return m_peerMsgReceiver; + } - std::string m_actorPath; + virtual void destroy(); + +private: + int m_localId; + int m_idx; Address m_peerAddress; - IMessageReceiver* m_ownMsgReceiver; + IInterfaceItem* m_peer; + IMessageService* m_ownMsgReceiver; IMessageReceiver* m_peerMsgReceiver; - IEventReceiver* m_eventReceiver; + + IReplicatedInterfaceItem* m_replicator; + + void disconnectInternal(); InterfaceItemBase(); - InterfaceItemBase & operator = (const InterfaceItemBase& right); + InterfaceItemBase(InterfaceItemBase const&); + InterfaceItemBase& operator =(InterfaceItemBase const&); }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp deleted file mode 100644 index ad880933d..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#include "PortBase.h" - -namespace etRuntime { - - -PortBase::~PortBase() { -} - -void PortBase::send(int evtID) { - - //TODO: how to avoid logging timerTicks - //if (s_messageStrings[IRTSystemServicesProtocolPort::OUT_dummy] != "timerTick") { - // TODOTS: model switch for activation - if (getPeerAddress().isValid()) - getPeerMsgReceiver()->receive( - new Message(getPeerAddress(), evtID)); //TODO: placement new mit message pool verwenden - -}; - -} /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h index 9b0e6f04a..9fbb2c1be 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/PortBase.h @@ -13,29 +13,30 @@ #ifndef PORTBASE_H_ #define PORTBASE_H_ +#include "common/modelbase/IInterfaceItemOwner.h" #include "common/modelbase/InterfaceItemBase.h" -#include "common/messaging/Address.h" #include <string> namespace etRuntime { -class IEventReceiver; - -class PortBase : public InterfaceItemBase{ -public: - PortBase (IEventReceiver& actor, IRTObject* parent, std::string name, int localId, int idx, Address address, Address peerAddress) - : InterfaceItemBase(actor, parent, name, localId, idx, address, peerAddress){}; - PortBase(const PortBase & right) - : InterfaceItemBase(right) {}; +class PortBase: public InterfaceItemBase { - virtual ~PortBase(); +public: + virtual ~PortBase() {} - virtual void send(int evtID); +protected: + PortBase(IInterfaceItemOwner* owner, const std::string& name, int localId) : + InterfaceItemBase(owner, name, localId, 0) { + } + PortBase(IInterfaceItemOwner* owner, const std::string& name, int localId, int idx) : + InterfaceItemBase(owner, name, localId, idx) { + } private: - PortBase(); - PortBase & operator = (const PortBase& right); + + PortBase(PortBase const&); + PortBase & operator =(PortBase const&); }; diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h new file mode 100644 index 000000000..4dbae420c --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystem.h @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_RTSYSTEM_H_ +#define SRC_COMMON_MODELBASE_RTSYSTEM_H_ + +#include "common/messaging/RTObject.h" +#include <string> + +namespace etRuntime { + +class RTSystem: public RTObject { + +public: + explicit RTSystem(std::string name) : + RTObject(0, name) { + } + virtual ~RTSystem() {} + +private: + RTSystem(); + RTSystem(RTSystem const&); + RTSystem& operator=(RTSystem const&); + +}; + +} // namespace etRuntime + +#endif /* SRC_COMMON_MODELBASE_RTSYSTEM_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp new file mode 100644 index 000000000..91eb0e865 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.cpp @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +#include "common/modelbase/IEventReceiver.h" +#include "common/modelbase/RTSystemProtocol.h" +#include <string> + +namespace etRuntime { + +const std::string RTSystemProtocol::RT_SYSTEM_PORT_NAME = "RTSystemPort"; + +RTSystemPort::RTSystemPort(IInterfaceItemOwner* actor, int localId) : + RTSystemServicesProtocolPort(actor, RTSystemProtocol::RT_SYSTEM_PORT_NAME, localId) { + + // since we have no mapping for the system ports we connect them directly here + IReplicatedInterfaceItem* systemPort = actor->getSystemPort(); + if (systemPort != 0) { + InterfaceItemBase* peer = systemPort->createSubInterfaceItem(); + connectWith(peer); + } +} + +RTSystemConjPort::RTSystemConjPort(IInterfaceItemOwner* actor, int localId) : + RTSystemServicesProtocolConjReplPort(actor, RTSystemProtocol::RT_SYSTEM_PORT_NAME, localId) { +} + +InterfaceItemBase* RTSystemConjPort::createInterfaceItem(IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) { + return new RTSystemConjSubPort(rcv, name, lid, idx); +} + +RTSystemConjSubPort::RTSystemConjSubPort(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx) : + RTSystemServicesProtocolConjPort(actor, name, localId, idx) { +} + +} // namespace etRuntime + diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h new file mode 100644 index 000000000..61f0b8665 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/RTSystemProtocol.h @@ -0,0 +1,62 @@ +/* + * RTSystemProtocol.h + * + * Created on: 09.12.2015 + * Author: Juergen + */ + +#ifndef SRC_COMMON_MESSAGING_RTSYSTEMPROTOCOL_H_ +#define SRC_COMMON_MESSAGING_RTSYSTEMPROTOCOL_H_ + +#include "common/modelbase/RTSystemServicesProtocol.h" +#include <string> + +namespace etRuntime { + +class RTSystemProtocol { +public: + static const std::string RT_SYSTEM_PORT_NAME; +}; + + +class RTSystemPort: public RTSystemServicesProtocolPort { + +public: + RTSystemPort(IInterfaceItemOwner* actor, int localId); + +private: + RTSystemPort(); + RTSystemPort(RTSystemPort const&); + RTSystemPort& operator=(RTSystemPort const&); + +}; + +class RTSystemConjPort: public RTSystemServicesProtocolConjReplPort { +public: + RTSystemConjPort(IInterfaceItemOwner* actor, int localId); + virtual ~RTSystemConjPort() {} + +protected: + virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx); + +private: + RTSystemConjPort(); + RTSystemConjPort(RTSystemConjPort const&); + RTSystemConjPort& operator=(RTSystemConjPort const&); +}; + +class RTSystemConjSubPort: public RTSystemServicesProtocolConjPort { +public: + RTSystemConjSubPort(IInterfaceItemOwner* actor, const std::string& name, int localId, int idx); + virtual ~RTSystemConjSubPort() {} + +private: + RTSystemConjSubPort(); + RTSystemConjSubPort(RTSystemConjSubPort const&); + RTSystemConjSubPort& operator=(RTSystemConjSubPort const&); + +}; + +} /* namespace etRuntime */ + +#endif /* SRC_COMMON_MESSAGING_RTSYSTEMPROTOCOL_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp new file mode 100644 index 000000000..9b716f9c4 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.cpp @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +#include "common/messaging/RTObject.h" +#include "common/modelbase/IEventReceiver.h" +#include "common/modelbase/ReplicatedInterfaceItemBase.h" +#include <iterator> +#include <queue> +#include <string> +#include <vector> + +namespace etRuntime { + +ReplicatedInterfaceItemBase::ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId) : + RTObject(owner, name), + m_localId(localId), + m_items(), + m_releasedIndices() { + +} + +InterfaceItemBase* ReplicatedInterfaceItemBase::createSubInterfaceItem() { + int newIndex = getFreeIndex(); + std::stringstream itemName; + itemName << getName() << SEP << newIndex; + + InterfaceItemBase* item = createInterfaceItem(this, itemName.str(), m_localId, newIndex); + m_items.push_back(item); + return item; +} + +void ReplicatedInterfaceItemBase::removeItem(InterfaceItemBase& item) { + std::vector<InterfaceItemBase*>::iterator it = m_items.begin(); + while (it != m_items.end() && *it != &item) { + ++it; + } + if (it != m_items.end()) { + m_items.erase(it); + m_releasedIndices.push(item.getIdx()); + } +} + +int ReplicatedInterfaceItemBase::getFreeIndex() { + if (m_releasedIndices.empty()) + return m_items.size(); + else { + int idx = m_releasedIndices.front(); + m_releasedIndices.pop(); + + return idx; + } +} + +InterfaceItemBase* ReplicatedInterfaceItemBase::getInterfaceItem(int idx) const { + for (std::vector<InterfaceItemBase*>::const_iterator it = m_items.begin(); it != m_items.end(); ++it) { + if ((*it)->getIdx() == idx) + return *it; + } + + return 0; +} + +IEventReceiver* ReplicatedInterfaceItemBase::getEventReceiver() const { + return dynamic_cast<IEventReceiver*>(getParent()); +} + +IReplicatedInterfaceItem* ReplicatedInterfaceItemBase::getSystemPort() const { + return dynamic_cast<IInterfaceItemOwner*>(getParent())->getSystemPort(); +} + +std::string ReplicatedInterfaceItemBase::toString() const { + return "replicated port " + getName(); +} + +IInterfaceItem* ReplicatedInterfaceItemBase::connectWith(IInterfaceItem* peer) { + // TODO JH dynamic +// if (peer instanceof InterfaceItemBroker) +// return peer.connectWith(this); +// else + return peer->connectWith(createSubInterfaceItem()); +} + +} // namespace etRuntime + diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h new file mode 100644 index 000000000..e1460d13e --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedInterfaceItemBase.h @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_REPLICATEDINTERFACEITEMBASE_H_ +#define SRC_COMMON_MODELBASE_REPLICATEDINTERFACEITEMBASE_H_ + +#include "common/modelbase/IInterfaceItemOwner.h" +#include "common/modelbase/InterfaceItemBase.h" +#include "common/modelbase/IReplicatedInterfaceItem.h" +#include <queue> +#include <string> +#include <vector> + +namespace etRuntime { + +class ReplicatedInterfaceItemBase: public RTObject, + public virtual IReplicatedInterfaceItem, + public virtual IInterfaceItemOwner { + +public: + static const char SEP = ':'; + + virtual ~ReplicatedInterfaceItemBase(){} + + virtual InterfaceItemBase* createSubInterfaceItem(); + virtual void removeItem(InterfaceItemBase& item); + + InterfaceItemBase* getInterfaceItem(int idx) const; + int getNInterfaceItems() const { + return m_items.size(); + } + + int getLocalId() const { + return m_localId; + } + + virtual IEventReceiver* getEventReceiver() const; + virtual IReplicatedInterfaceItem* getSystemPort() const; + + std::string toString() const; + + virtual IInterfaceItem* connectWith(IInterfaceItem* peer); + +protected: + + ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const std::string& name, int localId); + + std::vector<InterfaceItemBase*>& getItems() { + return m_items; + } + + virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const std::string& name, int lid, int idx) = 0; +private: + int m_localId; + std::vector<InterfaceItemBase*> m_items; + std::queue<int> m_releasedIndices; + + int getFreeIndex(); + + ReplicatedInterfaceItemBase(); + ReplicatedInterfaceItemBase(ReplicatedInterfaceItemBase const&); + ReplicatedInterfaceItemBase& operator=(ReplicatedInterfaceItemBase const&); +}; + +} // namespace etRuntime + +#endif /* SRC_COMMON_MODELBASE_REPLICATEDINTERFACEITEMBASE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h new file mode 100644 index 000000000..a3975093a --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/ReplicatedPortBase.h @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_REPLICATEDPORTBASE_H_ +#define SRC_COMMON_MODELBASE_REPLICATEDPORTBASE_H_ + +#include "common/modelbase/ReplicatedInterfaceItemBase.h" +#include <string> + +namespace etRuntime { + +class ReplicatedPortBase: public ReplicatedInterfaceItemBase { +public: + virtual ~ReplicatedPortBase() {} + +protected: + ReplicatedPortBase(IInterfaceItemOwner* owner, const std::string& name, int localId) : + ReplicatedInterfaceItemBase(owner, name, localId) { + } + +private: + + ReplicatedPortBase(); + ReplicatedPortBase(ReplicatedPortBase const&); + ReplicatedPortBase& operator=(ReplicatedPortBase const&); +}; + +} // namespace etRuntime + +#endif /* SRC_COMMON_MODELBASE_REPLICATEDPORTBASE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp index 550dba3dc..d627a2fac 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.cpp @@ -10,31 +10,28 @@ * *******************************************************************************/ -#include "SubSystemClassBase.h" -#include "common/messaging/MessageService.h" -#include "common/messaging/RTServices.h" -#include "ActorClassBase.h" +#include "common/modelbase/SubSystemClassBase.h" #include "common/debugging/DebuggingService.h" +#include "common/debugging/MSCLogger.h" +#include "common/messaging/MessageServiceController.h" +#include "common/messaging/RTServices.h" +#include "common/modelbase/ActorClassBase.h" +#include <iostream> +#include <iterator> +#include <map> +#include <string> +#include <vector> -namespace etRuntime { -SubSystemClassBase::~SubSystemClassBase() { - m_testSem = 0; - m_RTSystemPort = 0; -} +namespace etRuntime { -SubSystemClassBase::SubSystemClassBase(IRTObject* parent, std::string name) - : RTObject(parent, name), - IEventReceiver(), - m_RTSystemPort(0), - m_instances(), - m_testSem(0), - m_testErrorCode(0) -{ - DebuggingService::getInstance().getAsyncLogger().setMSC(name + "_Async", ""); +SubSystemClassBase::SubSystemClassBase(IRTObject* parent, std::string name) : + RTObject(parent, name), + m_RTSystemPort(this, IFITEM_RTSystemPort) { + DebuggingService::getInstance().getAsyncLogger().setMSC(name + "_Async", "log/"); DebuggingService::getInstance().getAsyncLogger().open(); - DebuggingService::getInstance().getSyncLogger().setMSC(name + "_Sync", ""); + DebuggingService::getInstance().getSyncLogger().setMSC(name + "_Sync", "log/"); DebuggingService::getInstance().getSyncLogger().open(); RTServices::getInstance().setSubSystem(this); @@ -53,46 +50,44 @@ void SubSystemClassBase::init() { // RTServices::getInstance().getMsgSvcCtrl().connectAll(); instantiateActors(); + std::cout << toStringRecursive() << std::endl; - // initialize all actor m_instances - for (unsigned int i = 0; i < m_instances.size(); i++) { - m_instances[i]->init(); + // initialize all actor instances + for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) { + ActorClassBase* child = dynamic_cast<ActorClassBase*>(*it); + if (child != 0) + child->init(); } } -void SubSystemClassBase::start(bool singlethreaded) { +void SubSystemClassBase::start() { // start all actors instances - m_RTSystemPort->executeInitialTransition(); + m_RTSystemPort.executeInitialTransition(); // start all message services - RTServices::getInstance().getMsgSvcCtrl().start(singlethreaded); + RTServices::getInstance().getMsgSvcCtrl().start(); } -void SubSystemClassBase::stop(bool singlethreaded) { - std::cout << "*** MainComponent " << this->getInstancePath() << "::stop ***" << std::endl; +void SubSystemClassBase::stop() { + std::cout << "*** MainComponent " << getInstancePath() << "::stop ***" << std::endl; - RTServices::getInstance().getMsgSvcCtrl().stop(singlethreaded); + RTServices::getInstance().getMsgSvcCtrl().stop(); std::cout << "=== done stop MsgSvcCtrl" << std::endl; // stop all actor instances - for (unsigned int i = 0; i < m_instances.size(); i++) { - m_instances[i]->stop(); + for (std::vector<IRTObject*>::iterator it = getChildren().begin(); it != getChildren().end(); ++it) { + ActorClassBase* child = dynamic_cast<ActorClassBase*>(*it); + if (child != 0) + child->stop(); } std::cout << "=== done stop actor instances" << std::endl; } -void SubSystemClassBase::runOnce() { - // run all message services one time - RTServices::getInstance().getMsgSvcCtrl().runOnce(); - -} - void SubSystemClassBase::destroy() { std::cout << "*** MainComponent " << this->getInstancePath() << "::destroy ***" << std::endl; - for (unsigned int i = 0; i < m_instances.size(); i++) { - m_instances[i]->destroy(); - } + RTObject::destroy(); + std::cout << toStringRecursive() << std::endl; std::cout << "=== done destroy actor instances" << std::endl; DebuggingService::getInstance().getAsyncLogger().close(); @@ -103,57 +98,31 @@ void SubSystemClassBase::destroy() { std::cout << "=== done destroy RTServices\n\n\n" << std::endl; } -MessageService* SubSystemClassBase::getMsgService(int idx) const { +IMessageService* SubSystemClassBase::getMsgService(int idx) const { return RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(idx); } -ActorClassBase* SubSystemClassBase::getInstance(unsigned int i) { - if (i < 0 || i >= m_instances.size()) - return 0; +ActorClassBase* SubSystemClassBase::getInstance(const std::string& path) const { + IRTObject* object = getObject(path); - return m_instances[i]; + return dynamic_cast<ActorClassBase*>(object); } -ActorClassBase* SubSystemClassBase::getInstance(std::string path) { - for (unsigned int i = 0; i < m_instances.size(); i++) { - if (m_instances[i]->getInstancePath() == path) - return m_instances[i]; - } - - return 0; +void SubSystemClassBase::addPathToThread(const std::string& path, int thread) { + m_path2thread[path] = thread; } -// this is to run integration tests -// TODO synchronized -void SubSystemClassBase::setTestSemaphore(TestSemaphore& sem) { - m_testErrorCode = -1; - m_testSem = &sem; -} +int SubSystemClassBase::getThreadForPath(const std::string& path) const { + std::map<std::string, int> ::const_iterator it = m_path2thread.find(path); + if (it == m_path2thread.end()) + return -1; -//TODO synchronized -int SubSystemClassBase::getTestErrorCode() const { - return m_testErrorCode; + return it->second; } -void SubSystemClassBase::testFinished(int errorCode) { - if (m_testSem != 0) { - std::cout - << "org.eclipse.etrice.runtime.cpp.modelbase.SubSystemClassBase.testFinished(int): before releasing semaphore" - << std::endl; - //m_testSem.printWaitingThreads(); - //TODO synchronized (this) { - m_testErrorCode = errorCode; - m_testSem->give(); - //} - std::cout - << "org.eclipse.etrice.runtime.cpp.modelbase.SubSystemClassBase.testFinished(int): semaphore released" - << std::endl; - //m_testSem.printWaitingThreads(); - //TODO - //Thread.yield(); - } +void SubSystemClassBase::resetAll() { + m_path2thread.clear(); } - } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h index ed5c8522b..bc80bede3 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemClassBase.h @@ -13,60 +13,74 @@ #ifndef SUBSYSTEMCLASSBASE_H_ #define SUBSYSTEMCLASSBASE_H_ -#include "common/messaging/RTSystemServicesProtocol.h" -#include "common/messaging/IRTObject.h" -#include "common/debugging/MSCLogger.h" -#include "common/modelbase/TestSemaphore.h" +#include "common/modelbase/IEventReceiver.h" +#include "common/modelbase/IInterfaceItemOwner.h" +#include "common/modelbase/IReplicatedInterfaceItem.h" +#include "common/modelbase/RTSystemProtocol.h" +#include "etDatatypes.h" +#include <map> #include <string> -#include <vector> -#include <iostream> + namespace etRuntime { -class MessageService; class ActorClassBase; -class SubSystemClassBase: public RTObject, public IEventReceiver { +class SubSystemClassBase: public RTObject, public virtual IEventReceiver, public virtual IInterfaceItemOwner { public: - SubSystemClassBase(IRTObject* parent, std::string name); - virtual ~SubSystemClassBase(); + virtual ~SubSystemClassBase() {} - void init(); + virtual void init(); virtual void instantiateMessageServices() = 0; virtual void instantiateActors() = 0; - void start(bool singlethreaded); - void stop(bool singlethreaded); - void runOnce(); + void start(); + void stop(); + virtual void destroy(); + + IMessageService* getMsgService(int idx) const; + Address getFreeAddress(int msgSvcId) const; + + ActorClassBase* getInstance(const std::string& path) const; + + void addPathToThread(const std::string& path, int thread); + int getThreadForPath(const std::string& path) const; + + void resetAll(); - void destroy(); + virtual IEventReceiver* getEventReceiver() const { + return const_cast<SubSystemClassBase*>(this); + } - MessageService* getMsgService(int idx) const; + virtual int getThread() { + return 0; + } - ActorClassBase* getInstance(unsigned int i); - ActorClassBase* getInstance(std::string path); + virtual IReplicatedInterfaceItem* getSystemPort() const { + return const_cast<RTSystemConjPort*>(&m_RTSystemPort); + } - //--------------------------------------------- - // this is to run integration tests - //--------------------------------------------- - // TODO synchronized - void setTestSemaphore(TestSemaphore& sem); - //TODO synchronized - int getTestErrorCode() const; - void testFinished(int errorCode); + virtual etBool hasGeneratedMSCInstrumentation() const { + return false; + } protected: - RTSystemServicesProtocolConjPortRepl* m_RTSystemPort; + + SubSystemClassBase(IRTObject* parent, std::string name); + + //--------------------- ports + RTSystemConjPort m_RTSystemPort; + //--------------------- interface item IDs static const int IFITEM_RTSystemPort = 0; - std::vector<ActorClassBase*> m_instances; + private: - TestSemaphore* m_testSem; - int m_testErrorCode; + + std::map<std::string, int> m_path2thread; SubSystemClassBase(); - SubSystemClassBase(const SubSystemClassBase& right); - SubSystemClassBase& operator=(const SubSystemClassBase& right); + SubSystemClassBase(SubSystemClassBase const&); + SubSystemClassBase& operator=(SubSystemClassBase const&); }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp index 9348c0d84..931527644 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.cpp @@ -10,114 +10,82 @@ * *******************************************************************************/ -#include "common/modelbase/SubSystemRunnerBase.h" +#include "SubSystemRunnerBase.h" + #include "common/modelbase/SubSystemClassBase.h" -#include "common/platform/etTimer.h" -#include <unistd.h> +#include "runtime/etRuntime.h" +#include "etUnit/etUnit.h" #include <iostream> #include <sstream> +#include <cstring> namespace etRuntime { const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST = "-run_as_test"; -const std::string SubSystemRunnerBase::OPTION_RUN_AS_TEST_SINGLETHREADED = "-run_as_test_single_threaded"; -const std::string SubSystemRunnerBase::OPTION_RUN_SINGLETHREADED = "-run_single_threaded"; - -TestSemaphore SubSystemRunnerBase::s_testSem; - -SubSystemRunnerBase::SubSystemRunnerBase() { -} - -SubSystemRunnerBase::~SubSystemRunnerBase() { -} +const std::string SubSystemRunnerBase::OPTION_RUN_HEADLESS = "-headless"; -void SubSystemRunnerBase::run(SubSystemClassBase& mainComponent, int argc, char* argv[] ) { - - //etUserEntry(); /* platform specific */ +void SubSystemRunnerBase::run(SubSystemClassBase& main_component, int argc, char* argv[]) { std::cout << "*** T H E B E G I N ***" << std::endl; - bool test = false; - bool singleThreaded = false; - int cycles = 100; - - for (int i=1; i<argc; ++i) { // omit first argument, which is the program name - if (SubSystemRunnerBase::OPTION_RUN_AS_TEST.compare(argv[i]) == 0) { + etBool headless = false; + for (int i = 1; i < argc; ++i) { // omit first argument, which is the program name + if (OPTION_RUN_AS_TEST.compare(argv[i]) == 0) { std::cout << "*** running as test" << std::endl; - test = true; - } - else if (SubSystemRunnerBase::OPTION_RUN_AS_TEST_SINGLETHREADED.compare(argv[i]) == 0) { - - singleThreaded = true; - i++; - if (i < argc) { - std::stringstream sstr(argv[i]); - sstr >> cycles; - } - std::cout << "*** running as test singlethreaded " << cycles << " cycles" << std::endl; - } - else if (SubSystemRunnerBase::OPTION_RUN_SINGLETHREADED.compare(argv[i]) == 0) { - - singleThreaded = true; - i++; - if (i < argc) { - std::stringstream sstr(argv[i]); - sstr >> cycles; - } - std::cout << "*** running singlethreaded " << cycles << " cycles" << std::endl; - } - else { - std::cout << "*** running multithreaded" << std::endl; + headless = true; + } else if (OPTION_RUN_HEADLESS.compare(argv[i]) == 0) { + std::cout << "*** running headless" << std::endl; + headless = true; } } - if (test) - mainComponent.setTestSemaphore(s_testSem); - - mainComponent.init(); // lifecycle init - mainComponent.start(singleThreaded); // lifecycle start + main_component.init(); // lifecycle init + main_component.start(); // lifecycle start // application runs until quit - if (test) { - waitForTestcase(); - } - else if (singleThreaded){ - waitAndPollSingleThreaded(mainComponent, cycles); - } - else { - waitForQuitMultiThreaded(); - } + if (headless) + waitForTerminate(); + else + waitForQuit(); + // end the lifecycle - mainComponent.stop(singleThreaded); // lifecycle stop - mainComponent.destroy(); // lifecycle destroy + main_component.stop(); // lifecycle stop + main_component.destroy(); // lifecycle destroy std::cout << "*** T H E E N D ***" << std::endl; - //etUserExit(); /* platform specific */ -} - -void SubSystemRunnerBase::waitForTestcase() { - //std::cout << "=== waitForTestcase: before acq. semaphore, thread " << Thread.currentThread().getName() << std::endl; - s_testSem.take(); - //std::cout << "=== waitForTestcase: after acq. semaphore, thread " << Thread.currentThread().getName() << std::endl; } -void SubSystemRunnerBase::waitForQuitMultiThreaded() { +void SubSystemRunnerBase::waitForQuit() { // waiting for command line input - std::string token = ""; - std::cout << "type 'quit' to exit" << std::endl; - while (token != "quit") { - std::getline(std::cin, token); - std::cout << "echo: " << token << std::endl; +// std::cout << "waitForQuit 30sec" << std::endl; +// Sleep(30000); +// std::cout << "return from waitForQuit" << std::endl; + + printf("type quit to exit\n"); + fflush(stdout); + while (ET_TRUE) { + char line[64]; + + if (fgets(line, 64, stdin) != NULL) { + if (strncmp(line, "quit", 4)==0) + break; + } } + + // not thread safe ?? +// std::string token; +// std::cout << "type 'quit' to exit" << std::endl; +// while (token != "quit") { +// std::getline(std::cin, token); +// //std::cout << "echo: " << token << std::endl; +// } } -void SubSystemRunnerBase::waitAndPollSingleThreaded(SubSystemClassBase& mainComponent, int cycles) { - for (int i=0; i< cycles; ++i) { - if (etTimer_executeNeeded()) { - mainComponent.runOnce(); - } - usleep(100000); - } +void SubSystemRunnerBase::waitForTerminate() { + std::cout << "=== waitForTestcase: before acq. semaphore" << std::endl; + etSema_waitForWakeup(etRuntime_getTerminateSemaphore()); + std::cout << "=== waitForTestcase: after acq. semaphore" << std::endl; } + } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h index 971c38cdf..156f1d096 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SubSystemRunnerBase.h @@ -13,9 +13,7 @@ #ifndef SUBSYSTEMRUNNERBASE_H_ #define SUBSYSTEMRUNNERBASE_H_ -#include <iostream> #include <string> -#include "common/modelbase/TestSemaphore.h" namespace etRuntime { @@ -24,22 +22,22 @@ class SubSystemClassBase; class SubSystemRunnerBase { public: SubSystemRunnerBase(); - ~SubSystemRunnerBase(); - static void run(SubSystemClassBase& mainComponent, int argc, char* argv[] ); + virtual ~SubSystemRunnerBase() {} + static void run(SubSystemClassBase& mainComponent, int argc, char* argv[]); + static void waitForTerminate(); protected: /** * blocks until the String "quit" is entered on the console */ - static void waitForTestcase(); - static TestSemaphore s_testSem; + static void waitForQuit(); private: static const std::string OPTION_RUN_AS_TEST; - static const std::string OPTION_RUN_AS_TEST_SINGLETHREADED; - static const std::string OPTION_RUN_SINGLETHREADED; - static void waitForQuitMultiThreaded(); - static void waitAndPollSingleThreaded(SubSystemClassBase& mainComponent, int cycles); + static const std::string OPTION_RUN_HEADLESS; + + SubSystemRunnerBase(SubSystemRunnerBase const&); + SubSystemRunnerBase& operator=(SubSystemRunnerBase const&); }; } /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h new file mode 100644 index 000000000..4cd43f9a6 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/SystemPortOwner.h @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_COMMON_MODELBASE_SYSTEMPORTOWNER_H_ +#define SRC_COMMON_MODELBASE_SYSTEMPORTOWNER_H_ + +#include "common/messaging/RTObject.h" +#include "common/modelbase/EventReceiver.h" +#include "common/modelbase/IInterfaceItemOwner.h" +#include <string> + +namespace etRuntime { + +class IReplicatedInterfaceItem; + +class SystemPortOwner: public EventReceiver, public virtual IInterfaceItemOwner { +public: + virtual ~SystemPortOwner() {} + + virtual IEventReceiver* getEventReceiver() const { + return const_cast<SystemPortOwner*>(this); + } + + virtual IReplicatedInterfaceItem* getSystemPort() const { + IInterfaceItemOwner* parent = dynamic_cast<IInterfaceItemOwner*>(getParent()); + if (parent != 0) { + return parent->getSystemPort(); + } + + return 0; + } + +protected: + SystemPortOwner(IRTObject* parent, const std::string& name) : + EventReceiver(parent, name) { + } + +private: + SystemPortOwner(); + SystemPortOwner(SystemPortOwner const&); + SystemPortOwner& operator=(SystemPortOwner const&); + +}; + +} /* namespace etRuntime */ +#endif /* SRC_COMMON_MODELBASE_SYSTEMPORTOWNER_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp deleted file mode 100644 index 99a43383f..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#include "TestSemaphore.h" - -namespace etRuntime { - - -TestSemaphore::~TestSemaphore() { - sem_destroy(&m_sem); -} - -void TestSemaphore::printWaitingThreads() { - std::cout << ">>> begin semaphore info >>>" << std::endl; - int value; - sem_getvalue(&m_sem, &value); - std::cout << "value of the semaphore:" << value << std::endl; -// std::cout << "current thread is " + Thread.currentThread().getName() << std::endl; -// Collection < Thread > threads = getQueuedThreads(); -// if (threads.isEmpty()) -// std::cout << " no waiting threads" << std::endl; -// else -// for (Thread thread : threads) { -// std::cout << " blocked: " << thread.getName() << std::endl; -// } - std::cout << "<<< end semaphore info <<<" << std::endl; -} - -} /* namespace etRuntime */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h deleted file mode 100644 index b65ba9dee..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/TestSemaphore.h +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) - * - *******************************************************************************/ - -#ifndef TESTSEMAPHORE_H_ -#define TESTSEMAPHORE_H_ - -#include <iostream> -#include <semaphore.h> - -namespace etRuntime { - -class TestSemaphore { //extends Semaphore -public: - TestSemaphore(int permits = 1) - : m_sem() - { - sem_init(&m_sem, 0, permits); - } - - virtual ~TestSemaphore(); - - void give() { sem_post(&m_sem); }; - void take() { sem_wait(&m_sem); }; - - void printWaitingThreads(); - -private: - sem_t m_sem; - - TestSemaphore(const TestSemaphore& right); - TestSemaphore& operator=(const TestSemaphore& right); - -}; - -} /* namespace etRuntime */ -#endif /* TESTSEMAPHORE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h b/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h deleted file mode 100644 index 449c5588a..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/platform/etTimer.h +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Jung (initial contribution) - * - *******************************************************************************/ - -#ifndef _ETTIMER_H_ -#define _ETTIMER_H_ - -#include "etDatatypes.h" - -typedef struct etTargetTime { - unsigned long nSec; - unsigned long sec; -} etTargetTime_t; - -#ifdef __cplusplus -extern "C" { -#endif -void etTimer_init(void); - -uint32 getNSecFromTarget(void); -uint32 getSecFromTarget(void); - -void getTimeFromTarget(etTargetTime_t *t); - -int isTimeGreaterThanActualTime(const etTargetTime_t *t); - -etBool etTimer_executeNeeded(void); - -uint32 getTimeBaseNS(void); - -uint32 getTimeBaseUS(void); - -uint32 getTimeBaseMS(void); - -#ifdef __cplusplus -} -#endif -#endif /* __ETTIMER_H__ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h deleted file mode 100644 index 5501bce8f..000000000 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/platforms/generic/etDatatypes.h +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#ifndef _ETDATATYPES_H_ -#define _ETDATATYPES_H_ - -/* - * typedefs for platform specific datatypes - * generic Version for most bigger 32 and 64 bit platforms like Linux an Windows - * - * */ - -#include <stdio.h> - -/* unsigned integer datatypes */ -typedef unsigned char uint8; -typedef unsigned short int uint16; -typedef unsigned long uint32; -typedef unsigned long long uint64; - -/* signed integer datatypes */ -typedef char int8; -typedef short int int16; -typedef long int32; -typedef long long int64; - - -/* float datatypes */ -typedef float float32; -typedef double float64; - -/* boolean datatypes and values */ - -#ifndef __cplusplus -typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/ -#endif /* __cplusplus */ - -//typedef bool boolean; -#ifndef ET_TRUE - #define ET_TRUE 1 -#endif -#ifndef ET_FALSE - #define ET_FALSE 0 -#endif - -/* - * typedefs for eTrice Runtime and Testing - * - * */ - -typedef int8 etInt8; -typedef int16 etInt16; -typedef int32 etInt32; - -typedef uint8 etUInt8; -typedef uint16 etUInt16; -typedef uint32 etUInt32; - -typedef bool etBool; - -typedef float32 etFloat32; -typedef float64 etFloat64; - -typedef FILE* etFileHandle; - -typedef int8 etAddressId; - -#endif /* _DATATYPES_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.java/gen_runtime.launch b/runtime/org.eclipse.etrice.runtime.java/gen_runtime.launch new file mode 100644 index 000000000..df42cc548 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.java/gen_runtime.launch @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.etrice.generator.launch.java.launchConfigurationType"> +<booleanAttribute key="DataLogging" value="false"/> +<booleanAttribute key="Debug" value="false"/> +<booleanAttribute key="GenDocumentation" value="false"/> +<booleanAttribute key="GenInstanceDiagram" value="false"/> +<stringAttribute key="GenModelPath" value=""/> +<booleanAttribute key="Lib" value="true"/> +<booleanAttribute key="MSC" value="true"/> +<listAttribute key="ModelFiles"> +<listEntry value="${workspace_loc:/org.eclipse.etrice.runtime.java/models/SystemServices.room}"/> +</listAttribute> +<booleanAttribute key="OverrideDirectories" value="false"/> +<booleanAttribute key="SaveGenModel" value="false"/> +<booleanAttribute key="UseTranslation" value="true"/> +<booleanAttribute key="Verbose" value="false"/> +<booleanAttribute key="etUnit" value="false"/> +</launchConfiguration> diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java index dedc9b461..72d119378 100644 --- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ @@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit; /** * The MessageService is the backbone of the asynchronous communication inside a SubSystem * It usually contains a thread a message queue and a dispatcher - * + * * @author Thomas Schuetz (initial contribution) * @author Henrik Rentz-Reichert (extending RTObject, implementing Runnable) * @@ -30,22 +30,22 @@ import java.util.concurrent.TimeUnit; public class MessageService extends AbstractMessageService { private boolean running = false; - + private Thread thread; private int priority; private long lastMessageTimestamp; - + private long pollingInterval = -1; private ScheduledExecutorService pollingScheduler = null; public MessageService(IRTObject parent, ExecMode mode, int node, int thread, String name) { this(parent, mode, 0, node, thread, name, Thread.NORM_PRIORITY); } - + public MessageService(IRTObject parent, ExecMode mode, long nsec, int node, int thread, String name) { this(parent, mode, nsec, node, thread, name, Thread.NORM_PRIORITY); } - + public MessageService(IRTObject parent, ExecMode mode, long nsec, int node, int thread, String name, int priority) { super(parent, "MessageService_"+name, node, thread); @@ -54,31 +54,31 @@ public class MessageService extends AbstractMessageService { // priority = Thread.NORM_PRIORITY generated fixed this.priority = priority; - assert priority >= Thread.MIN_PRIORITY : ("priority smaller than Thread.MIN_PRIORITY (" + "Thread.MIN_PRIORITY" + ")"); - assert priority <= Thread.MAX_PRIORITY : ("priority bigger than Thread.MAX_PRIORITY (" + "Thread.MAX_PRIORITY" + ")"); - + assert priority >= Thread.MIN_PRIORITY : ("priority smaller than Thread.MIN_PRIORITY (" + "Thread.MIN_PRIORITY" + ")"); + assert priority <= Thread.MAX_PRIORITY : ("priority bigger than Thread.MAX_PRIORITY (" + "Thread.MAX_PRIORITY" + ")"); + if(mode == ExecMode.MIXED || mode == ExecMode.POLLED){ pollingInterval = nsec; pollingScheduler = Executors.newScheduledThreadPool(1, new PollingThreadFactory()); - + assert pollingInterval > 0 : ("polling interval is 0 or negative"); } } public void run() { running = true; - + if(pollingScheduler != null) pollingScheduler.scheduleAtFixedRate(new PollingTask(), pollingInterval, pollingInterval, TimeUnit.NANOSECONDS); - + while (running) { Message msg = null; - + // get next Message from Queue synchronized(this) { msg = getMessageQueue().pop(); } - + if (msg == null) { // no message in queue -> wait until Thread is notified try { @@ -105,11 +105,11 @@ public class MessageService extends AbstractMessageService { @Override public synchronized void receive(Message msg) { super.receive(msg); - + // wake up thread to process message notifyAll(); } - + /* (non-Javadoc) * @see org.eclipse.etrice.runtime.java.messaging.AbstractMessageService#getFreeAddress() */ @@ -117,7 +117,7 @@ public class MessageService extends AbstractMessageService { public synchronized Address getFreeAddress() { return super.getFreeAddress(); } - + /* (non-Javadoc) * @see org.eclipse.etrice.runtime.java.messaging.AbstractMessageService#addMessageReceiver(org.eclipse.etrice.runtime.java.messaging.IMessageReceiver) */ @@ -133,17 +133,17 @@ public class MessageService extends AbstractMessageService { public synchronized void removeMessageReceiver(IMessageReceiver receiver) { super.removeMessageReceiver(receiver); } - + @Override public synchronized void addPollingMessageReceiver(IMessageReceiver receiver) { super.addPollingMessageReceiver(receiver); } - + @Override public synchronized void removePollingMessageReceiver(IMessageReceiver receiver) { super.removePollingMessageReceiver(receiver); } - + /* (non-Javadoc) * @see org.eclipse.etrice.runtime.java.messaging.AbstractMessageService#freeAddress(org.eclipse.etrice.runtime.java.messaging.Address) */ @@ -151,15 +151,15 @@ public class MessageService extends AbstractMessageService { public synchronized void freeAddress(Address addr) { super.freeAddress(addr); } - + public synchronized void terminate() { + if(pollingScheduler != null) + pollingScheduler.shutdown(); + if (running) { running = false; notifyAll(); } - - if(pollingScheduler != null) - pollingScheduler.shutdown(); } /* (non-Javadoc) @@ -167,7 +167,7 @@ public class MessageService extends AbstractMessageService { */ public void setThread(Thread thread) { this.thread = thread; - + thread.setPriority(priority); } @@ -181,29 +181,29 @@ public class MessageService extends AbstractMessageService { protected long getLastMessageTimestamp() { return lastMessageTimestamp; } - + private class PollingTask implements Runnable{ - + @Override public void run() { if(running){ Message msg = new Message(getMessageDispatcher().getAddress()); receive(msg); - } + } } - + } - + private class PollingThreadFactory implements ThreadFactory{ @Override public Thread newThread(Runnable arg0) { Thread thread = new Thread(arg0, getName()+"_PollingThread"); thread.setPriority(priority); - + return thread; } - + } } diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java index 39705aeb1..d68ca3e1c 100644 --- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/RTObject.java @@ -13,7 +13,7 @@ import java.util.ArrayList; /** * An implementation of the IRTObject interface using a hierarchical structure * to assemble paths. - * + * * @author Henrik Rentz-Reichert * */ @@ -22,23 +22,26 @@ public class RTObject implements IRTObject { private String name = NO_NAME; private IRTObject parent = null; ArrayList<IRTObject> children = new ArrayList<IRTObject>(); - + protected RTObject(IRTObject parent, String name){ this.parent = parent; this.name = name; - + if (parent!=null) parent.getChildren().add(this); } + @Override public String getName() { return name; } - + + @Override public IRTObject getParent() { return parent; } + @Override public ArrayList<IRTObject> getChildren() { return children; } @@ -55,37 +58,40 @@ public class RTObject implements IRTObject { parent = null; } } - + + @Override public IRTObject getRoot() { IRTObject root = this; while (root.getParent()!=null) root = root.getParent(); - + return root; } - + + @Override public IRTObject getChild(String name) { for (IRTObject child : children) { if (child.getName().equals(name)) return child; } - + return null; } - + + @Override public IRTObject getObject(String path) { boolean isAbsolute = path.charAt(0)==PATH_DELIM; if (isAbsolute && getParent()!=null) return getParent().getObject(path); - + if (isAbsolute) path = path.substring(1); - + String[] segments = path.split(Character.toString(PATH_DELIM)); if (segments.length>0) { IRTObject current = this; - + String first = segments[0]; for (String segment : segments) { if (isAbsolute && segment==first) { @@ -100,23 +106,26 @@ public class RTObject implements IRTObject { } return current; } - + return null; } - + + @Override public String getInstancePath(char delim) { String path = delim + name; - + if (parent!=null) path = parent.getInstancePath(delim)+path; - + return path; } - + + @Override public String getInstancePath() { return getInstancePath(PATH_DELIM); } + @Override public String getInstancePathName() { return getInstancePath(PATHNAME_DELIM); } @@ -130,10 +139,10 @@ public class RTObject implements IRTObject { return parent.getThreadForPath(path); return -1; } - + private String toStringRecursive(String indent) { StringBuilder result = new StringBuilder(indent+toString()+"\n"); - + indent = " "+indent; for (IRTObject child : getChildren()) { if (child instanceof RTObject) @@ -143,11 +152,11 @@ public class RTObject implements IRTObject { } return result.toString(); } - + public String toStringRecursive() { return toStringRecursive(""); } - + @Override public String toString() { return getName(); diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java index df4441621..89d03c66d 100644 --- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java @@ -18,11 +18,11 @@ import org.eclipse.etrice.runtime.java.messaging.RTServices; /** * The abstract base class for actor class interface items like {@link PortBase} * and {@link InterfaceItemBroker}s. - * + * * @author Henrik Rentz-Reichert */ public abstract class InterfaceItemBase extends AbstractMessageReceiver implements IInterfaceItem { - + /** * If this is part of an {@link IReplicatedInterfaceItem} then the * owner of this item is stored in this field. @@ -30,18 +30,18 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen * disconnected then it is also removed from its parent and destroyed. */ private IReplicatedInterfaceItem replicator = null; - - protected IMessageService ownMsgReceiver; - protected IMessageReceiver peerMsgReceiver; + + private IMessageService ownMsgReceiver; + private IMessageReceiver peerMsgReceiver; private int localId; private int idx; - protected Address peerAddress = null; + private Address peerAddress = null; private IInterfaceItem peer; /** * The constructor determines the thread of its {@link IEventReceiver} - * + * * @param owner * @param name * @param localId @@ -49,20 +49,20 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen */ public InterfaceItemBase (IInterfaceItemOwner owner, String name, int localId, int idx) { super(owner.getEventReceiver(), name); - + this.localId = localId; this.idx = idx; - + if (owner instanceof IReplicatedInterfaceItem) replicator = (IReplicatedInterfaceItem) owner; - + int thread = owner.getEventReceiver().getThread(); if (thread>=0) { IMessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread); Address addr = msgSvc.getFreeAddress(); setAddress(addr); msgSvc.addMessageReceiver(this); - + this.ownMsgReceiver = msgSvc; } } @@ -70,30 +70,30 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen public synchronized IInterfaceItem connectWith(IInterfaceItem peer) { if (peer!=null) { this.peer = peer; - + if (peer instanceof IInterfaceItemBroker) { this.peer = peer.connectWith(this); return this.peer; } - + if (peer instanceof IReplicatedInterfaceItem) peer = ((IReplicatedInterfaceItem) peer).createSubInterfaceItem(); - + if (peer instanceof InterfaceItemBase) { InterfaceItemBase thePeer = (InterfaceItemBase) peer; - + // connect with each other peerAddress = thePeer.getAddress(); thePeer.peerAddress = getAddress(); this.peerMsgReceiver = thePeer.ownMsgReceiver; thePeer.peerMsgReceiver = ownMsgReceiver; } - + } - + return peer; } - + protected synchronized void disconnect() { disconnectInternal(); if (peer!=null) { @@ -106,11 +106,12 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen private void disconnectInternal() { peerAddress = null; peerMsgReceiver = null; - + if (replicator!=null) destroy(); } - + + protected IMessageReceiver getMsgReceiver() { return ownMsgReceiver; } @@ -122,7 +123,7 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen protected synchronized IMessageReceiver getPeerMsgReceiver() { return peerMsgReceiver; } - + public IEventReceiver getActor() { return (IEventReceiver) getParent(); } @@ -134,7 +135,7 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen public int getIdx() { return idx; } - + /* (non-Javadoc) * @see org.eclipse.etrice.runtime.java.messaging.RTObject#destroy() */ @@ -143,26 +144,26 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver implemen if (peerAddress!=null) { disconnect(); } - + if (replicator!=null) { replicator.removeItem(this); } - + ownMsgReceiver.removeMessageReceiver(this); ownMsgReceiver.freeAddress(getAddress()); - + super.destroy(); } - + @Override public String toString() { return ((replicator!=null)?"sub ":"")+"port "+getName()+" "+getAddress()+" <-> "+getPeerAddress(); } - + public static void connect(IRTObject obj, String path1, String path2) { IRTObject obj1 = obj.getObject(path1); IRTObject obj2 = obj.getObject(path2); - + if (obj1 instanceof IInterfaceItem && obj2 instanceof IInterfaceItem) { ((IInterfaceItem)obj1).connectWith((IInterfaceItem) obj2); } diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java index dcd2973c6..f4ccd974e 100644 --- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java +++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/RTSystemProtocol.java @@ -4,10 +4,10 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * CONTRIBUTORS: * Henrik Rentz-Reichert (initial contribution) - * + * *******************************************************************************/ package org.eclipse.etrice.runtime.java.modelbase; @@ -21,14 +21,14 @@ import org.eclipse.etrice.runtime.java.modelbase.RTSystemServicesProtocol.RTSyst * */ public class RTSystemProtocol { - + private static final String RT_SYSTEM_PORT_NAME = "RTSystemPort"; - + public static class RTSystemPort extends RTSystemServicesProtocolPort { - + public RTSystemPort(IInterfaceItemOwner actor, int localId) { super(actor, RT_SYSTEM_PORT_NAME, localId); - + // since we have no mapping for the system ports we connect them directly here IReplicatedInterfaceItem systemPort = actor.getSystemPort(); if (systemPort!=null) { @@ -36,17 +36,17 @@ public class RTSystemProtocol { connectWith(peer); } } - + protected void connectWithPeer() { } - + @Override - protected void destroy() { + public void destroy() { super.destroy(); } - + } - + public static class RTSystemConjPort extends RTSystemServicesProtocolConjReplPort { public RTSystemConjPort(IInterfaceItemOwner actor, int localId) { @@ -57,17 +57,17 @@ public class RTSystemProtocol { protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) { return new RTSystemConjSubPort(rcv, name, lid, idx); } - + } - + public static class RTSystemConjSubPort extends RTSystemServicesProtocolConjPort { public RTSystemConjSubPort(IInterfaceItemOwner actor, String name, int localId, int idx) { super(actor, name, localId, idx); } - + protected void connectWithPeer() { } - + } } diff --git a/tests/org.eclipse.etrice.generator.common.tests/common.xml b/tests/org.eclipse.etrice.generator.common.tests/common.xml index 9202c5b35..cc805e690 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/common.xml +++ b/tests/org.eclipse.etrice.generator.common.tests/common.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <project name="org.eclipse.etrice.generator.common.tests"> - + <target name="testing" depends="copyModels"> - + <!-- add test here, testid==testSuiteFileName --> <test testid="ActorCommunicationTest" models="${models.path}/ActorCommunicationTest.room ${models.path}/GenericPhysical.etphys" /> <test testid="ChoicePointTest" models="${models.path}/ChoicePointTest.room ${models.path}/GenericPhysical.etphys" /> @@ -14,11 +14,11 @@ <test testid="OperationInheritanceTest" models="${models.path}/OperationInheritanceTest.room ${models.path}/GenericPhysical.etphys" /> <test testid="PingPongThreadTest" models="${models.path}/PingPongThreadTest.etmap" /> <test testid="PingPongThreadReplPortTest" models="${models.path}/PingPongThreadReplPortTest.etmap" /> - - + + <echo>done with ${ant.project.name}</echo> </target> - + <target name="copyModels" depends="setVars"> <copy todir="${models.path}"> <fileset dir="../org.eclipse.etrice.generator.common.tests/models"/> @@ -30,20 +30,20 @@ </fileset> </copy> </target> - + <!-- ################################################################ --> - + <!-- global properties --> <!-- test.results, target.platform --> - + <!-- private properties--> <property name="models.path" value="./models"/> <property name="testlog.path" value="./log/testlog"/> <property name="output" value="./output"/> <property name="bin.path" value="./bin"/> - + <property name="run.msTimout" value="5000"/> - + <!-- show ALL used variables --> <target name="showVars"> <echo> ant.project.name = ${ant.project.name} </echo> @@ -55,9 +55,9 @@ <echo> target.platform = ${target.platform} </echo> <echo> modellib.path = ${modellib.path} </echo> <echo> models.path = ${models.path} </echo> - <echo> basedir = ${basedir} </echo> + <echo> basedir = ${basedir} </echo> </target> - + <!-- set global properties if not set--> <target name="set_local_tr" unless="test.results"> <property name="test.results" value="./results"/> @@ -65,13 +65,14 @@ <target name="set_local_tp" unless="target.platform"> <property name="target.platform" value="${eclipse.home}"/> </target> - + <target name="setVars" depends="set_local_tp,set_local_tr,set_etrice_clspath,showVars"/> - + <target name="set_etrice_clspath"> <path id="etrice.clspath"> <pathelement location="../../plugins/org.eclipse.etrice.generator.c/bin"/> <pathelement location="../../plugins/org.eclipse.etrice.generator.java/bin"/> + <pathelement location="../../plugins/org.eclipse.etrice.generator.cpp/bin"/> <pathelement location="../../plugins/org.eclipse.etrice.etunit.converter/bin"/> <pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/> <pathelement location="../../plugins/org.eclipse.etrice.generator.doc/bin"/> @@ -93,35 +94,35 @@ <include name="com.google.inject_*.jar" /> <include name="com.google.guava_1*.jar" /> <include name="org.eclipse.equinox.common_3.6.*.jar" /> - + <!-- Xtext 2.6 --> <include name="org.eclipse.xtext_2.6*.jar" /> <include name="org.eclipse.xtext.util_2.6*.jar" /> <include name="org.eclipse.xtext.common.types_2.6*.jar" /> <include name="org.eclipse.xtend.lib_2.6*.jar" /> <include name="org.eclipse.xtext.xbase.lib_2.6*.jar" /> - + <!-- Xtext 2.7 --> <include name="org.eclipse.xtext_2.7*.jar" /> <include name="org.eclipse.xtext.util_2.7*.jar" /> <include name="org.eclipse.xtext.common.types_2.7*.jar" /> <include name="org.eclipse.xtend.lib_2.7*.jar" /> <include name="org.eclipse.xtext.xbase.lib_2.7*.jar" /> - + <!-- Xtext 2.8 --> <include name="org.eclipse.xtext_2.8*.jar" /> <include name="org.eclipse.xtext.util_2.8*.jar" /> <include name="org.eclipse.xtext.common.types_2.8*.jar" /> <include name="org.eclipse.xtend.lib_2.8*.jar" /> <include name="org.eclipse.xtext.xbase.lib_2.8*.jar" /> - + <include name="org.apache.log4j_1.2*.jar" /> <include name="org.antlr.runtime_3.2*.jar" /> <include name="javax.inject_1.0*.jar" /> </fileset> - </path> + </path> </target> - + <!-- clean: deletes all folders created by this script --> @@ -134,7 +135,7 @@ <delete dir="log"/> <delete dir="src-gen"/> </target> - + <macrodef name="convert"> <attribute name="testId"/> <sequential> @@ -146,7 +147,7 @@ </java> </sequential> </macrodef> - + <!-- copy_results: copies the *.xml results to their final destination --> @@ -158,5 +159,5 @@ <move file="${testlog.path}/@{testId}.xml" tofile="${test.results}/@{targetId}@{testId}.xml"/> </sequential> </macrodef> - + </project>
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore b/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore index 8d74feca6..4f0e85af9 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore +++ b/tests/org.eclipse.etrice.generator.cpp.tests/.gitignore @@ -1,6 +1,6 @@ -/bin -/models -/output -/results -/src-gen -/tmp +bin +models +output +results +src-gen +log
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/Makefile b/tests/org.eclipse.etrice.generator.cpp.tests/Makefile new file mode 100644 index 000000000..b6b863770 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/Makefile @@ -0,0 +1,16 @@ +# for make.xml + +#include ${CPP_MODELLIB_ROOTDIR}/buildTools/modellib.mk +include ${CPP_RUNTIME_ROOTDIR}/buildTools/runtime.mk + +# --- +IN_TARGET := ${APP_TARGET} +IN_BUILD_DIR := ${APP_BUILD_DIR} +IN_INCDIRS += ${APP_SRCDIRS_REC} +IN_SRCDIRS_REC += ${APP_SRCDIRS_REC} +CC = ${CXX} +IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall +#--- + +# Create rules +include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_CPTest_Async.seq b/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_CPTest_Async.seq deleted file mode 100644 index edcad3a02..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_CPTest_Async.seq +++ /dev/null @@ -1,27 +0,0 @@ -#generated MSC for Trace2UML - /SubSystem_CPTest >-- /SubSystem_CPTest/ChoicePointTest_Top executeInitialTransition - /SubSystem_CPTest >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_tester executeInitialTransition - /SubSystem_CPTest >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user executeInitialTransition - /SubSystem_CPTest --> /SubSystem_CPTest/ChoicePointTest_Top executeInitialTransition - /SubSystem_CPTest --> /SubSystem_CPTest/ChoicePointTest_Top/cp_tester executeInitialTransition - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >-- /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester >>> state0 - /SubSystem_CPTest --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user executeInitialTransition - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> ENTRY3_EXIT4 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> ENTRY3_EXIT4 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> ENTRY8_EXIT9_ENTRY11_EXIT12 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> ENTRY3_EXIT4 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> ENTRY8_EXIT9_ENTRY11_EXIT12 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> ENTRY8_EXIT9_ENTRY11_EXIT12 - /SubSystem_CPTest/ChoicePointTest_Top/cp_tester --> /SubSystem_CPTest/ChoicePointTest_Top/cp_user msg1 - /SubSystem_CPTest/ChoicePointTest_Top/cp_user >>> testOk diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_CPTest_Sync.seq b/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_CPTest_Sync.seq deleted file mode 100644 index 58543452e..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_CPTest_Sync.seq +++ /dev/null @@ -1 +0,0 @@ -#generated MSC for Trace2UML diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_HandlerTest_Async.seq b/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_HandlerTest_Async.seq deleted file mode 100644 index 2cc8000c4..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_HandlerTest_Async.seq +++ /dev/null @@ -1,48 +0,0 @@ -#generated MSC for Trace2UML - /SubSystem_HandlerTest >-- /SubSystem_HandlerTest/HandlerTest_Top executeInitialTransition - /SubSystem_HandlerTest >-- /SubSystem_HandlerTest/HandlerTest_Top/tester executeInitialTransition - /SubSystem_HandlerTest >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser executeInitialTransition - /SubSystem_HandlerTest --> /SubSystem_HandlerTest/HandlerTest_Top executeInitialTransition - /SubSystem_HandlerTest --> /SubSystem_HandlerTest/HandlerTest_Top/tester executeInitialTransition - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg2 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg2 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg3 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg4 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/tester >-- /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg6 - /SubSystem_HandlerTest/HandlerTest_Top/tester >>> state0 - /SubSystem_HandlerTest --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser executeInitialTransition - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state1_state7 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state1_state7 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state1_state7 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state1_state7 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state1 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state1 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state1_state7 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg2 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state1_state7 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg2 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state2 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state2 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg3 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state2 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg4 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state2 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg1 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> state0_state2 - /SubSystem_HandlerTest/HandlerTest_Top/tester --> /SubSystem_HandlerTest/HandlerTest_Top/handlerUser msg6 - /SubSystem_HandlerTest/HandlerTest_Top/handlerUser >>> testOk diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_HandlerTest_Sync.seq b/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_HandlerTest_Sync.seq deleted file mode 100644 index 58543452e..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/SubSystem_HandlerTest_Sync.seq +++ /dev/null @@ -1 +0,0 @@ -#generated MSC for Trace2UML diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec b/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec index 967557dc0..39f8c66f3 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec +++ b/tests/org.eclipse.etrice.generator.cpp.tests/buckminster.cspec @@ -3,7 +3,6 @@ <cs:public name="run_tests" actor="ant"> <cs:actorProperties> <cs:property key="buildFile" value="make.xml"/> - <cs:property key="target.platform" value="${WORKSPACE}/buildroot/target.platform"/> <cs:property key="targets" value="all"/> </cs:actorProperties> </cs:public> diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/make.xml b/tests/org.eclipse.etrice.generator.cpp.tests/make.xml index 74fc2506a..ff06266ed 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/make.xml +++ b/tests/org.eclipse.etrice.generator.cpp.tests/make.xml @@ -1,373 +1,108 @@ <?xml version="1.0"?> <!-- Ant makefile for building and running of tests. - This includes invocation of the Java code generator and conversion of the etunit - results into xunit xml. - - To work locally you should define in your environment - ETRICE_TARGET_PLATFORM=path to the eclipse folder of your Juno installation - ETRICE_CPP_RUNTIME=path to the org.eclipse.etrice.runtime.cpp folder (relative path doesn't work) - - @author Henrik Rentz-Reichert + + Includes common.xml from org.eclipse.etrice.generator.common.tests --> -<project name="project" default="all"> - - <property name="cpp.tests.model.path" value="./models"/> - <property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.cpp"/> - <property name="bin.path" value="./bin"/> - <property name="xml.output" value="./tmp"/> - <property name="output" value="./output"/> - <property environment="env"/> +<project name="org.eclipse.etrice.generator.cpp.tests" basedir="." default="all"> - - <!-- - all: copies the models, generates, compiles, runs, converts and copies the results - --> - <target name="all" depends="convert,copy_results"> - <echo>done with org.eclipse.etrice.generator.cpp.tests</echo> - </target> + <!-- <target name="testing" depends="setVars,common.testing"> - <!-- - set_tp: get the target.platform property from the environment var ETRICE_TARGET_PLATFORM if not set already - --> - <target name="set_tp" unless="target.platform"> - <echo>using local target platform</echo> - <property name="target.platform" value="${env.ETRICE_TARGET_PLATFORM}"/> - </target> + // add test here, testid==testSuiteFileName + <echo>done with ${ant.project.name}</echo> + </target> --> - <!-- - set_tr: sets the test.result property if not set already - --> - <target name="set_tr" unless="test.results"> - <echo>using local test result folder</echo> - <property name="test.results" value="./results"/> + <target name="testing" depends="copyModels"> + <!-- modified target from common.xml because cpp is not complete yet --> + <test testid="ActorCommunicationTest" models="${models.path}/ActorCommunicationTest.room ${models.path}/GenericPhysical.etphys" /> + <test testid="ChoicePointTest" models="${models.path}/ChoicePointTest.room ${models.path}/GenericPhysical.etphys" /> + <test testid="DataDrivenTest" models="${models.path}/DataDrivenTest.room ${models.path}/GenericPhysical.etphys" /> + <test testid="HandlerTest" models="${models.path}/HandlerTest.room ${models.path}/GenericPhysical.etphys" /> + <test testid="PingPongThreadTest" models="${models.path}/PingPongThreadTest.etmap" /> + <test testid="PingPongThreadReplPortTest" models="${models.path}/PingPongThreadReplPortTest.etmap" /> </target> - <!-- - set_rp: sets the runtime.path from the ETRICE_CPP_RUNTIME environment variable property if not set already - --> - <target name="set_rp" unless="c-runtime.path,cpp-runtime.path"> - <echo>using local runtime folder</echo> - <property name="cpp-runtime.path" value="${env.ETRICE_CPP_RUNTIME}"/> - <property name="c-runtime.path" value="${env.ETRICE_C_RUNTIME}"/> - </target> - - <!-- - clean: deletes all folders created by this script - --> - <target name="clean" depends="set_tr,set_rp"> - <delete dir="${bin.path}"/> - <delete dir="${c-runtime.path}/bin"/> - <delete dir="${cpp-runtime.path}/bin"/> - <delete dir="models"/> - <delete dir="${output}"/> - <delete dir="src-gen"/> - <delete dir="tmp"/> - </target> - - <!-- - copy_models: copies the models from their original folders to the build location - --> - <target name="copy_models"> - <copy todir="models" > - <fileset dir="../org.eclipse.etrice.generator.common.tests/models"> - <include name="*.room"/> - </fileset> - <fileset dir="${modellib.path}/model"> - <include name="TimingService.room"/> - <include name="Types.room"/> - <include name="Language.room"/> - </fileset> + <target name="copyModels" depends="common.copyModels"> + <copy todir="${models.path}"> + <fileset dir="./targetModels"/> </copy> + <!--<move file="${models.path}/staticConfig/StaticConfigTest_C.room" toFile="${models.path}/staticConfig//StaticConfigTest.room" />--> </target> - - <!-- - generate: invokes the Java generator for the ROOM models - --> - <target name="generate" depends="set_tp,copy_models"> - <mkdir dir="${output}"/> - <path id="clspath"> - <pathelement location="../../plugins/org.eclipse.etrice.generator.cpp/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.generator.doc/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.generator/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.core.common/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.core.room/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.core.etphys/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.core.etmap/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.core.config/bin"/> - <pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin"/> - <fileset dir="${target.platform}/plugins/"> - <include name="org.eclipse.emf.ecore_2.9*.jar" /> - <include name="org.eclipse.emf.common_2.9*.jar" /> - <include name="org.eclipse.emf.ecore.xmi_2.9*.jar" /> - <include name="org.eclipse.xtext_2.*.jar" /> - <include name="com.google.inject_*.jar" /> - <include name="com.google.guava_10.*.jar" /> - <include name="org.eclipse.equinox.common_3.6.*.jar" /> - <include name="org.eclipse.xtext.util_2.*.jar" /> - <include name="org.eclipse.xtext.common.types_2.4*.jar" /> - <include name="org.eclipse.xtend.lib_2.*.jar" /> - <include name="org.eclipse.xtext.xbase.lib_2.*.jar" /> - <include name="org.apache.log4j_1.2*.jar" /> - <include name="org.antlr.runtime_3.2*.jar" /> - <include name="javax.inject_1.0*.jar" /> - </fileset> - </path> - <java output="${output}/generate.txt" classname="org.eclipse.etrice.generator.cpp.Main" fork="true" failonerror="true"> - <arg value="${cpp.tests.model.path}/ChoicePointTest.room"/> - <arg value="${cpp.tests.model.path}/HandlerTest.room"/> - <arg value="-etunit"/> - <classpath refid="clspath"/> - </java> - </target> - - <!-- - compile_c_runtime: compiles the C runtime library - --> - <target name="compile_c_runtime" depends="clean,set_rp"> - <mkdir dir="${c-runtime.path}/bin"/> - <mkdir dir="${output}"/> - <exec dir="${c-runtime.path}/bin" executable="gcc" failonerror="true" output="${output}/compile_c_runtime.txt"> - <arg value="-I${c-runtime.path}/src/common"/> - <arg value="-I${c-runtime.path}/src/config"/> - <arg value="-I${c-runtime.path}/src/platforms/generic"/> - <arg value="-c"/> - <arg value="-g3"/> - <arg value="-O0"/> - <arg value="-Wall"/> - <arg value="../src/common/debugging/etMSCLogger.c"/> - <arg value="../src/common/etUnit/etUnit.c"/> - <arg value="../src/common/messaging/etMessage.c"/> - <arg value="../src/common/messaging/etMessageQueue.c"/> - <arg value="../src/common/messaging/etMessageService.c"/> - <arg value="../src/common/modelbase/etActor.c"/> - <arg value="../src/common/modelbase/etPort.c"/> - <arg value="../src/platforms/generic/etLogger.c"/> - <arg value="../src/platforms/generic/etPlatform.c"/> - <arg value="../src/platforms/generic/etTimer.c"/> - </exec> - <exec dir="${c-runtime.path}/bin" executable="ar" failonerror="true" output="${output}/compile_c_runtime.txt" append="true"> - <arg value="-r"/> - <arg value="liborg.eclipse.etrice.runtime.c.a"/> - <arg value="etMSCLogger.o"/> - <arg value="etUnit.o"/> - <arg value="etMessage.o"/> - <arg value="etMessageQueue.o"/> - <arg value="etMessageService.o"/> - <arg value="etActor.o"/> - <arg value="etPort.o"/> - <arg value="etLogger.o"/> - <arg value="etPlatform.o"/> - <arg value="etTimer.o"/> - </exec> - </target> - - <!-- - compile_runtime: compiles the CPP runtime library - --> - <target name="compile_runtime" depends="set_rp"> - <mkdir dir="${cpp-runtime.path}/bin"/> - <mkdir dir="${output}"/> - <exec dir="${cpp-runtime.path}/bin" executable="gcc" failonerror="true" output="${output}/compile_runtime.txt"> - <arg value="-I${cpp-runtime.path}/src"/> - <arg value="-I${cpp-runtime.path}/src/platforms/generic"/> - <arg value="-c"/> - <arg value="-g3"/> - <arg value="-O0"/> - <arg value="-Wall"/> - <arg value="../src/common/debugging/DebuggingService.cpp"/> - <arg value="../src/common/debugging/MSCFilter.cpp"/> - <arg value="../src/common/debugging/MSCLogger.cpp"/> - <!--arg value="../src/common/etUnit/etUnit.c"/--> - <arg value="../src/common/messaging/Address.cpp"/> - <arg value="../src/common/messaging/IMessageReceiver.cpp"/> - <arg value="../src/common/messaging/IRTObject.cpp"/> - <arg value="../src/common/messaging/Message.cpp"/> - <arg value="../src/common/messaging/MessageDispatcher.cpp"/> - <arg value="../src/common/messaging/MessageSeQueue.cpp"/> - <arg value="../src/common/messaging/MessageService.cpp"/> - <arg value="../src/common/messaging/MessageServiceController.cpp"/> - <arg value="../src/common/messaging/RTObject.cpp"/> - <arg value="../src/common/messaging/RTServices.cpp"/> - <arg value="../src/common/messaging/RTSystemServicesProtocol.cpp"/> - <arg value="../src/common/modelbase/ActorClassBase.cpp"/> - <arg value="../src/common/modelbase/EventReceiver.cpp"/> - <arg value="../src/common/modelbase/IEventReceiver.cpp"/> - <arg value="../src/common/modelbase/InterfaceItemBase.cpp"/> - <arg value="../src/common/modelbase/PortBase.cpp"/> - <arg value="../src/common/modelbase/SubSystemClassBase.cpp"/> - <arg value="../src/common/modelbase/SubSystemRunnerBase.cpp"/> - <arg value="../src/common/modelbase/TestSemaphore.cpp"/> - </exec> - <exec dir="${cpp-runtime.path}/bin" executable="ar" failonerror="true" output="${output}/compile_runtime.txt" append="true"> - <arg value="-r"/> - <arg value="liborg.eclipse.etrice.runtime.cpp.a"/> - <arg value="DebuggingService.o"/> - <arg value="MSCFilter.o"/> - <arg value="MSCLogger.o"/> - <arg value="Address.o"/> - <arg value="IMessageReceiver.o"/> - <arg value="IRTObject.o"/> - <arg value="Message.o"/> - <arg value="MessageDispatcher.o"/> - <arg value="MessageSeQueue.o"/> - <arg value="MessageService.o"/> - <arg value="MessageServiceController.o"/> - <arg value="RTObject.o"/> - <arg value="RTServices.o"/> - <arg value="RTSystemServicesProtocol.o"/> - <arg value="ActorClassBase.o"/> - <arg value="EventReceiver.o"/> - <arg value="IEventReceiver.o"/> - <arg value="InterfaceItemBase.o"/> - <arg value="PortBase.o"/> - <arg value="SubSystemClassBase.o"/> - <arg value="SubSystemRunnerBase.o"/> - <arg value="TestSemaphore.o"/> - </exec> - </target> - - <!-- - compile: compiles the generated C sources - --> - <target name="build" depends="set_rp,compile_c_runtime,compile_runtime,generate"> + <!-- ################################################################ --> - <!-- compile and link HandlerTest --> - <mkdir dir="bin/HandlerTest"/> - <exec dir="bin/HandlerTest" executable="gcc" failonerror="true" output="${output}/build.txt"> - <arg value="-I../../src-gen/ChoicePointTest"/> - <arg value="-I../../src-gen/HandlerTest"/> - <arg value="-I../../src-gen"/> - <arg value="-I${cpp-runtime.path}/src"/> - <arg value="-I${cpp-runtime.path}/src/platforms/generic"/> - <arg value="-I${c-runtime.path}/src/common/etUnit"/> - <arg value="-c"/> - <arg value="-g3"/> - <arg value="-O0"/> - <arg value="-Wall"/> - <arg value="../../src-gen/HandlerTest/HandlerTest_Top.cpp"/> - <arg value="../../src-gen/HandlerTest/HandlerUser.cpp"/> - <arg value="../../src-gen/HandlerTest/SubSystem_HandlerTest.cpp"/> - <arg value="../../src-gen/HandlerTest/SubSystem_HandlerTest_Runner.cpp"/> - <arg value="../../src-gen/HandlerTest/Tester.cpp"/> - <arg value="../../src-gen/HandlerTest/TestProtocol.cpp"/> - </exec> - <exec dir="bin/HandlerTest" executable="g++" failonerror="true" output="${output}/build.txt" append="true"> - <arg value="-L${cpp-runtime.path}/bin"/> - <arg value="-L${c-runtime.path}/bin"/> - <arg value="-oHandlerTest.exe"/> - <arg value="HandlerTest_Top.o"/> - <arg value="HandlerUser.o"/> - <arg value="SubSystem_HandlerTest.o"/> - <arg value="Tester.o"/> - <arg value="TestProtocol.o"/> - <arg value="SubSystem_HandlerTest_Runner.o"/> - - <!-- library has to be in the last position --> - <arg value="-lorg.eclipse.etrice.runtime.cpp"/> - <arg value="-lorg.eclipse.etrice.runtime.c"/> - <arg value="-lpthread"/> - </exec> - - <!-- compile and link ChoicepointTest --> - <mkdir dir="bin/ChoicePointTest"/> - <exec dir="bin/ChoicePointTest" executable="gcc" failonerror="true" output="${output}/build.txt" append="true"> - <arg value="-I../../src-gen/ChoicePointTest"/> - <arg value="-I../../src-gen/HandlerTest"/> - <arg value="-I../../src-gen"/> - <arg value="-I${cpp-runtime.path}/src"/> - <arg value="-I${cpp-runtime.path}/src/platforms/generic"/> - <arg value="-I${c-runtime.path}/src/common/etUnit"/> - <arg value="-c"/> - <arg value="-g3"/> - <arg value="-O0"/> - <arg value="-Wall"/> - <arg value="../../src-gen/ChoicePointTest/CPTest_Top.cpp"/> - <arg value="../../src-gen/ChoicePointTest/CPTester.cpp"/> - <arg value="../../src-gen/ChoicePointTest/CPUser.cpp"/> - <arg value="../../src-gen/ChoicePointTest/SubSystem_CPTest.cpp"/> - <arg value="../../src-gen/ChoicePointTest/SubSystem_CPTest_Runner.cpp"/> - <arg value="../../src-gen/ChoicePointTest/TestProtocol.cpp"/> - </exec> - <exec dir="bin/ChoicePointTest" executable="g++" failonerror="true" output="${output}/build.txt" append="true"> - <arg value="-L${cpp-runtime.path}/bin"/> - <arg value="-L${c-runtime.path}/bin"/> - <arg value="-oChoicePointTest.exe"/> - <arg value="CPTest_Top.o"/> - <arg value="CPTester.o"/> - <arg value="CPUser.o"/> - <arg value="SubSystem_CPTest.o"/> - <arg value="SubSystem_CPTest_Runner.o"/> - <arg value="TestProtocol.o"/> - - <!-- library has to be in the last position --> - <arg value="-lorg.eclipse.etrice.runtime.cpp"/> - <arg value="-lorg.eclipse.etrice.runtime.c"/> - <arg value="-lpthread"/> - </exec> - </target> + <import file="../org.eclipse.etrice.generator.common.tests/common.xml" as="common"/> - <!-- - run: runs all executables - --> - <target name="run" depends="build"> - <mkdir dir="tmp/log"/> - <echo>start HandlerTest</echo> - <exec dir="./" resolveexecutable="true" executable="./bin/HandlerTest/HandlerTest.exe"> - <arg value="-run_as_test_single_threaded"/> - <arg value="200"/> - </exec> - <echo>end HandlerTest</echo> - <echo>start ChoicePointTest</echo> - <exec dir="./" resolveexecutable="true" executable="./bin/ChoicePointTest/ChoicePointTest.exe"> - <arg value="-run_as_test_single_threaded"/> - <arg value="200"/> - </exec> - <echo>end ChoicePointTest</echo> + <property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.c" /> + <property name="modellib.path" value="../../runtime/org.eclipse.etrice.modellib.cpp" /> + <property name="cpp-runtime.path" value="../../runtime/org.eclipse.etrice.runtime.cpp" /> + + <target name="set_local_rt" unless="runtime.platform"> + <!--<property name="runtime.platform" value="MT_POSIX_GENERIC_GCC"/>--> + <property name="runtime.platform" value="MT_WIN_MinGW"/> + <echo> runtime.platform = ${runtime.platform} </echo> </target> - - <!-- - convert: converts etu- into xunit xml-format - --> - <target name="convert" depends="run,set_tp"> - <path id="clspath"> - <pathelement location="../../plugins/org.eclipse.etrice.etunit.converter/bin"/> - <fileset dir="${target.platform}/plugins/"> - <include name="org.eclipse.core.runtime_3.0*.jar" /> - <include name="org.eclipse.emf.ecore_2.9*.jar" /> - <include name="org.eclipse.emf.ecore.xmi_2.9*.jar" /> - <include name="org.eclipse.emf.common_2.9*.jar" /> - </fileset> - </path> + <target name="setVars" depends="set_local_rt,common.setVars"/> - <java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true"> - <arg value="-suite"/> - <arg value="org.eclipse.etrice.generator.cpp.tests.ChoicePointTest"/> - <arg value="./tmp/ChoicePointTest.etu"/> - <classpath refid="clspath"/> - </java> + <target name="all" depends="clean,copyModels,testing"></target> + + <!-- test := generate 1 executable, build, run, process results --> + <macrodef name="test"> + <attribute name="testId"/> + <attribute name="models"/> + <sequential> + <standaloneGenerator testId="@{testId}" models="@{models}"/> + <build testId="@{testId}"/> + <run testId="@{testId}"/> + <convert testId="@{testId}"/> + <copyResult testId="@{testId}" targetId="${runtime.platform}_"/> + </sequential> + </macrodef> + + <macrodef name="standaloneGenerator"> + <attribute name="testId"/> + <attribute name="models"/> + <sequential> + <mkdir dir="${output}"/> + <java output="${output}/generate.txt" error="${output}/generate_err.txt" classname="org.eclipse.etrice.generator.cpp.Main" fork="true" failonerror="true"> + <arg line="@{models}"/> + <arg value="-genDir"/><arg value="src-gen/@{testId}"/> + <arg value="-msc_instr"/> + <classpath refid="etrice.clspath"/> + </java> + </sequential> + </macrodef> - <java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true"> - <arg value="-suite"/> - <arg value="org.eclipse.etrice.generator.cpp.tests.HandlerTest"/> - <arg value="./tmp/HandlerTest.etu"/> - <classpath refid="clspath"/> - </java> - </target> - <!-- - copy_results: copies the *.xml results to their final destination + build: compiles and links the generated Cpp sources --> - <target name="copy_results" depends="set_tr"> - <move file="./tmp/HandlerTest.xml" tofile="./tmp/CPPHandlerTest.xml"/> - <move file="./tmp/ChoicePointTest.xml" tofile="./tmp/CPPChoicePointTest.xml"/> - <copy todir="${test.results}" > - <fileset dir="./tmp"> - <include name="*.xml"/> - </fileset> - </copy> - </target> - + <macrodef name="build"> + <attribute name="testId"/> + <sequential> + <mkdir dir="${bin.path}"/> + <mkdir dir="${output}"/> + <exec executable="make" failonerror="true" output="${output}/build.txt"> + <arg line="all"/> + <arg line="APP_TARGET=@{testId}.exe"/> + <arg line="APP_BUILD_DIR=${bin.path}"/> + <arg line="APP_SRCDIRS_REC='./src-gen/@{testId} ./src/@{testId}'"/> + <arg line="RUNTIME_ROOTDIR=${runtime.path}"/> + <arg line="CPP_RUNTIME_ROOTDIR=${cpp-runtime.path}"/> + <arg line="MODELLIB_ROOTDIR=${modellib.path}"/> + <arg line="TARGET_PLATFORM=${runtime.platform}"/> + </exec> + </sequential> + </macrodef> + + <macrodef name="run"> + <attribute name="testId"/> + <sequential> + <mkdir dir="${output}"/> + <mkdir dir="${testlog.path}"/> + <exec dir="./" output="${output}/run.txt" resolveexecutable="true" executable="${bin.path}/@{testId}.exe" timeout="${run.msTimout}"> + <arg value="-run_as_test"/> + </exec> + </sequential> + </macrodef> + </project> diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch b/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch new file mode 100644 index 000000000..54f143362 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType"> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.etrice.generator.cpp.tests/make.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.etrice.generator.cpp.tests"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.etrice.generator.cpp.tests/make.xml}"/> +<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> +</launchConfiguration> diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt b/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/.cproject b/tests/org.eclipse.etrice.runtime.cpp.tests/.cproject new file mode 100644 index 000000000..7a09a88d8 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/.cproject @@ -0,0 +1,374 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204" moduleId="org.eclipse.cdt.core.settings" name="WindowsMinGW"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204" name="WindowsMinGW" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.333652971" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug"> + <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.2002187708" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp.tests}/Debug" id="cdt.managedbuild.tool.gnu.builder.mingw.base.376402989" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.1859573569" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug"> + <option id="gnu.both.asm.option.include.paths.1616249053" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.722337777" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.647933314" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.746876317" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug"> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.916502134" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1574306472" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.850779831" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> + </option> + <option id="gnu.cpp.compiler.option.dialect.std.313288963" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.1868549925" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1478140798" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.125170264" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.830668133" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1809297742" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.433080766" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1125517806" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1932519409" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.890209919" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"> + <option id="gnu.cpp.link.option.paths.1430157570" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/WindowsMinGW}""/> + </option> + <option id="gnu.cpp.link.option.libs.1444909470" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1693078080" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284" moduleId="org.eclipse.cdt.core.settings" name="ExternalMakefile"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284" name="ExternalMakefile" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.222379996" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug"> + <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.456024798" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/> + <builder cleanBuildTarget="clean" id="cdt.managedbuild.target.gnu.builder.base.1758570028" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.1016703293" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug"> + <option id="gnu.both.asm.option.include.paths.1820048788" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.212725916" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.364419494" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.2004158901" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug"> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.672194640" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1060412068" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.726169670" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> + </option> + <option id="gnu.cpp.compiler.option.dialect.std.1890919144" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.1282943599" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.2079288845" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.2091049489" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.18679697" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1440952348" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.1221168362" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.476756084" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1361293351" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.451030529" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"> + <option id="gnu.cpp.link.option.paths.1073652718" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/WindowsMinGW}""/> + </option> + <option id="gnu.cpp.link.option.libs.1324414164" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.490609800" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;cdt.managedbuild.config.gnu.mingw.lib.debug.1978608919" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;cdt.managedbuild.config.gnu.mingw.lib.debug.878140176" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702" moduleId="org.eclipse.cdt.core.settings" name="NoCDTBuild"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702" name="NoCDTBuild" parent="cdt.managedbuild.config.gnu.mingw.exe.debug"> + <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702." name="/" resourcePath=""> + <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.368556574" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug"> + <targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.36602644" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/> + <builder buildPath="${workspace_loc:/org.eclipse.etrice.runtime.cpp.tests}/NoCDTBuild" enableCleanBuild="false" enabledIncrementalBuild="false" id="org.eclipse.cdt.build.core.internal.builder.1720786292" superClass="org.eclipse.cdt.build.core.internal.builder"/> + <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.789259845" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug"> + <option id="gnu.both.asm.option.include.paths.1341683413" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.assembler.input.483312870" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1301668920" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.919094397" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug"> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.1155390131" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> + <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1528455563" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.include.paths.247464205" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> + </option> + <option id="gnu.cpp.compiler.option.dialect.std.962400607" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++98" valueType="enumerated"/> + <option id="gnu.cpp.compiler.option.warnings.pedantic.275984010" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1786655814" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.414647931" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug"> + <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.322049143" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> + <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1501583494" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/> + <option id="gnu.c.compiler.option.include.paths.225039145" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src/}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src-gen}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/src}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/src/util}""/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.166430505" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> + </tool> + <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1858445743" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/> + <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.326802020" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"> + <option id="gnu.cpp.link.option.paths.1352233185" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths"> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.cpp/WindowsMinGW}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/org.eclipse.etrice.runtime.c/WindowsMinGW}""/> + </option> + <option id="gnu.cpp.link.option.libs.1439602349" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.cpp"/> + <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/> + </option> + <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1422818644" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> + <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> + <additionalInput kind="additionalinput" paths="$(LIBS)"/> + </inputType> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> + <externalSettings containerId="org.eclipse.etrice.runtime.c;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.c"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/config"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/util"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.c/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.c" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + <externalSettings containerId="org.eclipse.etrice.runtime.cpp;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> + <externalSetting> + <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/org.eclipse.etrice.runtime.cpp"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src/"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.c/src/common"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src-gen"/> + <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="includePath" name="/org.eclipse.etrice.runtime.cpp/src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/org.eclipse.etrice.runtime.cpp/WindowsMinGW"/> + <entry flags="RESOLVED" kind="libraryFile" name="org.eclipse.etrice.runtime.cpp" srcPrefixMapping="" srcRootPath=""/> + </externalSetting> + </externalSettings> + </storageModule> + </cconfiguration> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="org.eclipse.etrice.runtime.cpp.tests.cdt.managedbuild.target.gnu.mingw.exe.129898214" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> + <storageModule moduleId="refreshScope" versionNumber="2"> + <configuration configurationName="ExternalMakefile"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp.tests"/> + </configuration> + <configuration configurationName="ExternalMakeFile"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp.tests"/> + </configuration> + <configuration configurationName="WindowsMinGW"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp.tests"/> + </configuration> + <configuration configurationName="Debug"> + <resource resourceType="PROJECT" workspacePath="/org.eclipse.etrice.runtime.cpp.tests"/> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702;cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.414647931;cdt.managedbuild.tool.gnu.c.compiler.input.166430505"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204;cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.125170264;cdt.managedbuild.tool.gnu.c.compiler.input.1125517806"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204;cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.746876317;cdt.managedbuild.tool.gnu.cpp.compiler.input.1478140798"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702;cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.1090328702.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.919094397;cdt.managedbuild.tool.gnu.cpp.compiler.input.1786655814"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + </scannerConfigBuildInfo> + </storageModule> +</cproject> diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/.gitignore b/tests/org.eclipse.etrice.runtime.cpp.tests/.gitignore new file mode 100644 index 000000000..fccb0c83d --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/.gitignore @@ -0,0 +1,6 @@ +PosixLinux +WindowsMinGW +bin +output +results +log diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/.project b/tests/org.eclipse.etrice.runtime.cpp.tests/.project new file mode 100644 index 000000000..d05e35bdb --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/.project @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.etrice.runtime.cpp.tests</name> + <comment></comment> + <projects> + <project>org.eclipse.etrice.runtime.cpp</project> + <project>org.eclipse.etrice.runtime.c</project> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <triggers></triggers> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + </natures> +</projectDescription> diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/.settings/org.eclipse.cdt.core.prefs b/tests/org.eclipse.etrice.runtime.cpp.tests/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 000000000..6cdcbd396 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/CPP_RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/CPP_RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/CPP_RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.cpp} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/ECLIPSE_MODE/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/ECLIPSE_MODE/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/ECLIPSE_MODE/value=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/RUNTIME_ROOTDIR/delimiter=; +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/RUNTIME_ROOTDIR/operation=append +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/RUNTIME_ROOTDIR/value=${workspace_loc\:org.eclipse.etrice.runtime.c} +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/append=true +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204.815150284/appendContributed=true diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/tests/org.eclipse.etrice.runtime.cpp.tests/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 000000000..2d6be3272 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.73123204/appendContributed=true diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/Makefile b/tests/org.eclipse.etrice.runtime.cpp.tests/Makefile new file mode 100644 index 000000000..6d6a9607b --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/Makefile @@ -0,0 +1,14 @@ +include ${CPP_RUNTIME_ROOTDIR}/buildTools/runtime.mk + +# --- +IN_TARGET := $(notdir $(shell pwd)).exe +IN_BUILD_DIR := ./bin +IN_INCDIRS += ./src +IN_SRCDIRS_REC += ./src +CC = ${CXX} +IN_CFLAGS += -std=c++98 -O0 -g3 -pedantic -Wall +#--- + + +# Create rules +include ${RUNTIME_ROOTDIR}/buildTools/Makefile.mk diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec b/tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec new file mode 100644 index 000000000..74fcad21d --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/buckminster.cspec @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?><cs:cspec xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0" name="org.eclipse.etrice.runtime.cpp.tests" componentType="buckminster" version="0.5.0.qualifier"> + <cs:actions> + <cs:public name="run_tests" actor="ant"> + <cs:actorProperties> + <cs:property key="buildFile" value="make.xml"/> + <cs:property key="targets" value="all"/> + </cs:actorProperties> + </cs:public> + </cs:actions> +</cs:cspec> diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/make.xml b/tests/org.eclipse.etrice.runtime.cpp.tests/make.xml new file mode 100644 index 000000000..438134e86 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/make.xml @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<!-- + Ant makefile for building and running of tests. + This includes conversion of the etunit + results into xunit xml. + + @author Henrik Rentz-Reichert +--> +<project name="org.eclipse.etrice.runtime.cpp.tests" basedir="." default="all"> + + <import file="../org.eclipse.etrice.generator.common.tests/common.xml" as="common"/> + + <property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.c" /> + <property name="cpp-runtime.path" value="../../runtime/org.eclipse.etrice.runtime.cpp" /> + + <target name="set_local_rt" unless="runtime.platform"> + <!-- <property name="runtime.platform" value="MT_POSIX_GENERIC_GCC"/> --> + <property name="runtime.platform" value="MT_WIN_MinGW"/> + <echo> runtime.platform = ${runtime.platform} </echo> + </target> + <target name="setVars" depends="set_local_rt,common.setVars"/> + + <!-- + all: compiles, runs, converts and copies the results + --> + <target name="all" depends="convert,copy_results"> + <echo>done with ${ant.project.name}</echo> + </target> + + <!-- + build: compiles and link everything + --> + <target name="build" depends="setVars,clean"> + <mkdir dir="${output}"/> + <mkdir dir="${bin.path}"/> + <exec executable="make" failonerror="true" output="${output}/build.txt"> + <arg line="all"/> + <arg line="RUNTIME_ROOTDIR=${runtime.path}"/> + <arg line="TARGET_PLATFORM=${runtime.platform}"/> + <arg line="CPP_RUNTIME_ROOTDIR=${cpp-runtime.path}"/> + </exec> + </target> + + <!-- + run: runs all executables + --> + <target name="run" depends="build"> + <mkdir dir="${testlog.path}"/> + <echo>start RuntimeTest</echo> + <exec resolveexecutable="true" executable="${bin.path}/${ant.project.name}.exe" output="${output}/run.txt" /> + <echo>end RuntimeTest</echo> + </target> + + <!-- + convert: converts etu- into xunit xml-format + --> + <target name="convert" depends="run"> + <convert testId="TestCppRuntime"/> + </target> + + <!-- + copy_results: copies the *.xml results to their final destination + --> + <target name="copy_results" depends="setVars"> + <copyResult testId="TestCppRuntime" targetid="${runtime.platform}_"/> + </target> + +</project> diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch b/tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch new file mode 100644 index 000000000..8f91fcc76 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/org.eclipse.etrice.runtime.cpp.tests make.xml.launch @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType"> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.etrice.runtime.cpp.tests/make.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.etrice.runtime.cpp.tests"/> +<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.etrice.runtime.cpp.tests/make.xml}"/> +<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> +</launchConfiguration> diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/RunAllTestCases.cpp index 40e97cf86..d536c17b1 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/messaging/IMessageReceiver.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/RunAllTestCases.cpp @@ -1,23 +1,28 @@ /******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) + * Juergen Haug (initial contribution) * *******************************************************************************/ -#include "IMessageReceiver.h" +#include "messaging/AddressTest.h" -namespace etRuntime { +#include "etUnit/etUnit.h" -IMessageReceiver::IMessageReceiver() { -} +int main(){ + + etUnit_open("log/testlog","TestCppRuntime"); + + AddressTest addressTest; + addressTest.run(); + + etUnit_close(); -IMessageReceiver::~IMessageReceiver() { + return 0; } -} /* namespace etRuntime */ diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.cpp new file mode 100644 index 000000000..4d141e518 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.cpp @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +#include "AddressTest.h" + +#include "common/messaging/Address.h" +#include "util/etAssert.h" + +using namespace etRuntime; + +void AddressTest::testAddress() { + Address addr(1, 2, 3); + assertEquals(1, addr.m_nodeID); + assertEquals(2, addr.m_threadID); + assertEquals(3, addr.m_objectID); +} + +void AddressTest::testToString() { + +} + +void AddressTest::runAllTestCases(){ + ADD_TESTCASE(testAddress) +} diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h new file mode 100644 index 000000000..be72407e1 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/messaging/AddressTest.h @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_MESSAGING_ADDRESSTEST_H_ +#define SRC_MESSAGING_ADDRESSTEST_H_ + +#include "util/etTestSuite.h" + +class AddressTest : public etTestSuite { + +public: + AddressTest() : + etTestSuite("AddressTest"){ + } + +protected: + void testAddress(); + void testToString(); + + virtual void runAllTestCases(); +}; + + + +#endif /* SRC_MESSAGING_ADDRESSTEST_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etAssert.h index c0051f968..4ee1ad8fb 100644 --- a/runtime/org.eclipse.etrice.runtime.cpp/src/common/modelbase/IEventReceiver.cpp +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etAssert.h @@ -1,23 +1,20 @@ /******************************************************************************* - * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com). + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * CONTRIBUTORS: - * Peter Karlitschek (initial contribution) + * Juergen Haug (initial contribution) * *******************************************************************************/ +#ifndef SRC_UTIL_ETASSERT_H_ +#define SRC_UTIL_ETASSERT_H_ -#include "IEventReceiver.h" +class etAssert { +public: + static void assertEquals(int arg1, int arg2); +}; -namespace etRuntime { - -IEventReceiver::IEventReceiver() { -} - -IEventReceiver::~IEventReceiver() { -} - -} /* namespace etRuntime */ +#endif /* SRC_UTIL_ETASSERT_H_ */ diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etTestSuite.cpp b/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etTestSuite.cpp new file mode 100644 index 000000000..5ca28c7d1 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etTestSuite.cpp @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +#include "etTestSuite.h" + +#include "etUnit/etUnit.h" + +void etTestSuite::assertEquals(const int arg1, const int arg2) { + EXPECT_EQUAL_INT32(1, "", arg1, arg2); +} + +void etTestSuite::run() { + etUnit_openTestSuite(m_suiteName.c_str()); + runAllTestCases(); + etUnit_closeTestSuite(); +} + +void etTestSuite::openTestCase(const std::string& name) { + m_caseId = etUnit_openTestCase(name.c_str()); +} +void etTestSuite::closeTestCase(int id) { + etUnit_closeTestCase(m_caseId); +} + diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etTestSuite.h b/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etTestSuite.h new file mode 100644 index 000000000..acaa550c2 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/src/util/etTestSuite.h @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ +#ifndef SRC_UTIL_ETTESTSUITE_H_ +#define SRC_UTIL_ETTESTSUITE_H_ + +#include <string> + +class etTestSuite { +public: + etTestSuite(const std::string& name) : + m_suiteName(name), + m_caseId(0) { + } + virtual ~etTestSuite() { + } + + void run(); + +protected: + + // asserts + void assertEquals(const int arg1, const int arg2); + + // infra +#define ADD_TESTCASE(testcase) \ + {openTestCase(#testcase); \ + testcase(); \ + closeTestCase(m_caseId);} + + void openTestCase(const std::string& name); + void closeTestCase(int id); + + virtual void runAllTestCases() = 0; + + std::string m_suiteName; + int m_caseId; + +}; + +#endif /* SRC_UTIL_ETTESTSUITE_H_ */ |