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 na...@apache.org on 2008/09/22 23:12:53 UTC

svn commit: r697995 - /webservices/axis/trunk/c/src/common/AxisUtils.cpp

Author: nadiramra
Date: Mon Sep 22 14:12:52 2008
New Revision: 697995

URL: http://svn.apache.org/viewvc?rev=697995&view=rev
Log:
Performance improvement - put commonly used types at top of switch statement.

Modified:
    webservices/axis/trunk/c/src/common/AxisUtils.cpp

Modified: webservices/axis/trunk/c/src/common/AxisUtils.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/common/AxisUtils.cpp?rev=697995&r1=697994&r2=697995&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/AxisUtils.cpp (original)
+++ webservices/axis/trunk/c/src/common/AxisUtils.cpp Mon Sep 22 14:12:52 2008
@@ -171,8 +171,58 @@
 IAnySimpleType* AxisUtils::createSimpleTypeObject(void * pValue, XSDTYPE type)
 {
     IAnySimpleType* xsdValue = NULL;
+    
+    // Put commonly used type at top of switch statement!
     switch (type)
     {
+	    case XSD_STRING:
+	        xsdValue = new String((xsd__string) pValue);
+	        break;
+	    case XSD_NORMALIZEDSTRING:
+	        xsdValue = new NormalizedString((xsd__normalizedString) pValue);
+	        break;
+	    case XSD_DECIMAL:
+	        xsdValue = new Decimal((xsd__decimal*) pValue);
+	        break;
+	    case XSD_INTEGER:
+	        xsdValue = new Integer((xsd__integer*) pValue);
+	        break;
+	    case XSD_LONG:
+	        xsdValue = new Long((xsd__long*) pValue);
+	        break;
+	    case XSD_INT:
+	        xsdValue = new Int((xsd__int*) pValue);
+	        break;
+	    case XSD_SHORT:
+	        xsdValue = new Short((xsd__short*) pValue);
+	        break;
+	    case XSD_BYTE:
+	        xsdValue = new Byte((xsd__byte*) pValue);
+	        break;
+	    case XSD_NONNEGATIVEINTEGER:
+	        xsdValue = new NonNegativeInteger((xsd__nonNegativeInteger*) pValue);
+	        break;
+	    case XSD_UNSIGNEDLONG:
+	        xsdValue = new UnsignedLong((xsd__unsignedLong*) pValue);
+	        break;
+	    case XSD_UNSIGNEDINT:
+	        xsdValue = new UnsignedInt((xsd__unsignedInt*) pValue);
+	        break;
+	    case XSD_UNSIGNEDSHORT:
+	        xsdValue = new UnsignedShort((xsd__unsignedShort*) pValue);
+	        break;
+	    case XSD_UNSIGNEDBYTE:
+	        xsdValue = new UnsignedByte((xsd__unsignedByte*) pValue);
+	        break;
+	    case XSD_POSITIVEINTEGER:
+	        xsdValue = new PositiveInteger((xsd__positiveInteger*) pValue);
+	        break;
+	    case XSD_NONPOSITIVEINTEGER:
+	        xsdValue = new NonPositiveInteger((xsd__nonPositiveInteger*) pValue);
+	        break;
+	    case XSD_NEGATIVEINTEGER:
+	        xsdValue = new NegativeInteger((xsd__negativeInteger*) pValue);
+	        break;
         case XSD_FLOAT:
             xsdValue = new Float((xsd__float*) pValue);
             break;
@@ -224,54 +274,6 @@
         case XSD_NOTATION:
             xsdValue = new NOTATION((xsd__NOTATION) pValue);
             break;
-        case XSD_DECIMAL:
-            xsdValue = new Decimal((xsd__decimal*) pValue);
-            break;
-        case XSD_INTEGER:
-            xsdValue = new Integer((xsd__integer*) pValue);
-            break;
-        case XSD_LONG:
-            xsdValue = new Long((xsd__long*) pValue);
-            break;
-        case XSD_INT:
-            xsdValue = new Int((xsd__int*) pValue);
-            break;
-        case XSD_SHORT:
-            xsdValue = new Short((xsd__short*) pValue);
-            break;
-        case XSD_BYTE:
-            xsdValue = new Byte((xsd__byte*) pValue);
-            break;
-        case XSD_NONNEGATIVEINTEGER:
-            xsdValue = new NonNegativeInteger((xsd__nonNegativeInteger*) pValue);
-            break;
-        case XSD_UNSIGNEDLONG:
-            xsdValue = new UnsignedLong((xsd__unsignedLong*) pValue);
-            break;
-        case XSD_UNSIGNEDINT:
-            xsdValue = new UnsignedInt((xsd__unsignedInt*) pValue);
-            break;
-        case XSD_UNSIGNEDSHORT:
-            xsdValue = new UnsignedShort((xsd__unsignedShort*) pValue);
-            break;
-        case XSD_UNSIGNEDBYTE:
-            xsdValue = new UnsignedByte((xsd__unsignedByte*) pValue);
-            break;
-        case XSD_POSITIVEINTEGER:
-            xsdValue = new PositiveInteger((xsd__positiveInteger*) pValue);
-            break;
-        case XSD_NONPOSITIVEINTEGER:
-            xsdValue = new NonPositiveInteger((xsd__nonPositiveInteger*) pValue);
-            break;
-        case XSD_NEGATIVEINTEGER:
-            xsdValue = new NegativeInteger((xsd__negativeInteger*) pValue);
-            break;
-        case XSD_STRING:
-            xsdValue = new String((xsd__string) pValue);
-            break;
-        case XSD_NORMALIZEDSTRING:
-            xsdValue = new NormalizedString((xsd__normalizedString) pValue);
-            break;
         case XSD_TOKEN:
             xsdValue = new Token((xsd__token) pValue);
             break;