Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl52
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl40
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl38
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl37
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl94
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl52
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl28
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl22
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl14
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl29
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl26
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl12
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl15
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl40
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl19
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl24
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl11
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl15
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl30
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl79
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl18
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl21
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl35
23 files changed, 751 insertions, 0 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl
new file mode 100644
index 00000000000..2aea121b9e5
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl
@@ -0,0 +1,52 @@
+[comment encoding = UTF-8 /]
+[module Constants('http://www.eclipse.org/uml2/4.0.0/UML')]
+
+
+[template public includeHFile(dummy : Element)]
+// include associated header file
+[/template]
+
+[template public IncludeHeaderStart(dummy : Element)]
+// Include from Include stereotype (header)
+[/template]
+
+[template public IncludePreBodyStart(dummy : Element)]
+// Include from Include stereotype (pre-body)
+[/template]
+
+[template public IncludePreBodyEnd(dummy : Element)]
+// End of Include stereotype (pre-body)
+[/template]
+
+[template public IncludeBodyStart(dummy : Element)]
+// Include from Include declaration (body)
+[/template]
+
+[template public IncludeHeaderEnd(dummy : Element)]
+// End of Include stereotype (header)
+[/template]
+
+[template public IncludeBodyEnd(dummy : Element)]
+// End of Include stereotype (body)
+[/template]
+
+[template public derivedIncludes(dummy : Element)]
+// Derived includes directives
+[/template]
+
+[template public forwardDecl(dummy : Element)]
+// forward declarations
+[/template]
+
+[template public staticAttributes(dummy : Element)]
+// static attributes (if any)
+[/template]
+
+[template public packageTypes(dummy : Element)]
+// Types defined within the package
+[/template]
+
+
+[template public undefinedType(dummy : Element)]
+undefined
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl
new file mode 100644
index 00000000000..da720a05838
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl
@@ -0,0 +1,40 @@
+[module CppBindBody('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
+
+
+[template public CppBindBody(class : Class)]
+#define [getFullNameUC()/]_BODY
+
+/************************************************************
+ [class.name/] template binding body
+ ************************************************************/
+
+[IncludePreBody()/]
+
+[includeHFile()/]
+#include <[_package.getFullPath()/][class.name/].[getHeaderSuffix()/]>
+
+[IncludeBody()/]
+
+[openNS()/]
+
+[derivedIncludes()/]
+[CppClassAllIncludesDeclaration()/]
+
+/************************************************************/
+[let tb : TemplateBinding = getTemplateBindings()]
+[let templateElement : Classifier = tb.target->asSequence()->first()]
+template class [templateElement.name/] <[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]> [class.name/];
+[/let][/let]
+[closeNS()/]
+
+/************************************************************
+ End of [class.name/] template binding body
+ ************************************************************/
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
new file mode 100644
index 00000000000..99148264afc
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
@@ -0,0 +1,38 @@
+[module CppBindHeader('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
+[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
+
+
+[template public CppBindHeader(class : Class)]
+#ifndef [getFullNameUC()/]_H
+#define [getFullNameUC()/]_H
+
+/************************************************************
+ [class.name/] template binding header
+ ************************************************************/
+
+[_package.CppOwnerPackageIncludeDeclaration()/]
+
+[CppClassAllIncludesDeclaration()/]
+
+[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header/]
+
+[let tb : TemplateBinding = getTemplateBindings()]
+[let templateElement : Classifier = tb.target->asSequence()->first()]
+#include <[_package.getFullPath()/]/[templateElement.owner.oclAsType(NamedElement).name/].[getHeaderSuffix()/]>
+
+[openNS()/]
+/************************************************************/
+typedef [templateElement.name/] <[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]> [class.name/];
+
+[closeNS()/]
+[/let][/let]
+
+/************************************************************
+ End of [class.name/] template binding header
+ ************************************************************/
+
+#endif
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl
new file mode 100644
index 00000000000..cf2e1f70034
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl
@@ -0,0 +1,37 @@
+[module CppClassBody('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsImplementation/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::property::CppAttributeImplementation/]
+
+
+[template public CppClassBody(class : Classifier)]
+#define [getFullName()/]_BODY
+
+/************************************************************
+ [class.name/] class body
+ ************************************************************/
+
+[IncludePreBody()/]
+
+[includeHFile()/]
+#include <[_package.getFullPath()/]/[class.name/].[getHeaderSuffix()/]>
+
+[IncludeBody()/]
+
+[derivedIncludes()/]
+[CppClassAllIncludesDeclaration()/]
+
+[openNS(class)/]
+[CppStaticAttributes(class)/]
+[CppClassOperationsImplementation(false)/]
+[closeNS(class)/]
+
+/************************************************************
+ End of [class.name/] class body
+ ************************************************************/
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl
new file mode 100644
index 00000000000..54920cec07c
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl
@@ -0,0 +1,94 @@
+[module CppClassHeader('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassTypeAndEnum/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassFriendDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassInheritedDeclarations/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassAttributesDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsImplementation/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+
+
+
+[query public classUnionOrStruct(classifier : Classifier) : String =
+if (hasStereotype(C_Cpp::Union)) then 'union'
+else
+ if (oclIsKindOf(DataType)) then 'struct'
+ else 'class'
+ endif
+endif
+/]
+
+[comment default initializer for non-static attributes with a default value
+TODO: should be disabled by default, since non-static members can be initialized directly
+in C++ 011/]
+[template public defaultInitializer(classifier : Classifier) post(trim())]
+[let attributeList : Set(Property) = attribute->select(
+ (isStatic = false) and
+ (defaultValue <> null) and
+ (defaultValue.stringValue() <> null))]
+[if not attributeList->isEmpty()]
+ [classifier.name/]() : [for (a : Property | attributeList) separator(', ')
+ ][name/]([defaultValue.stringValue()/])[/for] {}
+[/if][/let]
+[/template]
+
+
+[template public CppClassHeader(class : Classifier)]
+#ifndef [getFullNameUC()/]_H
+#define [getFullNameUC()/]_H
+
+/************************************************************
+ [class.name/] class header
+ ************************************************************/
+
+[_package.CppOwnerPackageIncludeDeclaration()/]
+
+[CppClassAllIncludesDeclaration()/]
+
+[IncludeHeader()/]
+
+[openNS()/]
+[_package.CppClassTypeAndEnumPackage()/]
+/************************************************************/
+[CppElementDoc()/]
+[templateSignature()/][classUnionOrStruct()/] [class.name/][CppClassInheritedDeclarations()/] {
+[CppClassIncludeFriendDeclaration()/][CppClassTypeAndEnum()/]
+
+ public:
+[defaultInitializer()/][CppClassAttributesDeclaration(VisibilityKind::public)/][CppClassOperationsDeclaration(VisibilityKind::public)/]
+
+ protected:
+[CppClassAttributesDeclaration(VisibilityKind::protected)/][CppClassOperationsDeclaration(VisibilityKind::protected)/]
+
+ private:
+[CppClassAttributesDeclaration(VisibilityKind::private)/][CppClassOperationsDeclaration(VisibilityKind::private)/]
+
+};
+/************************************************************/
+/* External declarations (package visibility) */
+[CppClassAttributesDeclaration(VisibilityKind::_package)/]
+[CppClassOperationsDeclaration(VisibilityKind::_package)/]
+/************************************************************/
+
+[if (isTemplate())]
+/************************************************************/
+/* Template functions */
+[CppClassOperationsImplementation(false)/]
+[/if]
+
+/* Inline functions */
+[CppClassOperationsImplementation(true)/]
+[closeNS()/]
+
+/************************************************************
+ End of [class.name/] class header
+ ************************************************************/
+
+#endif
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl
new file mode 100644
index 00000000000..95a0f6b8e65
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl
@@ -0,0 +1,52 @@
+[module CppPackageHeader('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassTypeAndEnum/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassFriendDeclaration/]
+
+
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+
+
+[template public CppPackageHeader(pkg : Package)]
+#ifndef PKG_[getFullNameUC()/]
+#define PKG_[getFullNameUC()/]
+
+/************************************************************
+ Pkg_[name/] package header
+ ************************************************************/
+
+[nestingPackage.CppOwnerPackageIncludeDeclaration()/]
+
+#ifndef _IN_
+#define _IN_
+#endif
+#ifndef _OUT_
+#define _OUT_
+#endif
+#ifndef _INOUT_
+#define _INOUT_
+#endif
+
+
+/* Package dependency header include */
+[for (getUsedPackages())]
+#include <[getFullPath()/]/Pkg_[name/].[getHeaderSuffix()/]>
+[/for]
+
+[IncludeHeader()/]
+
+[openNS()/]
+[packageTypes()/]
+[CppClassTypeAndEnumPackage()/]
+[closeNS()/]
+
+/************************************************************
+ End of Pkg_[name/] package header
+ ************************************************************/
+
+#endif
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl
new file mode 100644
index 00000000000..cd81da94794
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl
@@ -0,0 +1,28 @@
+[comment encoding = UTF-8 /]
+[module IncludeUtils('http://www.eclipse.org/uml2/4.0.0/UML')]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
+
+[template public IncludeHeader(ne : NamedElement)]
+[if (hasStereotype(C_Cpp::Include) and (getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header.size() > 0))]
+[IncludeHeaderStart()/]
+[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header/]
+[IncludeHeaderEnd()/]
+[/if]
+[/template]
+
+[template public IncludeBody(ne : NamedElement)]
+[if (hasStereotype(C_Cpp::Include) and (getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include)._body <> null))]
+[IncludeBodyStart()/]
+[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include)._body/]
+[IncludeBodyEnd()/]
+[/if]
+[/template]
+
+[template public IncludePreBody(ne : NamedElement)]
+[if (hasStereotype(C_Cpp::Include))]
+[IncludePreBodyStart()/]
+[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).preBody/]
+[IncludePreBodyEnd()/]
+[/if]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl
new file mode 100644
index 00000000000..644096558af
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl
@@ -0,0 +1,22 @@
+[module CppDocumentation('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+
+
+[template public CppElementDoc(argument : Element)]
+/**
+ * [getComments().replaceAll('\n', '\n * ')/]
+ */
+[/template]
+
+
+[template public CppOperationDoc(operation : Operation)]
+/**
+ * [getComments().replaceAll('\n', '\n * ')/]
+ * [for (ownedParameter)][CppParamDoc()/][/for]
+ */
+[/template]
+
+
+[template public CppParamDoc(parameter : Parameter)]
+@param [name/] [getComments().replaceAll('\n', '\n * ')/]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl
new file mode 100644
index 00000000000..97f7653d5c2
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl
@@ -0,0 +1,14 @@
+[module CppEnumerations('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+
+[template public CppEnumerationDefinition(enum : Enumeration)]
+[CppElementDoc()/]
+enum [enum.name/] {
+[for (ownedLiteral)]/
+ [CppElementDoc()/]
+ [name/][if hasStereotype(CppInit)] = [getApplication(CppInit).oclAsType(CppInit).value/][/if],
+[/for]
+};
+
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl
new file mode 100644
index 00000000000..28072961454
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl
@@ -0,0 +1,29 @@
+[module CppPrimitiveTypes('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+
+
+[comment
+ * Support two different kinds of primitive types
+ * (1) those that are native types of the programming language such as long
+ * For these, no additional definition has to be done and they should be referenced
+ * with their name only
+ * (2) those that correspond to a typedef (e.g. typedef long ErrorType). These require
+ * a typedef definition within the package and need to be referenced with their
+ * fully qualified name (e.g. MyPackage::ErrorType)
+ * (3) Sometimes the name of the type defined by a typedef does not appear at the end, e.g.
+ * when defining functionPointers such as "typedef int (*HandlerFct) (void*);"
+ * (a function with a void* argument returning int)
+ * Support this case via a specific 'typeName' constant that gets replaced by the name of the
+ * type
+ */
+/]
+[template public CppPrimitiveTypeDefinition(primitiveType : PrimitiveType)]
+[CppElementDoc()/]
+[if (hasStereotype(Typedef))]
+typedef [getApplication(Typedef).oclAsType(Typedef).definition.replaceAll('typeName', primitiveType.name)
+ /][if (not getApplication(Typedef).oclAsType(Typedef).definition.contains('typeName'))] [primitiveType.name/][/if];
+[else]
+[getStdtypes(primitiveType)/];
+[/if]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl
new file mode 100644
index 00000000000..0cb88942a45
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl
@@ -0,0 +1,26 @@
+[module CppTemplates('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+
+
+[query public CppTemplateBindingParameter(tps : TemplateParameterSubstitution) : String =
+if (tps.actual.oclIsKindOf(LiteralInteger)) then
+ tps.actual.oclAsType(LiteralInteger).value
+else
+ tps.actual.oclAsType(NamedElement).name
+endif
+/]
+
+[query public isTemplate(class : Classifier) : Boolean =
+ getTemplateParameters()->size() > 0
+/]
+
+
+[template public templateSignature(class : Classifier)]
+[if isTemplate()]
+template<[for (getTemplateParameters()) separator(', ')][getType()/][/for]> [/if]
+[/template]
+
+
+[template public templateSignature(operation : Operation)]
+[owner.oclAsType(Classifier).templateSignature()/]
+[/template] \ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl
new file mode 100644
index 00000000000..0b184a07bc2
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl
@@ -0,0 +1,12 @@
+[module CppClassAttributesDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::property::CppAttributeDeclaration/]
+
+
+
+[template public CppClassAttributesDeclaration(class : Classifier, visibilityFilter : VisibilityKind)]
+[for (attribute->select(visibility = visibilityFilter))]
+
+ [CppAttributeDeclaration()/]
+[/for]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl
new file mode 100644
index 00000000000..8477e8483dc
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl
@@ -0,0 +1,15 @@
+[module CppClassFriendDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+
+
+[template public CppClassFriendDeclaration(friend : Classifier)]
+friend class [friend.qualifiedName()/];
+[/template]
+
+[template public CppClassIncludeFriendDeclaration(class : Classifier)]
+[for (getUsedClassifiers())]
+ [if hasStereotype(C_Cpp::Friend) and (not hasStereotype(C_Cpp::NoCodeGen))]
+ [CppClassFriendDeclaration()/]
+ [/if]
+[/for]
+[/template] \ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl
new file mode 100644
index 00000000000..8db26305532
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl
@@ -0,0 +1,40 @@
+[module CppClassIncludeClassDeclaration('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeDeclaration/]
+
+[comment USED??? /]
+[template public CppClassIncludeClassDeclarationTemplate(class : Class)]
+[openNS()/]
+[if hasStereotype(class, 'CppTemplate.class')]template [/if]class [class.name/];
+[closeNS()/]
+[/template]
+
+
+[template public CppOwnerPackageIncludeDeclaration(pkg : Package)]
+[comment if currentPkg is not root it is referenced here/]
+[if ((pkg <> null) and (not hasStereotype(CppRoot)))]
+/* Owner package header include */
+#include <[getFullPath()/]/Pkg_[pkg.name/].h>
+[/if]
+[/template]
+
+
+[template public CppClassAllIncludesDeclaration(class : Classifier)]
+[for (cl : Classifier | includedClassifiers())]
+ [comment Only add include if this is not for the current class and if it does not have the stereotype "CppNoCodeGen", unless
+ it has stereotype "CppExternalClass"/]
+ [if((cl <> class) and (not hasStereotype(NoCodeGen)) or hasStereotype(ExternClass))]
+ [if(oclIsKindOf(Enumeration) or oclIsKindOf(PrimitiveType))]
+ [comment Enumeration is not defined in a separate file, but in the package that owns it
+ => include the owning package (might be a duplicate input, if owning package is also the owner of current class/]
+ [if (cl.owner.oclIsKindOf(Package))]
+[cl.owner.oclAsType(Package).CppOwnerPackageIncludeDeclaration()/]
+ [/if]
+ [else]
+ [comment include file associated with the classifier/]
+[CppClassIncludeDeclaration()/]
+ [/if]
+ [/if]
+[/for]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl
new file mode 100644
index 00000000000..9634496107a
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl
@@ -0,0 +1,19 @@
+[module CppClassIncludeDeclaration('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
+
+
+[query public includeName(ne : NamedElement) : String =
+if (hasStereotype(Template)) then
+ getApplication(Template).oclAsType(Template).declaration
+else
+ if (hasStereotype(ExternClass)) then getApplication(ExternClass).oclAsType(ExternClass).name
+ else ne.name + '.' + getHeaderSuffix()
+ endif
+endif
+/]
+
+[comment TODO: original code did not use nearest package, if stereotype CppRoot was applied/]
+[template public CppClassIncludeDeclaration(ne : NamedElement)]
+#include <[getNearestPackage().getFullPath()/]/[ne.includeName()/]>
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl
new file mode 100644
index 00000000000..22eb62b8de0
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl
@@ -0,0 +1,24 @@
+[module CppClassInheritedDeclarations('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+
+[comment
+Return a list of relationships that are either Generalizations or InterfaceRealiazations
+and the target does not point to a classifier that has the no-code-gen Stereotype
+TODO: not sure if it makes sense NOT to declare an inheritance, since we do not generate code.
+/]
+[query public filteredRelationships(class : Classifier) : Set(DirectedRelationship) =
+ getSourceDirectedRelationships()->select(
+ (oclIsKindOf(Generalization) or oclIsKindOf(InterfaceRealization)) and
+ (not target->asSequence()->first().hasStereotype(NoCodeGen))
+ )
+/]
+
+[query public getCppVisibility(relationship : Relationship) : String =
+if (hasStereotype(Visibility)) then getApplication(Visibility).oclAsType(Visibility).value else 'public' endif
+/]
+
+[template public CppClassInheritedDeclarations(class : Classifier)]
+[if (filteredRelationships()->size() > 0)] : [/if]
+[for (filteredRelationships()) separator(', \n')]
+ [getCppVisibility()/] [target->asSequence()->first().oclAsType(Classifier).qualifiedName()/][/for]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl
new file mode 100644
index 00000000000..e15580adddf
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl
@@ -0,0 +1,11 @@
+[module CppClassOperationsDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperationDeclaration/]
+
+
+[template public CppClassOperationsDeclaration(class : Classifier, visibilityFilter : VisibilityKind)]
+[for (getOperations()->select(visibility = visibilityFilter))]
+
+ [CppOperationDeclaration()/]
+[/for]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl
new file mode 100644
index 00000000000..aeaf01f3fe6
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl
@@ -0,0 +1,15 @@
+[module CppClassOperationsImplementation('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperationDeclaration/]
+
+
+[comment implementations of a classifier, parameter controls whether only inline (or only not inline) operations
+ are produced/]
+[template public CppClassOperationsImplementation(class : Classifier, inline : Boolean)]
+[for (getOperations()->select(
+ (not (hasStereotype(NoCodeGen) or isAbstract)) and
+ (hasStereotype(C_Cpp::Inline) = inline)))]
+
+[CppOperationImplementation()/]
+[/for]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl
new file mode 100644
index 00000000000..50f2a7c4928
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl
@@ -0,0 +1,30 @@
+[module CppClassTypeAndEnum('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppPrimitiveTypes/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppEnumerations/]
+
+[template public TypeAndEnumForVisibility(element : Element, visibilityFilter : VisibilityKind)]
+[if (not hasStereotype(NoCodeGen) and oclIsKindOf(Classifier) and oclAsType(Classifier).visibility = visibilityFilter)]
+[ if (oclIsKindOf(Enumeration))][oclAsType(Enumeration).CppEnumerationDefinition()/][/if]
+[ if (oclIsKindOf(PrimitiveType))][oclAsType(PrimitiveType).CppPrimitiveTypeDefinition()/][/if]
+[/if]
+[/template]
+
+[template public TypesAndEnumsForVisibility(ne : Namespace, visibilityFilter : VisibilityKind)]
+[for (ownedElement)][TypeAndEnumForVisibility(visibilityFilter)/][/for]
+[/template]
+
+[template public CppClassTypeAndEnum(class : Classifier)]
+ public:
+ [TypesAndEnumsForVisibility(VisibilityKind::public)/]
+ protected:
+ [TypesAndEnumsForVisibility(VisibilityKind::protected)/]
+ private:
+ [TypesAndEnumsForVisibility(VisibilityKind::private)/]
+[/template]
+
+
+[template public CppClassTypeAndEnumPackage(pkg : Package)]
+[TypesAndEnumsForVisibility(VisibilityKind::_package)/]
+[TypesAndEnumsForVisibility(VisibilityKind::public)/]
+[/template] \ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl
new file mode 100644
index 00000000000..f37e2687c9d
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl
@@ -0,0 +1,79 @@
+[module CppOperationDeclaration('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1', 'http://www.eclipse.org/uml2/4.0.0/UML/Profile/L2')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppParameter/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
+
+
+[template public virtualTxt(operation : Operation)]
+[if((operation.interface <> null) or (operation.isAbstract) or (operation.hasStereotype(Virtual)))]virtual [/if]
+[/template]
+
+
+[template public virtualSuffix(operation : Operation)]
+[if((operation.interface <> null) or (operation.isAbstract))] = 0[/if]
+[/template]
+
+
+[query public ConsDestructorOrVoid(operation : Operation) : String =
+if (hasStereotype(l2::Create)) then
+ ''
+else
+ if (hasStereotype(l2::Destroy)) then
+ '~'
+ else
+ 'void '
+ endif
+endif
+/]
+
+
+[template public CppReturnSpec(operation : Operation)]
+[modConst()/][if (type = null)][ConsDestructorOrVoid()/][else][type.qualifiedName()/] [/if][returnResult().modPtr()/][returnResult().modRef()/]
+[/template]
+
+
+[template public CppConstOp(operation : Operation)]
+[if (hasStereotype(operation, 'Const'))] const[/if]
+[/template]
+
+
+[template public InlineTxt(element : Element)]
+[if (hasStereotype(Inline))]inline [/if]
+[/template]
+
+
+[template public staticTxt(operation : Operation)]
+[if (isStatic)]static [/if]
+[/template]
+
+[template public CppOperationDeclaration(operation : Operation)]
+[CppOperationDoc()/]
+[InlineTxt()/][virtualTxt()/][staticTxt()/][CppReturnSpec()/] [operation.name/]([CppOperationParameters()/])[CppConstOp()/][virtualSuffix()/];
+[/template]
+
+
+[template public CppConstInit(operation : Operation)]
+[if (hasStereotype(ConstInit) and hasStereotype(l2::Create))] : [getApplication(ConstInit).oclAsType(ConstInit).initialisation/][/if]
+[/template]
+
+
+[comment wrapper for native query (otherwise Acceleo does not indent properly)/]
+[template public getBodyInTemplate(operation : Operation, language : String)]
+[getBody(language).trim()/]
+[/template]
+
+
+[template public CppOperationImplementation(operation : Operation)]
+[CppOperationDoc()/]
+[if (operation.name = 'main')]
+[CppReturnSpec()/][operation.name/]([CppOperationParameters()/]) {
+ [getBody('C/C++')/]
+}
+[else]
+[templateSignature()/][InlineTxt()/][CppReturnSpec()/][operation.class.name/]::[operation.name/]([CppOperationParameters()/])[CppConstOp()/][CppConstInit()/] {
+ [getBodyInTemplate('C/C++')/]
+}
+[/if]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl
new file mode 100644
index 00000000000..5b5e08e92ca
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl
@@ -0,0 +1,18 @@
+[module CppParameter('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
+
+
+
+[template public defaultValue(parameter : Parameter)]
+[if (hasStereotype(C_Cpp::Default))] = [getApplication(C_Cpp::Default).oclAsType(C_Cpp::Default).value/][/if]
+[/template]
+
+[template public CppParameter(parameter : Parameter)]
+[modConst()/][parameter.type.qualifiedName()/][modPtr()/][modRef()/] [parameter.name/][modArray()/][defaultValue()/]
+[/template]
+
+
+[template public CppOperationParameters(operation : Operation)]
+[for (ownedParameter->select(direction <> ParameterDirectionKind::return)) separator(', ')][CppParameter()/][/for]
+[/template] \ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl
new file mode 100644
index 00000000000..9a22ee68143
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl
@@ -0,0 +1,21 @@
+[module CppAttributeDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+
+
+
+
+[template public defaultValue(attribute : Property)]
+[if (defaultValue <> null) and isStatic] = [attribute.defaultValue.stringValue()/][/if]
+[/template]
+
+[template public staticValue(attribute : Property)]
+[if (attribute.isStatic)]static [/if]
+[/template]
+
+[template public CppAttributeDeclaration(attribute : Property)]
+[CppElementDoc()/]
+[staticValue()/][modConst()/][attribute.type.qualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/][defaultValue()/];
+[/template]
+
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl
new file mode 100644
index 00000000000..57aae8be4d8
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl
@@ -0,0 +1,35 @@
+[module CppAttributeImplementation('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
+
+
+[comment
+// for static implementation:
+// If attribute is aggregation then generate a pointer
+ if (GenUtils.isAggregation(currentAttribute)) {
+ // attributeName = "(*"+attributeName+")"; // this produce a pointer on a tab
+ isAgg = "*"; // this produce a tab of pointers
+ }
+/]
+
+[template public CppAttributeImplementation(attribute : Property)]
+ [CppElementDoc()/]
+ [modConst()/][attribute.type.qualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/];
+[/template]
+
+[template public CppStaticAttributeImplementation(attribute : Property)]
+ [CppElementDoc()/]
+ [type.qualifiedName()/][modPtr()/][modRef()/][attribute.class.name/]::[attribute.name/][modArray()/];
+[/template]
+
+[comment
+Loop over attributes. Check that the attribute is not a static const.
+Constant static attributes are declared within the class declaration/]
+[template public CppStaticAttributes(classifier : Classifier)]
+[for (classifier.attribute)]
+ [if(isStatic and (not hasStereotype(C_Cpp::Const)))]
+ [CppStaticAttributeImplementation()/]
+ [/if]
+[/for]
+[/template]

Back to the top