You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/08/27 14:18:39 UTC
cvs commit: xml-axis/c/src/soap SoapKeywordMapping.cpp SoapKeywordMapping.h
susantha 2003/08/27 05:18:39
Added: c/src/common AxisUtils.cpp AxisUtils.h
c/src/soap SoapKeywordMapping.cpp SoapKeywordMapping.h
Log:
new files added for following tasks
Avoided using XMLString::transcode function in the xerces parser
Reduced the use of std::string
Introduced wide char for char where applicable
Introduced std::wstring for std::string where applicable
By doing above things achived some 40-50% performance improvement (according to profile given by Rational Quantify)
Revision Changes Path
1.1 xml-axis/c/src/common/AxisUtils.cpp
Index: AxisUtils.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// AxisUtils.cpp: implementation of the AxisUtils class.
//
//////////////////////////////////////////////////////////////////////
#include "AxisUtils.h"
#include <xercesc/util/XMLString.hpp>
XERCES_CPP_NAMESPACE_USE
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
AxisUtils::AxisUtils()
{
}
AxisUtils::~AxisUtils()
{
}
bool AxisUtils::convert(AxisString &wstr, const char *str)
{
AxisChar* pWchar = XMLString::transcode(str);
if (!pWchar) return false;
wstr = pWchar;
XMLString::release(&pWchar);
return true;
}
bool AxisUtils::convert(string &str, const AxisChar *wstr)
{
char* pChar = XMLString::transcode(wstr);
if (!pChar) return false;
str = pChar;
XMLString::release(&pChar);
return true;
}
1.1 xml-axis/c/src/common/AxisUtils.h
Index: AxisUtils.h
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// AxisUtils.h: interface for the AxisUtils class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_AXISUTILS_H__B5175A8C_0210_417D_BA43_6AAAF7E03551__INCLUDED_)
#define AFX_AXISUTILS_H__B5175A8C_0210_417D_BA43_6AAAF7E03551__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GDefine.h"
#include <string>
using namespace std;
class AxisUtils
{
public:
static bool convert(string& str, const AxisChar* wstr);
static bool convert(AxisString& wstr, const char* str);
AxisUtils();
virtual ~AxisUtils();
};
#endif // !defined(AFX_AXISUTILS_H__B5175A8C_0210_417D_BA43_6AAAF7E03551__INCLUDED_)
1.1 xml-axis/c/src/soap/SoapKeywordMapping.cpp
Index: SoapKeywordMapping.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// SoapKeywordMapping.cpp: implementation of the SoapKeywordMapping class.
//
//////////////////////////////////////////////////////////////////////
#include "SoapKeywordMapping.h"
#include "Attribute.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
map<SOAP_VERSION, SoapEnvVersionsStruct> SoapKeywordMapping::m_Map;
volatile bool SoapKeywordMapping::m_bInit = false;
SoapKeywordMapping::SoapKeywordMapping()
{
}
SoapKeywordMapping::~SoapKeywordMapping()
{
}
void SoapKeywordMapping::Initialize()
{
if (!m_bInit)
{
m_Map[SOAP_VER_1_1] = ObjSoapEnvVersionsStruct[SOAP_VER_1_1];
m_Map[SOAP_VER_1_1].pEnv = new Attribute(L"SOAP-ENV",L"xmlns",L"",L"http://schemas.xmlsoap.org/soap/envelope/");
m_Map[SOAP_VER_1_1].pXsi = new Attribute(L"xsi",L"xmlns",L"",L"http://www.w3.org/2001/XMLSchema-instance");
m_Map[SOAP_VER_1_1].pXsd = new Attribute(L"xsd",L"xmlns",L"",L"http://www.w3.org/2001/XMLSchema");
m_Map[SOAP_VER_1_2] = ObjSoapEnvVersionsStruct[SOAP_VER_1_2];
m_Map[SOAP_VER_1_2].pEnv = new Attribute(L"env",L"xmlns",L"",L"http://www.w3.org/2003/05/soap-envelope");
m_Map[SOAP_VER_1_2].pXsi = new Attribute(L"xsi",L"xmlns",L"",L"http://www.w3.org/2001/XMLSchema-instance");
m_Map[SOAP_VER_1_2].pXsd = new Attribute(L"xsd",L"xmlns",L"",L"http://www.w3.org/2001/XMLSchema");
m_bInit = true;
}
}
const SoapEnvVersionsStruct& SoapKeywordMapping::Map(SOAP_VERSION nVersion)
{
return m_Map[nVersion];
}
1.1 xml-axis/c/src/soap/SoapKeywordMapping.h
Index: SoapKeywordMapping.h
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*
*
*
* @author Susantha Kumara (skumara@virtusa.com)
*
*/
// SoapKeywordMapping.h: interface for the SoapKeywordMapping class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SOAPKEYWORDMAPPING_H__7ED17E2B_F729_4256_985A_0D8F70D55D2A__INCLUDED_)
#define AFX_SOAPKEYWORDMAPPING_H__7ED17E2B_F729_4256_985A_0D8F70D55D2A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SoapEnvVersions.h"
#include <map>
using namespace std;
class SoapKeywordMapping
{
public:
SoapKeywordMapping();
virtual ~SoapKeywordMapping();
private:
static map<SOAP_VERSION, SoapEnvVersionsStruct> m_Map;
static volatile bool m_bInit;
public:
static void Initialize();
static const SoapEnvVersionsStruct& Map(SOAP_VERSION nVersion);
};
#endif // !defined(AFX_SOAPKEYWORDMAPPING_H__7ED17E2B_F729_4256_985A_0D8F70D55D2A__INCLUDED_)