activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r720260 - in /activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool: AmqCppClassesGenerator.java AmqCppHeadersGenerator.java AmqCppMarshallingHeadersGenerator.java
Date Mon, 24 Nov 2008 19:12:32 GMT
Author: tabish
Date: Mon Nov 24 11:12:32 2008
New Revision: 720260

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

Updated generator that adds the getSize to the Message command and adds the AMQCPP_API to
all the classes.

Modified:
    activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
    activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
    activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppMarshallingHeadersGenerator.java

Modified: activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java?rev=720260&r1=720259&r2=720260&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
Mon Nov 24 11:12:32 2008
@@ -245,7 +245,7 @@
 out.println("    const "+className+"* srcPtr = dynamic_cast<const "+className+"*>(
src );");
 out.println("");
 out.println("    if( srcPtr == NULL || src == NULL ) {");
-out.println("    ");
+out.println("");
 out.println("        throw decaf::lang::exceptions::NullPointerException(");
 out.println("            __FILE__, __LINE__,");
 out.println("            \""+className+"::copyDataStructure - src is NULL or invalid\" );");
@@ -271,8 +271,8 @@
 
     out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " <
srcPtr->"+getter+"().size(); ++i" + parameterName + " ) {");
     out.println("        if( srcPtr->"+getter+"()[i"+parameterName+"] != NULL ) {");
-    out.println("            this->"+getter+"().push_back( ");
-    out.println("                dynamic_cast<"+arrayType+"*>( ");
+    out.println("            this->"+getter+"().push_back(");
+    out.println("                dynamic_cast<"+arrayType+"*>(");
     out.println("                    srcPtr->"+getter+"()[i"+parameterName+"]->cloneDataStructure()
) );");
     out.println("        } else {");
     out.println("            this->"+getter+"().push_back( NULL );");
@@ -283,8 +283,8 @@
     out.println("    this->"+setter+"( srcPtr->"+getter+"() );");
         } else {
     out.println("    if( srcPtr->"+getter+"() != NULL ) {");
-    out.println("        this->"+setter+"( ");
-    out.println("            dynamic_cast<"+type+"*>( ");
+    out.println("        this->"+setter+"(");
+    out.println("            dynamic_cast<"+type+"*>(");
     out.println("                srcPtr->"+getter+"()->cloneDataStructure() ) );");
     out.println("    }");
         }
@@ -298,7 +298,7 @@
 out.println("");
 out.println("////////////////////////////////////////////////////////////////////////////////");
 out.println("unsigned char "+className+"::getDataStructureType() const {");
-out.println("    return "+className+"::ID_" + className.toUpperCase() + "; ");
+out.println("    return "+className+"::ID_" + className.toUpperCase() + ";");
 out.println("}");
 
 // toString
@@ -311,7 +311,7 @@
 out.println("    ostringstream stream;" );
 out.println("");
 out.println("    stream << \"Begin Class = "+className+"\" << std::endl;" );
-out.println("    stream << \" Value of "+className+"::ID_" + className.toUpperCase()
+ " = "+getOpenWireOpCode(jclass)+"\" << std::endl; ");
+out.println("    stream << \" Value of "+className+"::ID_" + className.toUpperCase()
+ " = "+getOpenWireOpCode(jclass)+"\" << std::endl;");
 
 for( Iterator iter = properties.iterator(); iter.hasNext(); ) {
     JProperty property = (JProperty) iter.next();
@@ -451,6 +451,20 @@
 out.println("    return true;" );
 out.println("}");
 
+   if( className.equals( "Message" ) ) {
+out.println("");
+out.println("////////////////////////////////////////////////////////////////////////////////");
+out.println("unsigned int "+className+"::getSize() const {");
+out.println("");
+out.println("    unsigned int size = DEFAULT_MESSAGE_SIZE;");
+out.println("");
+out.println("    size += (unsigned int)this->getContent().size();");
+out.println("    size += (unsigned int)this->getMarshalledProperties().size();");
+out.println("");
+out.println("    return size;");
+out.println("}");
+   }
+
        for( Iterator iter = properties.iterator(); iter.hasNext(); ) {
             JProperty property = (JProperty) iter.next();
             String type = toCppType(property.getType());

Modified: activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java?rev=720260&r1=720259&r2=720260&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
Mon Nov 24 11:12:32 2008
@@ -47,6 +47,7 @@
 out.println("#pragma warning( disable : 4290 )");
 out.println("#endif");
 out.println("");
+out.println("#include <activemq/util/Config.h>");
 out.println("#include <activemq/connector/openwire/commands/"+baseClass+".h>");
 
 List properties = getProperties();
@@ -89,11 +90,19 @@
 out.println("     *         in the activemq-openwire-generator module");
 out.println("     *");
 out.println("     */");
-out.println("    class "+className+" : public "+getProperBaseClassName( className, baseClass
) );
+out.println("    class AMQCPP_API "+className+" : public "+getProperBaseClassName( className,
baseClass ) );
 out.println("    {");
 out.println("    protected:");
 out.println("");
 
+
+            if( className.equals( "Message" ) ) {
+
+out.println("        static const unsigned int DEFAULT_MESSAGE_SIZE = 1024;");
+out.println("");
+
+            }
+
        for (Iterator iter = properties.iterator(); iter.hasNext();) {
             JProperty property = (JProperty) iter.next();
             String type = toCppType(property.getType());
@@ -111,7 +120,7 @@
 
        }
 
-        String typeName = className.toUpperCase();
+       String typeName = className.toUpperCase();
 
 out.println("");
 out.println("    public:");
@@ -160,6 +169,17 @@
 out.println("        virtual bool equals( const DataStructure* value ) const;" );
 out.println("");
 
+        if( className.equals( "Message" ) ) {
+
+out.println("        /**");
+out.println("         * Returns the Size of this message in Bytes.");
+out.println("         * @returns number of bytes this message equates to.");
+out.println("         */");
+out.println("        virtual unsigned int getSize() const;");
+out.println("");
+
+        }
+
         for( Iterator iter = properties.iterator(); iter.hasNext(); ) {
             JProperty property = (JProperty) iter.next();
             String type = toCppType(property.getType());

Modified: activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppMarshallingHeadersGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppMarshallingHeadersGenerator.java?rev=720260&r1=720259&r2=720260&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppMarshallingHeadersGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppMarshallingHeadersGenerator.java
Mon Nov 24 11:12:32 2008
@@ -176,6 +176,7 @@
 out.println("#include <decaf/io/DataInputStream.h>");
 out.println("#include <decaf/io/DataOutputStream.h>");
 out.println("#include <decaf/io/IOException.h>");
+out.println("#include <activemq/util/Config.h>");
 out.println("#include <activemq/connector/openwire/OpenWireFormat.h>");
 out.println("#include <activemq/connector/openwire/commands/DataStructure.h>");
 out.println("#include <activemq/connector/openwire/utils/BooleanStream.h>");
@@ -193,7 +194,7 @@
 out.println("     *         if you need to make a change, please see the Java Classes");
 out.println("     *         in the activemq-openwire-generator module");
 out.println("     */");
-out.println("    class "+className+" : public "+baseClass);
+out.println("    class AMQCPP_API "+className+" : public "+baseClass);
 out.println("    {");
 out.println("    public:");
 out.println("");



Mime
View raw message