Merge "[Bug 468092][codegen][sm] Support for SM inheritance"
diff --git a/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java b/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java
index 3f80f99..acb1561 100644
--- a/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java
+++ b/codegen/org.eclipse.papyrusrt.codegen.cpp.rts/src/org/eclipse/papyrusrt/codegen/cpp/rts/UMLRTRuntime.java
@@ -580,6 +580,17 @@
             return call;
         }
 
+        public static AbstractFunctionCall createPorts( Expression slotAccess, Expression capsuleClass, Expression numPorts, Expression portRoleAccess, Expression isBorder )

+        {

+            AbstractFunctionCall call = new MemberFunctionCall( Element, createPortsFunction );

+            call.addArgument( slotAccess );

+            call.addArgument( capsuleClass );

+            call.addArgument( numPorts );

+            call.addArgument( portRoleAccess );

+            call.addArgument( isBorder );

+            return call;

+        }

+

         public static AbstractFunctionCall disconnectPort( Expression port )
         {
             AbstractFunctionCall call = new MemberFunctionCall( Element, disconnectPortFunction );
@@ -623,17 +634,6 @@
         public static final ExternalElement BaseRole = new ExternalFwdDeclarable( umlrtframeprotocol_hh, "UMLRTFrameProtocol_baserole", "class UMLRTFrameProtocol_baserole" );
         public static final ExternalElement IncarnateSignal = new ExternalElement( umlrtframeprotocol_hh, "signal_incarnate" );
 
-        public static final MemberFunction createPortsFunction = new MemberFunction( UMLRTCommsPort.getType().ptr().const_(), "createPorts" );
-
-        static
-        {
-            createPortsFunction.add( new Parameter( UMLRTSlot.getType().ptr(), "slot" ) );
-            createPortsFunction.add( new Parameter( UMLRTCapsuleClass.getType().ptr().const_(), "capsuleClass" ) ); 
-            createPortsFunction.add( new Parameter( StandardLibrary.size_t, "numPortRoles" ) );
-            createPortsFunction.add( new Parameter( UMLRTCommsPortRole.getType().ptr().const_(), "portRoles" ) );
-            createPortsFunction.add( new Parameter( PrimitiveType.BOOL, "isBorder" ) );
-        }
-
         public static Type getType() { return Element.getType(); }
         public static Type getBaseRoleType() { return BaseRole.getType(); }
 
@@ -644,17 +644,6 @@
             return call;
         }
 
-        public static AbstractFunctionCall createPorts( Expression slotAccess, Expression capsuleClass, Expression numPorts, Expression portRoleAccess, Expression isBorder )
-        {
-            AbstractFunctionCall call = new MemberFunctionCall( Element, createPortsFunction );
-            call.addArgument( slotAccess );
-            call.addArgument( capsuleClass );
-            call.addArgument( numPorts );
-            call.addArgument( portRoleAccess );
-            call.addArgument( isBorder );
-            return call;
-        }
-
         public static Expression Signal( Signal signal )
         {
             if( "incarnate".equals( signal.getName() ) )
@@ -663,7 +652,6 @@
         }
     }
 
-
     /**
      * Return the system-defined Type of the given uml.Type and null if the type is not recognized. 
      */
diff --git a/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java b/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java
index 9ed8a8a..3994624 100644
--- a/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java
+++ b/codegen/org.eclipse.papyrusrt.codegen.cpp/src/org/eclipse/papyrusrt/codegen/cpp/internal/CapsuleGenerator.java
@@ -367,7 +367,7 @@
                 = new Variable(
                         UMLRTRuntime.UMLRTCommsPort.getType().ptr().const_(),
                         "internalPorts",
-                        UMLRTRuntime.UMLRTFrameProtocol.createPorts(
+                        UMLRTRuntime.UMLRTFrameService.createPorts(

                             new ElementAccess( slot ),
                             new AddressOfExpr( new ElementAccess( capsuleClass ) ),
                             new MemberAccess(
diff --git a/models/tests/PingPong-data/PingPong-data.uml b/models/tests/PingPong-data/PingPong-data.uml
index b271b8e..de80055 100755
--- a/models/tests/PingPong-data/PingPong-data.uml
+++ b/models/tests/PingPong-data/PingPong-data.uml
@@ -118,7 +118,7 @@
           <transition xmi:type="uml:Transition" xmi:id="_6Q3f4OzUEeSSF9-rYvvBtA" name="onBound" source="_1KbR4CcQEeSlGd4okkPIfw" target="_1KbR4CcQEeSlGd4okkPIfw">
             <effect xmi:type="uml:OpaqueBehavior" xmi:id="_TM3DYOzVEeSSF9-rYvvBtA" name="onBound">
               <language>C++</language>
-              <body>printf( &quot;%s onBound\n&quot;, getName() );</body>
+              <body>std::cout &lt;&lt; &quot;%s onBound\n&quot; &lt;&lt; getName()  &lt;&lt; std::endl;</body>
             </effect>
             <trigger xmi:type="uml:Trigger" xmi:id="_NjHMoOzVEeSSF9-rYvvBtA" name="bound" event="_n76sUO2ZEeSZS_gdG4Nx_w" port="_aXdiUCbnEeSBQ4h-CZj2Uw"/>
           </transition>
@@ -219,6 +219,7 @@
         <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Real"/>
       </ownedAttribute>
     </packagedElement>
+    <packagedElement xmi:type="uml:Class" xmi:id="_kbWVkAV0EeWtqpXVlfyV9A" name="Capsule1"/>
     <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_ubQ9AFSIEeSJBo_pyoMAEg">
       <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_uc2RYFSIEeSJBo_pyoMAEg" source="http://www.eclipse.org/uml2/2.0.0/UML">
         <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/umlrt#/"/>
@@ -295,4 +296,5 @@
   <UMLRealTime:RTMessageSet xmi:id="_l0EPAO2ZEeSZS_gdG4Nx_w" base_Interface="_l0BywO2ZEeSZS_gdG4Nx_w" rtMsgKind="out"/>
   <UMLRealTime:RTMessageSet xmi:id="_l0HSUO2ZEeSZS_gdG4Nx_w" base_Interface="_l0FdIO2ZEeSZS_gdG4Nx_w" rtMsgKind="inOut"/>
   <UMLRealTime:RTPort xmi:id="_1njV4O2ZEeSZS_gdG4Nx_w" base_Port="_0WWMsO2ZEeSZS_gdG4Nx_w"/>
+  <UMLRealTime:Capsule xmi:id="_kmEX0AV0EeWtqpXVlfyV9A" base_Class="_kbWVkAV0EeWtqpXVlfyV9A"/>
 </xmi:XMI>