activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r474611 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts: AmqCppClassesGenerator.java AmqCppHeadersGenerator.java AmqCppMarshallingClassesGenerator.java
Date Tue, 14 Nov 2006 00:49:05 GMT
Author: tabish
Date: Mon Nov 13 16:49:04 2006
New Revision: 474611

URL: http://svn.apache.org/viewvc?view=rev&rev=474611
Log:
Updates for planned Openwire Support

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java?view=diff&rev=474611&r1=474610&r2=474611
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
Mon Nov 13 16:49:04 2006
@@ -319,24 +319,30 @@
         String propertyName = property.getSimpleName();
         String parameterName = decapitalize(propertyName);
         String constNess = "";
-    
+        String getter = property.getGetter().getSimpleName();
+        String setter = property.getSetter().getSimpleName();
+        
         if( property.getType().isPrimitiveType() ||
             type.equals("std::string") ||
             property.getType().getSimpleName().equals("ByteSequence") ){
-    out.println("    this->set"+propertyName+"( srcPtr->get"+propertyName+"() );");
+    out.println("    this->"+setter+"( srcPtr->"+getter+"() );");
         } else if( property.getType().isArrayType() &&
                    !property.getType().getArrayComponentType().isPrimitiveType() ) {
-    out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " <
srcPtr->get"+propertyName+"().size(); ++i" + parameterName + " ) {");
-    out.println("        this->get"+propertyName+"().push_back( ");
-    out.println("            srcPtr->get"+propertyName+"()[i"+parameterName+"]->cloneDataStructure()
);");            
+
+            String arrayType = property.getType().getArrayComponentType().getSimpleName();
+            
+    out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " <
srcPtr->"+getter+"().size(); ++i" + parameterName + " ) {");
+    out.println("        this->"+getter+"().push_back( ");
+    out.println("            dynamic_cast<"+arrayType+"*>( ");
+    out.println("                srcPtr->"+getter+"()[i"+parameterName+"]->cloneDataStructure()
) );");            
     out.println("    }");
         } else if( property.getType().isArrayType() &&
                    property.getType().getArrayComponentType().isPrimitiveType() ) {
-    out.println("    this->set"+propertyName+"( srcPtr->get"+propertyName+"() );");
+    out.println("    this->"+setter+"( srcPtr->"+getter+"() );");
         } else {
-    out.println("    this->set"+propertyName+"( ");
+    out.println("    this->"+setter+"( ");
     out.println("        dynamic_cast<"+type+"*>( ");
-    out.println("            srcPtr->get"+propertyName+"()->cloneDataStructure() )
);");
+    out.println("            srcPtr->"+getter+"()->cloneDataStructure() ) );");
         }
     }
 
@@ -354,6 +360,8 @@
 	        String type = toCppType(property.getType());
 	        String propertyName = property.getSimpleName();
 	        String parameterName = decapitalize(propertyName);
+            String getter = property.getGetter().getSimpleName();
+            String setter = property.getSetter().getSimpleName();
             String constNess = "";
 
             if( !property.getType().isPrimitiveType() &&
@@ -370,17 +378,17 @@
            
 out.println("");
 out.println("////////////////////////////////////////////////////////////////////////////////");
-out.println("const "+type+" "+className+"::get"+propertyName+"() const {");
+out.println("const "+type+" "+className+"::"+getter+"() const {");
 out.println("    return "+parameterName+";");
 out.println("}");
 out.println("");
 out.println("////////////////////////////////////////////////////////////////////////////////");
-out.println(""+type+" "+className+"::get"+propertyName+"() {");
+out.println(""+type+" "+className+"::"+getter+"() {");
 out.println("    return "+parameterName+";");
 out.println("}");
 out.println("");
 out.println("////////////////////////////////////////////////////////////////////////////////");
-out.println("void " + className + "::set" + propertyName+"(" + constNess + type+ " " + parameterName
+" ) {");
+out.println("void " + className + "::" + setter+"(" + constNess + type+ " " + parameterName
+" ) {");
 out.println("    this->"+parameterName+" = "+parameterName+";");
 out.println("}");
 	    }

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java?view=diff&rev=474611&r1=474610&r2=474611
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
Mon Nov 13 16:49:04 2006
@@ -163,9 +163,9 @@
                 constness = "const ";
             }
             
-            out.println("        virtual const "+type+" get"+propertyName+"() const;");
-            out.println("        virtual "+type+" get"+propertyName+"();");
-            out.println("        virtual void set"+propertyName+"( "+constness+type+" "+parameterName+"
);");
+            out.println("        virtual const "+type+" "+property.getGetter().getSimpleName()+"()
const;");
+            out.println("        virtual "+type+" "+property.getGetter().getSimpleName()+"();");
+            out.println("        virtual void "+property.getSetter().getSimpleName()+"( "+constness+type+"
"+parameterName+" );");
             out.println("");
         }
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java?view=diff&rev=474611&r1=474610&r2=474611
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
Mon Nov 13 16:49:04 2006
@@ -158,8 +158,8 @@
             }
             else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                 if (size == null) {
-                    out.println("    bs->writeBoolean( " + getter + " != NULL );" );
-                    out.println("    rc += " + getter + "() == NULL ? 0 : " + getter + ".Length
+ 4;");
+                    out.println("    bs->writeBoolean( " + getter + ".size() != 0 );"
);
+                    out.println("    rc += " + getter + ".size() == 0 ? 0 : " + getter +
".size() + 4;");
                 }
                 else {
                     baseSize += size.asInt();
@@ -227,8 +227,8 @@
                 }
                 else {
                     out.println("    if( bs->readBoolean() ) {");
-                    out.println("        dataOut->write( " + getter + ".Length );");
-                    out.println("        dataOut->write( " + getter + " );");
+                    out.println("        dataOut->write( " + getter + ".size() );");
+                    out.println("        dataOut->write( (const unsigned char*)&("
+ getter + "[0]), " + getter + ".size() );");
                     out.println("    }");
                 }
             }
@@ -377,10 +377,10 @@
                     out.println("    dataOut->write( " + getter + ", 0, " + size.asInt()
+ " );");
                 }
                 else {
-                    out.println("    dataOut->write( " + getter + " != NULL );");
-                    out.println("    if( " + getter + " != NULL ) {");
-                    out.println("        dataOut->write( " + getter + ".Length );");
-                    out.println("        dataOut->write( " + getter + " );");
+                    out.println("    dataOut->write( " + getter + ".size() != 0 );");
+                    out.println("    if( " + getter + ".size() != 0 ) {");
+                    out.println("        dataOut->write( " + getter + ".size() );");
+                    out.println("        dataOut->write( (const unsigned char*)&("
+ getter + "[0]), " + getter + ".size() );");
                     out.println("    }");
                 }
             }



Mime
View raw message