summaryrefslogtreecommitdiffstats
path: root/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl
diff options
context:
space:
mode:
Diffstat (limited to 'tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl')
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl281
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl228
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl292
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl191
4 files changed, 0 insertions, 992 deletions
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl b/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl
deleted file mode 100644
index b45fbb7b40..0000000000
--- a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyCPP.xsl
+++ /dev/null
@@ -1,281 +0,0 @@
-<!--
- 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.
--->
-<!--
-
- TODO There is duplication in the "..no_parms" templates with
- the equivalent templates they are based on - that it would be
- fairly easy to factor out.
--->
-<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 body for a given SCA service
- -->
-<xsl:output method="text"/>
-
-<!-- We do not generate output sourced from cppScopes -->
-<xsl:template match="cppScope"></xsl:template>
-
-<!-- We do not generate output sourced from private scaOperations -->
-<xsl:template match="scaOperation[@cppScope='private']">
-</xsl:template>
-
-<!-- We do not generate output sourced from the operation 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"
-using namespace osoa::sca;
-using namespace tuscany::sca;<!-- thats the prologue over nad done with
- now continue with the scaServiceElement -->
-<xsl:apply-templates/> <!-- should go on to generic scaService below -->
-</xsl:template>
-
-<!-- -->
-<!-- Service -->
-<!-- -->
-<xsl:template match="scaService">
-<xsl:variable name="clazz">
- <xsl:value-of select="../@implClass"/>
- <xsl:text>_</xsl:text>
- <xsl:value-of select="../@nameOfSorR"/>
- <xsl:text>_Proxy</xsl:text>
-</xsl:variable>
-<xsl:text>
-extern "C"
-{
-
- #if defined(WIN32) || defined(_WINDOWS)
- __declspec(dllexport)
- #endif
- </xsl:text><xsl:value-of select="$clazz"/>
-<xsl:text>* </xsl:text>
-<xsl:value-of select="$clazz"/>
-<xsl:text>_Factory(ServiceWrapper* target)
- {
- return new </xsl:text><xsl:value-of select="$clazz"/><xsl:text>(target);
- }
-
- #if defined(WIN32) || defined(_WINDOWS)
- __declspec(dllexport)
- #endif
- void </xsl:text>
-<xsl:value-of select="$clazz"/>
-<xsl:text>_Destructor(void* proxy)
- {
- delete (</xsl:text><xsl:value-of select="$clazz"/><xsl:text>*)proxy;
- }
-}
-
-</xsl:text>
-<xsl:value-of select="$clazz"/><xsl:text>::</xsl:text><xsl:value-of select="$clazz"/>(ServiceWrapper* targ) : target(targ)
-{
-}
-
-<xsl:value-of select="$clazz"/><xsl:text>::~</xsl:text><xsl:value-of select="$clazz"/>()
-{
- if (target)
- delete target;
-}<!--
-OK we have done the stuff that is not specific to any function in the service
-now we can do another apply-templates to pick up on the 0, 1 or more scaOperation
-DOM nodes that each relate to a function in the service
- -->
-<xsl:apply-templates/>
-<!-- Always make sure we have a (visible) final newline -->
-<xsl:text>
-
-</xsl:text>
-</xsl:template>
-
-<!-- This template is just a small function that will generate the
- #include that pulls in the correct C++ header
- -->
-<xsl:template match="scaService" mode="include_header">
-<xsl:variable name="clazz">
- <xsl:value-of select="../@implClass"/>
- <xsl:text>_</xsl:text>
- <xsl:value-of select="../@nameOfSorR"/>
- <xsl:text>_Proxy</xsl:text>
-</xsl:variable>
-<xsl:text>#include "</xsl:text>
-<xsl:value-of select="$clazz"/>
-<xsl:text>.h"</xsl:text>
-</xsl:template>
-
-
-
-<!-- -->
-<!-- Operation -->
-<!-- -->
-<xsl:template match="scaOperation">
-<xsl:variable name="clazz">
- <xsl:value-of select="../../@implClass"/>
- <xsl:text>_</xsl:text>
- <xsl:value-of select="../../@nameOfSorR"/>
- <xsl:text>_Proxy</xsl:text>
-</xsl:variable>
-
-<!-- ignore the constructor and destructor -->
-<xsl:if test="@operationNameAttr != $clazz
- and @operationNameAttr != concat('~', $clazz)" >
-<xsl:text>
-</xsl:text>
-<xsl:value-of select="scaOperationReturnType"/>
-<xsl:text> </xsl:text>
-<xsl:value-of select="$clazz"/><xsl:text>::</xsl:text>
-<xsl:value-of select="@operationNameAttr"/><xsl:text>(</xsl:text>
-<xsl:for-each select="scaOperationParameter">
-<xsl:if test=".!='void'">
- <xsl:variable name="scaOperationParameterNameAttr">
- <xsl:value-of select="concat('arg', position()-1 )"/>
- </xsl:variable>
- <xsl:variable name="isConst">
- <xsl:value-of select="@scaOperationParameterConstAttr"/>
- </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:if> <!-- test=".!='void'" -->
-
-</xsl:for-each>
-<xsl:text>)
-{</xsl:text>
-<xsl:call-template name="proxy_method_body"/>
-<xsl:text>
-}
-</xsl:text>
-</xsl:if>
-</xsl:template>
-
-
-<xsl:template name="proxy_method_body">
- <xsl:variable name="noOfParms">
- <xsl:choose>
- <xsl:when test=".='void'">
-<xsl:text>0</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="last()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-<xsl:text>
- Operation operation("</xsl:text>
- <xsl:value-of select="@operationNameAttr"/>
- <xsl:text>");</xsl:text>
- <xsl:if test="$noOfParms!=0">
- <xsl:for-each select="scaOperationParameter">
- <xsl:call-template name="proxy_method_body_set_parameter"/>
- </xsl:for-each>
- </xsl:if>
- <xsl:call-template name="proxy_method_body_prepare_return_var"/>
- <xsl:text>
- target-&gt;invoke(operation);</xsl:text>
- <xsl:call-template name="proxy_method_body_return"/>
-</xsl:template>
-
-
-<xsl:template name="proxy_method_body_return">
- <xsl:variable name="type">
- <xsl:value-of select="scaOperationReturnType/text()"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$type='void'"><!-- nothing -->
- <xsl:text>
- return;</xsl:text>
- </xsl:when>
- <xsl:when test="contains($type, '&amp;')"><!-- reference -->
- <xsl:variable name="type_no_amp">
- <xsl:value-of select="substring-before($type, '&amp;')"/>
- </xsl:variable>
- <xsl:text>
- return *(</xsl:text><xsl:value-of select="$type_no_amp"/><xsl:text>*)operation.getReturnValue();</xsl:text>
- </xsl:when>
- <xsl:otherwise><!-- simple type -->
- <xsl:text>
- return *(</xsl:text><xsl:value-of select="$type"/><xsl:text>*)operation.getReturnValue();</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="proxy_method_body_prepare_return_var">
- <xsl:variable name="type">
- <xsl:value-of select="scaOperationReturnType/text()"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$type='void'"><!-- nothing -->
- <!-- nothing -->
- </xsl:when>
- <xsl:when test="contains($type, '&amp;')"><!-- reference -->
- </xsl:when>
- <xsl:otherwise>
-<xsl:text>
- </xsl:text> <xsl:value-of select="$type"/><xsl:text> ret;
- operation.setReturnValue(&amp;ret);</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
-
-</xsl:template>
-
-
-<xsl:template name="proxy_method_body_set_parameter">
- <xsl:variable name="scaOperationParameterNameAttrInner">
- <xsl:value-of select="concat('arg', position()-1 )"/>
- </xsl:variable>
- <xsl:variable name="type">
- <xsl:value-of select="."/>
- </xsl:variable>
- operation.addParameter(&amp;<xsl:value-of select="$scaOperationParameterNameAttrInner"/><xsl:text>);</xsl:text>
-</xsl:template>
-</xsl:stylesheet>
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl b/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl
deleted file mode 100644
index 2f5edb3a93..0000000000
--- a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfProxyHeader.xsl
+++ /dev/null
@@ -1,228 +0,0 @@
-<!--
- 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>
-
-
-
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl b/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl
deleted file mode 100644
index 915549788d..0000000000
--- a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperCPP.xsl
+++ /dev/null
@@ -1,292 +0,0 @@
-<!--
- 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"
-using namespace osoa::sca;
-using namespace tuscany::sca;
-
-<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>(Service* target) : 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(Operation&amp; operation)
-{
- const string&amp; operationName = operation.getName();
-
-</xsl:text>
-<xsl:apply-templates/><!-- an if statment for each operation -->
-<xsl:text>
-
- throw 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>DataObjectPtr&amp; p</xsl:text><xsl:value-of select="position()-1"/><xsl:text> = *(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>
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl b/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl
deleted file mode 100644
index c8157fe2f6..0000000000
--- a/tags/cpp-1.0-incubating-M2-RC2/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/services/xsl/SCA4CPPIntfWrapperHeader.xsl
+++ /dev/null
@@ -1,191 +0,0 @@
-<!--
- 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>
-
-
-