activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r503436 - /activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
Date Sun, 04 Feb 2007 16:35:20 GMT
Author: tabish
Date: Sun Feb  4 08:35:19 2007
New Revision: 503436

URL: http://svn.apache.org/viewvc?view=rev&rev=503436
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

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

Modified: activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java?view=diff&rev=503436&r1=503435&r2=503436
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
Sun Feb  4 08:35:19 2007
@@ -48,7 +48,13 @@
         return className;
     }
     
-    protected boolean checkNeedsInfoPointer() {
+    /**
+     * Checks if the tightMarshal1 method needs an casted version of its
+     * dataStructure argument and then returns true or false to indicate this
+     * to the caller.  
+     * @returns true if the tightMarshal1 method needs an info pointer.
+     */
+    protected boolean checkNeedsInfoPointerTM1() {
         
         if( isMarshallerAware() ){
             return true;
@@ -73,6 +79,34 @@
         return false;
     }
     
+    /**
+     * Checks if the tightMarshal2 method needs an casted version of its
+     * dataStructure argument and then returns true or false to indicate this
+     * to the caller.  
+     * @returns true if the tightMarshal2 method needs an info pointer.
+     */
+    protected boolean checkNeedsInfoPointerTM2() {
+        
+        if( isMarshallerAware() ){
+            return true;
+        }
+        
+        List properties = getProperties();
+        for (Iterator iter = properties.iterator(); iter.hasNext();) {
+            JProperty property = (JProperty) iter.next();
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+            
+            if( !type.equals("boolean") ) {
+                
+                return true;
+            }
+            
+        }
+        
+        return false;
+    }
+
     //////////////////////////////////////////////////////////////////////////////////////
     // This section is for the tight wire format encoding generator
     //////////////////////////////////////////////////////////////////////////////////////
@@ -514,8 +548,7 @@
 out.println("int "+className+"::tightMarshal1( OpenWireFormat* wireFormat, DataStructure*
dataStructure, BooleanStream* bs ) throw( io::IOException ) {");
 out.println("");
 
-//    if( !properties.isEmpty()  || marshallerAware ) { 
-    if( checkNeedsInfoPointer() ) {
+    if( checkNeedsInfoPointerTM1() ) {
         String properClassName = getProperClassName( jclass.getSimpleName() );
 out.println("    "+properClassName+"* info ="); 
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");
@@ -540,7 +573,7 @@
 out.println("    "+baseClass+"::tightMarshal2( wireFormat, dataStructure, dataOut, bs );");
 out.println("");
 
-    if( !properties.isEmpty() || marshallerAware ) {
+    if( checkNeedsInfoPointerTM2() ) {
         String properClassName = getProperClassName( jclass.getSimpleName() );
 out.println("    "+properClassName+"* info ="); 
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");



Mime
View raw message