You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2007/07/13 20:26:31 UTC

svn commit: r556089 [11/11] - in /incubator/tuscany/cpp/sca: VSExpress/tuscany_sca/tuscany_sca_cpp/ doc/ runtime/extensions/cpp/ runtime/extensions/cpp/tools/ runtime/extensions/cpp/tools/scagen/ runtime/extensions/cpp/tools/scagen/META-INF/ runtime/ex...

Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl?view=auto&rev=556089
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl Fri Jul 13 11:26:14 2007
@@ -0,0 +1,228 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   
+     http://www.apache.org/licenses/LICENSE-2.0
+     
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages
+  - 
+  -  This stylesheet creates the CPP implementation of the 
+  -  proxy header for a given SCA service
+  -->
+
+    <xsl:output method="text" />
+
+    <!-- Delete cppScopes -->
+    <xsl:template match="cppScope"></xsl:template>
+
+    <!-- Delete private methods cppScopes -->
+    <xsl:template match="scaOperation[@cppScope='private']">
+    </xsl:template>
+
+    <!-- Delete private methods cppScopes -->
+    <xsl:template match="scaOperationReturnType"></xsl:template>
+
+
+    <!-- -->
+    <!-- CPP Header/Root -->
+    <!-- -->
+    <xsl:template match="cppHeader">
+        <xsl:variable name="class">
+               <xsl:value-of select="concat(@implClass, '_', @nameOfSorR, '_Proxy')"/>    
+        </xsl:variable>
+<xsl:text>/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+</xsl:text>
+        <xsl:call-template name="ifndef_start">
+            <xsl:with-param name="class" 
+                            select="$class"/>
+        </xsl:call-template>
+
+
+        <xsl:call-template name="include_headers">
+            <xsl:with-param name="componentTypeHeader" 
+                            select="@componentTypeHeader"/>
+        </xsl:call-template>
+
+        <xsl:apply-templates select="scaService" mode="class_body"/>
+
+        <xsl:call-template name="ifndef_end">
+            <xsl:with-param name="class" 
+                            select="$class"/>
+        </xsl:call-template>
+<!-- Always make sure we have a (visible) final newline -->
+<xsl:text>
+
+</xsl:text>
+</xsl:template>
+
+
+<!-- Here are the subroutine templates in order -->
+
+    <xsl:template name="ifndef_start">
+        <!--For example,  
+            #ifndef CustomerInfoImpl_CustomerInfoService_Proxy_h
+            #define CustomerInfoImpl_CustomerInfoService_Proxy_h
+        -->
+        <xsl:param name="class"/>
+        <xsl:text>#ifndef </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text>
+<!-- newline -->
+<xsl:text>
+</xsl:text>
+        <xsl:text>#define </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text>
+<!-- newline -->
+<xsl:text>
+
+</xsl:text>
+		<xsl:text>#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif </xsl:text>
+<!-- newline -->
+<xsl:text>
+
+</xsl:text>
+    </xsl:template>
+
+    <xsl:template name="include_headers">
+        <!--For example,  
+            #include "CustomerInfo.h"
+            #include "tuscany/sca/core/ServiceWrapper.h"
+        -->
+        <xsl:param name="componentTypeHeader"/>
+        <xsl:text>#include "</xsl:text><xsl:value-of select="translate($componentTypeHeader,'\','/')"/><xsl:text>"</xsl:text>
+<!-- newline -->
+<xsl:text>
+</xsl:text>
+        <xsl:text>#include "tuscany/sca/core/ServiceWrapper.h"</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="scaService" mode="class_body">
+        <!--For example
+            class proxyclassname : public interface_class
+            {
+             constructor
+             destructor
+                 then apply operation templates for operations
+            };
+
+            E.g. Specifically
+
+            class CustomerInfoImpl_CustomerInfoService_Proxy : public CustomerInfo
+            {
+            public:
+                CustomerInfoImpl_CustomerInfoService_Proxy(tuscany::sca::ServiceWrapper*);
+                virtual ~CustomerInfoImpl_CustomerInfoService_Proxy();
+                virtual const char* getCustomerInformation(const char* customerID);
+            private:
+                tuscany::sca::ServiceWrapper* target;
+            };                 
+        -->
+        <!-- TODO second definition, remove? -->
+        <xsl:variable name="class">
+               <xsl:value-of select="concat(../@implClass, '_', ../@nameOfSorR, '_Proxy')"/>    
+        </xsl:variable>
+<xsl:text>
+
+class </xsl:text>
+<xsl:value-of select="$class"/>
+<xsl:text> : public </xsl:text><xsl:value-of select="../@intfClass"/>
+<xsl:text>
+{
+public:
+    </xsl:text><xsl:value-of select="$class"/><xsl:text>(tuscany::sca::ServiceWrapper*);</xsl:text>
+    <xsl:text>
+    virtual ~</xsl:text><xsl:value-of select="$class"/><xsl:text>();
+</xsl:text>
+    <!-- operations -->
+    <xsl:apply-templates/>
+<xsl:text>private:
+    tuscany::sca::ServiceWrapper* target;
+};
+</xsl:text>
+    </xsl:template>
+
+    <xsl:template name="ifndef_end">
+        <!--For example,  
+            #endif // CustomerInfoImpl_CustomerInfoService_Proxy_h          
+        -->
+        <xsl:param name="class"/>
+        <xsl:text>
+#endif // </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text>
+    </xsl:template>
+
+
+
+
+
+
+<!-- Operation -->
+<!--For example 
+    virtual const char* getCustomerInformation(const char* customerID);
+-->
+<xsl:template match="scaOperation">
+<xsl:variable name="class">
+    <xsl:value-of select="concat(../../@implClass, '_', ../../@nameOfSorR, '_Proxy')"/>    
+</xsl:variable>
+<xsl:if test="@operationNameAttr != $class
+             and @operationNameAttr != concat('~', $class)" >
+<xsl:text>    virtual </xsl:text>
+<xsl:value-of select="scaOperationReturnType"/>
+<xsl:text> </xsl:text>
+<xsl:value-of select="@operationNameAttr"/><xsl:text>(</xsl:text>
+<xsl:for-each select="scaOperationParameter">
+     <xsl:variable name="isConst">
+        <xsl:value-of select="@scaOperationParameterConstAttr"/>
+     </xsl:variable>
+     <xsl:variable name="noOfParms">
+        <xsl:value-of select="last()"/>
+     </xsl:variable>
+     <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text>
+          <xsl:value-of select="."/> <!-- get the actual type -->
+     <xsl:text> </xsl:text>
+     <xsl:value-of select="@scaOperationParameterNameAttr"/>
+  <xsl:choose>
+     <xsl:when test="position()=last()"></xsl:when>
+     <xsl:otherwise>
+        <xsl:text>, </xsl:text>
+     </xsl:otherwise>
+  </xsl:choose>
+  </xsl:for-each> 
+<xsl:text>);
+</xsl:text>
+</xsl:if>
+</xsl:template>
+</xsl:stylesheet>
+
+
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl?view=auto&rev=556089
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl Fri Jul 13 11:26:14 2007
@@ -0,0 +1,290 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   
+     http://www.apache.org/licenses/LICENSE-2.0
+     
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages
+  - 
+  -  This stylesheet creates the CPP implementation of the 
+  -  wrapper body for a given SCA service
+  --> 
+<xsl:output method="text"/>
+ 
+<!-- Delete cppScopes -->
+<xsl:template match="cppScope"></xsl:template>
+
+<!-- Delete private methods cppScopes -->
+<xsl:template match="scaOperation[@cppScope='private']">
+</xsl:template>
+
+<!-- Don't act on return types -->
+<xsl:template match="scaOperationReturnType">
+</xsl:template>
+
+
+<!-- -->
+<!-- CPP Header/Root -->
+<!-- -->
+<xsl:template match="cppHeader">/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+<xsl:apply-templates select="scaService" mode="include_header"/>
+
+#include "osoa/sca/sca.h"
+
+<xsl:if test="not(@implNamespace = '')">using <xsl:value-of select="@implNamespace"/><xsl:value-of select="@implClass"/>;</xsl:if>
+<xsl:text><!-- newline -->
+
+</xsl:text>
+<!-- thats the prologue over and done with
+     now continue with the scaServiceElement -->
+<xsl:apply-templates/> <!-- will be applied to scaService -->
+<!-- Always make sure we have a final newline -->
+<xsl:text>
+
+</xsl:text>
+</xsl:template>
+  
+<!-- -->
+<!-- Service -->
+<!-- -->
+<xsl:template match="scaService">
+<xsl:variable name="class">
+   <xsl:value-of select="../@implClass"/>
+   <xsl:text>_</xsl:text>
+   <xsl:value-of select="../@serviceName"/>
+   <xsl:text>_Wrapper</xsl:text>
+</xsl:variable>
+<xsl:text>extern "C"
+{
+
+    #if defined(WIN32) || defined(_WINDOWS)
+    __declspec(dllexport) 
+    #endif
+    </xsl:text><xsl:value-of select="$class"/>
+<xsl:text>* </xsl:text>
+<xsl:value-of select="$class"/>
+<xsl:text>_Factory(tuscany::sca::model::Service* target)
+    {
+        return new </xsl:text><xsl:value-of select="$class"/><xsl:text>(target);
+    }
+}
+
+</xsl:text>
+<xsl:value-of select="$class"/><xsl:text>::</xsl:text><xsl:value-of select="$class"/><xsl:text>(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target)
+{
+    impl = (</xsl:text><xsl:value-of select="../@implClass"/><xsl:text>*)getImplementation();
+}
+
+</xsl:text>
+<xsl:value-of select="$class"/><xsl:text>::~</xsl:text><xsl:value-of select="$class"/><xsl:text>()
+{
+    releaseImplementation();
+}
+
+void* </xsl:text>
+<xsl:value-of select="$class"/><xsl:text>::newImplementation()
+{
+    return new </xsl:text><xsl:value-of select="../@implClass"/><xsl:text>;
+}
+
+void </xsl:text>
+<xsl:value-of select="$class"/><xsl:text>::deleteImplementation()
+{
+    delete impl;
+}
+
+void </xsl:text><xsl:value-of select="$class"/><xsl:text>::invokeService(tuscany::sca::Operation&amp; operation)
+{
+    const std::string&amp; operationName = operation.getName();
+
+</xsl:text>
+<xsl:apply-templates/><!-- an if statment for each operation -->
+<xsl:text>        
+
+    throw osoa::sca::ServiceRuntimeException("Invalid operation");
+    
+}</xsl:text>
+</xsl:template>  
+
+<xsl:template match="scaService" mode="include_header">
+<xsl:variable name="class">
+   <xsl:value-of select="../@implClass"/>
+   <xsl:text>_</xsl:text>
+   <xsl:value-of select="../@serviceName"/>
+   <xsl:text>_Wrapper</xsl:text>
+</xsl:variable>
+<xsl:text>#include "</xsl:text>
+<xsl:value-of select="$class"/>
+<xsl:text>.h"</xsl:text>
+</xsl:template>
+
+<!-- -->
+<!-- Operation -->
+<!-- -->
+<xsl:template match="scaOperation">
+<!--For example
+    if (operationName == "getCustomerInformation")
+    {
+        operation.setReturnValue(impl->getCustomerInformation((const char*)parms[0]));
+        return;
+    }
+-->
+<xsl:if test="@operationNameAttr != ../../@intfClass
+             and @operationNameAttr != concat('~', ../../@intfClass)" >
+<xsl:text>    if (operationName == "</xsl:text>
+<xsl:value-of select="@operationNameAttr"/>
+<xsl:text>")
+    {
+</xsl:text>
+            <xsl:call-template name="this_operation_body"/>
+<xsl:text>
+    }
+</xsl:text>
+
+</xsl:if>
+</xsl:template>
+
+<xsl:template name="this_operation_body">
+<xsl:if test="./scaOperationParameter/text() != 'void' ">
+  <xsl:if test="normalize-space(./scaOperationParameter/text()) != ' ' ">
+    <xsl:if test="./scaOperationParameter/text() != '' ">
+    <xsl:for-each select="scaOperationParameter">
+            <xsl:call-template name="prepare_parameter_n"/>
+    </xsl:for-each> 
+  </xsl:if>
+  </xsl:if>
+</xsl:if>
+<xsl:call-template name="invoke_for_return_type"/>
+<xsl:text>
+        return;</xsl:text>
+</xsl:template>
+
+<xsl:template name="prepare_parameter_n">
+     <xsl:variable name="isConst">
+        <xsl:value-of select="@scaOperationParameterConstAttr"/>
+     </xsl:variable>
+    <xsl:variable name="type">
+        <xsl:value-of select="."/>
+    </xsl:variable>
+<xsl:text>        </xsl:text>
+    <xsl:choose>
+        <xsl:when test="contains($type, '&amp;')"><!-- reference -->
+            <xsl:variable name="type_no_amp">
+                <xsl:value-of select="substring-before($type, '&amp;')"/>
+            </xsl:variable>
+            <xsl:value-of select="$type"/><xsl:text> p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(</xsl:text><xsl:value-of select="$type_no_amp"/>
+             <xsl:text>*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>);
+</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($type, '*')"><!-- pointer -->
+            <xsl:if test="contains($isConst,'true')">const </xsl:if>
+            <xsl:value-of select="."/><xsl:text> p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(</xsl:text>
+             <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text>
+              <xsl:value-of select="$type"/>
+             <xsl:text>*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>);
+</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($type, 'DataObjectPtr')"><!-- DataObjectPtr -->
+            <xsl:text>commonj::sdo::DataObjectPtr&amp; p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(commonj::sdo::DataObjectPtr*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>);</xsl:text>
+        </xsl:when>
+        <xsl:otherwise><!-- simple type -->
+    <xsl:if test="contains($isConst,'true')">const </xsl:if><xsl:value-of select="$type"/><xsl:text>&amp; p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(</xsl:text>
+    <xsl:if test="contains($isConst,'true')">const</xsl:if><xsl:text> </xsl:text>
+          <xsl:value-of select="$type"/>
+     <xsl:text>*)operation.getParameterValue(</xsl:text><xsl:value-of select="position()-1"/><xsl:text>);
+</xsl:text>
+
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="invoke_for_return_type">
+    <xsl:variable name="type">
+        <xsl:value-of select="./scaOperationReturnType/text()"/>
+    </xsl:variable>
+    <xsl:choose>
+        <!-- VOID -->
+        <xsl:when test="$type='void'">
+<xsl:text>            </xsl:text>
+            <xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>;</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($type, '&amp;')"><!-- reference -->
+        <xsl:text>        </xsl:text><xsl:value-of select="$type"/><xsl:text> ret = </xsl:text><xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>;</xsl:text>
+        <xsl:text>
+        operation.setReturnValue(&amp;ret);</xsl:text>
+        </xsl:when>
+        <xsl:otherwise><!-- simple type -->            
+            <xsl:text>
+        if(operation.getReturnValue() != NULL)
+        {
+            *(</xsl:text><xsl:value-of select="$type"/><xsl:text>*)operation.getReturnValue() = </xsl:text><xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>;
+        }
+        else
+        {
+            </xsl:text><xsl:value-of select="$type"/><xsl:text>* ret = new </xsl:text><xsl:value-of select="$type"/><xsl:text>;
+            *ret = </xsl:text><xsl:call-template name="impl_arrow_op_brackets_and_parms"/><xsl:text>;
+            operation.setReturnValue((const </xsl:text><xsl:value-of select="$type"/><xsl:text>*)ret);
+        }</xsl:text>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="impl_arrow_op_brackets_and_parms"><!-- context is "scaOperation" -->
+        <xsl:text>impl-></xsl:text><xsl:value-of select="./@operationNameAttr"/><xsl:text>(</xsl:text>
+<xsl:if test="./scaOperationParameter/text() != 'void' ">
+  <xsl:if test="./scaOperationParameter/text() != '' ">
+    <xsl:if test="normalize-space(./scaOperationParameter/text()) != ' ' ">
+    <xsl:for-each select="scaOperationParameter">
+            <xsl:call-template name="parameter_for_parameter_list"/>
+    </xsl:for-each>
+</xsl:if>
+</xsl:if>
+</xsl:if>
+<xsl:text>)</xsl:text>
+</xsl:template>
+
+<xsl:template name="parameter_for_parameter_list">
+<xsl:text>p</xsl:text><xsl:value-of select="position()-1"/>
+  <xsl:choose>
+     <xsl:when test="position()=last()"></xsl:when>
+     <xsl:otherwise>
+        <xsl:text>, </xsl:text>
+     </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+
+</xsl:stylesheet>

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl?view=auto&rev=556089
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl Fri Jul 13 11:26:14 2007
@@ -0,0 +1,191 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   
+     http://www.apache.org/licenses/LICENSE-2.0
+     
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<!-- Part of the org.apache.tuscany.sca.cpp.tools.services packages
+  - 
+  -  This stylesheet creates the CPP implementation of the 
+  -  wrapper header for a given SCA service
+  -->
+    <xsl:output method="text" />
+
+    <!-- Delete cppScopes -->
+    <xsl:template match="cppScope"></xsl:template>
+
+    <!-- Delete private methods cppScopes -->
+    <xsl:template match="scaOperation[@cppScope='private']">
+    </xsl:template>
+
+    <!-- Delete private methods cppScopes -->
+    <xsl:template match="scaOperationReturnType"></xsl:template>
+
+
+    <!-- -->
+    <!-- CPP Header/Root -->
+    <!-- -->
+    <xsl:template match="cppHeader">
+        <xsl:variable name="class">
+               <xsl:value-of select="concat(@implClass, '_', @serviceName, '_Wrapper')"/>    
+        </xsl:variable>
+<xsl:text>/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+</xsl:text>
+        <xsl:call-template name="ifndef_start">
+            <xsl:with-param name="class" 
+                            select="$class"/>
+        </xsl:call-template>
+
+
+        <xsl:call-template name="include_headers">
+            <xsl:with-param name="header" 
+                            select="@compositeXmlFileHeader"/>
+        </xsl:call-template>
+
+        <xsl:apply-templates select="scaService" mode="class_body"/>
+
+        <xsl:call-template name="ifndef_end">
+            <xsl:with-param name="class" 
+                            select="$class"/>
+        </xsl:call-template>
+<!-- Always make sure we have a (visible) final return -->
+<xsl:text>
+
+</xsl:text>
+</xsl:template>
+
+
+<!-- Here are the subroutine templates in order -->
+
+    <xsl:template name="ifndef_start">
+        <!--For example,  
+            #ifndef CustomerInfoImpl_CustomerInfoService_Wrapper_h
+            #define CustomerInfoImpl_CustomerInfoService_Wrapper_h
+        -->
+        <xsl:param name="class"/>
+        <xsl:text>#ifndef </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text>
+<!-- newline -->
+<xsl:text>
+</xsl:text>
+        <xsl:text>#define </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text>
+<!-- newline -->
+<xsl:text>
+
+</xsl:text>
+		<xsl:text>#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif </xsl:text>
+<!-- newline -->
+<xsl:text>
+
+</xsl:text>
+    </xsl:template>
+
+    <xsl:template name="include_headers">
+        <!--For example,  
+            #include "CustomerInfoImpl.h"
+            #include "tuscany/sca/cpp/CPPServiceWrapper.h"
+        -->
+        <xsl:param name="header"/>
+        <xsl:text>#include "</xsl:text><xsl:value-of select="translate($header,'\','/')"/><xsl:text>"</xsl:text>
+<!-- newline -->
+<xsl:text>
+</xsl:text>
+        <xsl:text>#include "tuscany/sca/cpp/CPPServiceWrapper.h"</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="scaService" mode="class_body">
+        <!--For example
+            class wrapperclassname : public tuscany::sca::cpp::CPPServiceWrapper
+            {
+             constructor
+             destructor
+                 then apply operation templates for operations
+            };
+
+            E.g. Specifically
+
+        class CustomerInfoImpl_CustomerInfoService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper
+        {
+        public:
+            CustomerInfoImpl_CustomerInfoService_Wrapper(tuscany::sca::model::Component*);
+            virtual ~CustomerInfoImpl_CustomerInfoService_Wrapper();
+            virtual void invoke(tuscany::sca::Operation& operation);
+    
+        private:
+            CustomerInfoImpl* impl;
+        };
+        -->
+        <!-- TODO second definition, remove? -->
+        <xsl:variable name="class">
+               <xsl:value-of select="concat(../@implClass, '_', ../@serviceName, '_Wrapper')"/>    
+        </xsl:variable>
+<xsl:text>
+
+class </xsl:text>
+<xsl:value-of select="$class"/>
+<xsl:text> : public tuscany::sca::cpp::CPPServiceWrapper
+{
+public:
+    </xsl:text><xsl:value-of select="$class"/><xsl:text>(tuscany::sca::model::Service* target);</xsl:text>
+    <xsl:text>
+    virtual ~</xsl:text><xsl:value-of select="$class"/><xsl:text>();
+    virtual void invokeService(tuscany::sca::Operation&amp; operation);
+    virtual void* newImplementation();
+    virtual void deleteImplementation();
+</xsl:text>
+<xsl:text>private:
+    </xsl:text>
+    <xsl:value-of select="../@implNamespace"/><xsl:value-of select="../@implClass"/><xsl:text>* impl;
+};
+</xsl:text>
+    </xsl:template>
+
+    <xsl:template name="ifndef_end">
+        <!--For example,  
+            #endif // CustomerInfoImpl_CustomerInfoService_Wrapper_h          
+        -->
+        <xsl:param name="class"/>
+        <xsl:text>
+#endif // </xsl:text><xsl:value-of select="$class"/><xsl:text>_h</xsl:text>
+    </xsl:template>
+
+<xsl:template match="scaOperation">
+</xsl:template>
+
+</xsl:stylesheet>
+
+
+

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/extensions/cpp/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/cpp/sca/samples/CppBigBank/bigbank.account/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/CppBigBank/bigbank.account/Makefile.am?view=diff&rev=556089&r1=556088&r2=556089
==============================================================================
--- incubator/tuscany/cpp/sca/samples/CppBigBank/bigbank.account/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/samples/CppBigBank/bigbank.account/Makefile.am Fri Jul 13 11:26:14 2007
@@ -25,7 +25,7 @@
 composite_SCRIPTS = runwsserver.sh
 
 scagen:
-	java -jar $(TUSCANY_SCACPP)/bin/scagen.jar -dir . -output .
+	java -jar $(TUSCANY_SCACPP)/extensions/cpp/bin/scagen.jar -dir . -output .
 
 composite_LTLIBRARIES = libAccount.la
 composite_DATA = *.composite *.componentType *.wsdl *.xsd

Modified: incubator/tuscany/cpp/sca/samples/CppCalculator/sample.calculator/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/CppCalculator/sample.calculator/Makefile.am?view=diff&rev=556089&r1=556088&r2=556089
==============================================================================
--- incubator/tuscany/cpp/sca/samples/CppCalculator/sample.calculator/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/samples/CppCalculator/sample.calculator/Makefile.am Fri Jul 13 11:26:14 2007
@@ -23,7 +23,7 @@
 noinst_HEADERS = *.h
 
 scagen:
-	java -jar $(TUSCANY_SCACPP)/bin/scagen.jar -dir . -output .
+	java -jar $(TUSCANY_SCACPP)/extensions/cpp/bin/scagen.jar -dir . -output .
 
 composite_LTLIBRARIES = libCalculator.la
 composite_DATA = *.composite *.componentType

Modified: incubator/tuscany/cpp/sca/samples/scagen.bat
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/scagen.bat?view=diff&rev=556089&r1=556088&r2=556089
==============================================================================
--- incubator/tuscany/cpp/sca/samples/scagen.bat (original)
+++ incubator/tuscany/cpp/sca/samples/scagen.bat Fri Jul 13 11:26:14 2007
@@ -27,7 +27,7 @@
 )
 set srcdir=%1
 
-%TUSCANY_SCACPP%\bin\scagen.bat -dir %srcdir% -output %srcdir% -verbose
+%TUSCANY_SCACPP%\extensions\cpp\bin\scagen.bat -dir %srcdir% -output %srcdir% -verbose
 
 goto end
 :usage

Modified: incubator/tuscany/cpp/sca/tools/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/tools/Makefile.am?view=diff&rev=556089&r1=556088&r2=556089
==============================================================================
--- incubator/tuscany/cpp/sca/tools/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/tools/Makefile.am Fri Jul 13 11:26:14 2007
@@ -15,11 +15,4 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-if WANT_ALL
-  CPP_TOOLS = scagen
-endif
-if WANT_CPP
-  CPP_TOOLS = scagen
-endif
-
-SUBDIRS = ${CPP_TOOLS}
\ No newline at end of file
+SUBDIRS =
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org