activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r505751 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire: commands/ marshal/
Date Sat, 10 Feb 2007 19:38:33 GMT
Author: tabish
Date: Sat Feb 10 11:38:33 2007
New Revision: 505751

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h?view=diff&rev=505751&r1=505750&r2=505751
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
Sat Feb 10 11:38:33 2007
@@ -30,11 +30,11 @@
 namespace connector{
 namespace openwire{
 namespace commands{
-    
+
     /**
-     * Base class for all Messages tagged with the ActiveMQXXXMessage 
+     * Base class for all Messages tagged with the ActiveMQXXXMessage
      * type.  The class implements the basic wrapper around the generated
-     * Message class as well as satisfying the contract of the 
+     * Message class as well as satisfying the contract of the
      * core::ActiveMQMessage interface and the cms::Message method of which
      * T must be a derviation of.
      */
@@ -42,18 +42,18 @@
     class ActiveMQMessageBase : public T,
                                 public Message,
                                 public core::ActiveMQMessage {
-    
+
     public:
-    
+
         ActiveMQMessageBase() {}
         virtual ~ActiveMQMessageBase() {}
-        
+
         /**
          * Copy the contents of the passed object into this objects
          * members, overwriting any existing data.
          * @return src - Source Object
          */
-        virtual void copyDataStructure( const DataStructure* src ) {        
+        virtual void copyDataStructure( const DataStructure* src ) {
             openwire::commands::Message::copyDataStructure( src );
         }
 
@@ -65,20 +65,20 @@
         virtual bool IsMarshallAware() {
             return true;
         }
-        
+
         /**
-         * Handles the marshalling of the objects properties into the 
+         * Handles the marshalling of the objects properties into the
          * internal byte array before the object is marshalled to the
          * wire
          * @param wireFormat - the wireformatting controller
          */
         virtual void beforeMarshall( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
             try{
-                    
+
                 marshalledProperties.clear();
                 if( !properties.isEmpty() )
                 {
-                    marshal::PrimitiveMapMarshaller::marshal( 
+                    marshal::PrimitiveMapMarshaller::marshal(
                         &properties, marshalledProperties );
                 }
             }
@@ -86,8 +86,23 @@
             AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
         }
 
+        /**
+         * Called after unmarshaling is started to cleanup the object being
+         * unmarshaled.
+         * @param wireFormat - the wireformat object to control unmarshaling
+         */
+        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+            try{
+
+                marshal::PrimitiveMapMarshaller::unmarshal(
+                    &properties, marshalledProperties );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
     public:   // core::ActiveMQMessage
-    
+
         /**
          * Sets the Acknowledgement Handler that this Message will use
          * when the Acknowledge method is called.
@@ -96,7 +111,7 @@
         virtual void setAckHandler( core::ActiveMQAckHandler* handler ) {
             this->ackHandler = handler;
         }
-        
+
         /**
          * Gets the Acknowledgement Handler that this Message will use
          * when the Acknowledge method is called.
@@ -113,9 +128,9 @@
         virtual int getRedeliveryCount(void) const {
             return redeliveryCount;
         }
-        
+
         /**
-         * Sets the count of the number of times this message has been 
+         * Sets the count of the number of times this message has been
          * redelivered
          * @param count the redelivery count
          */
@@ -137,10 +152,10 @@
             return false;
         }
 
-    public:   // CMS Message          
+    public:   // CMS Message
 
         /**
-         * Acknowledges all consumed messages of the session 
+         * Acknowledges all consumed messages of the session
          * of this consumed message.
          */
         virtual void acknowledge(void) const throw( cms::CMSException ) {
@@ -158,7 +173,7 @@
         virtual void clearBody() {
             this->setContent( std::vector<unsigned char>() );
         }
-        
+
         /**
          * Clears the message properties.  Does not clear the body or
          * header values.
@@ -166,7 +181,7 @@
         virtual void clearProperties() {
             properties.clear();
         }
-        
+
         /**
          * Retrieves the propery names.
          * @return The complete set of property names currently in this
@@ -175,7 +190,7 @@
         virtual std::vector<std::string> getPropertyNames() const {
             return properties.getKeys();
         }
-        
+
         /**
          * Indicates whether or not a given property exists.
          * @param name The name of the property to look up.
@@ -184,103 +199,103 @@
         virtual bool propertyExists( const std::string& name ) const {
             return properties.contains( name );
         }
-        
+
         /**
          * Gets a boolean property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual bool getBooleanProperty( const std::string& name ) const 
+        virtual bool getBooleanProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getBool( name );
         }
-            
+
         /**
          * Gets a byte property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual unsigned char getByteProperty( const std::string& name ) const 
+        virtual unsigned char getByteProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getByte( name );
         }
-            
+
         /**
          * Gets a double property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual double getDoubleProperty( const std::string& name ) const 
+        virtual double getDoubleProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getDouble( name );
         }
-            
+
         /**
          * Gets a float property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual float getFloatProperty( const std::string& name ) const 
+        virtual float getFloatProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getFloat( name );
         }
-            
+
         /**
          * Gets a int property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual int getIntProperty( const std::string& name ) const 
+        virtual int getIntProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getInt( name );
         }
-            
+
         /**
          * Gets a long property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual long long getLongProperty( const std::string& name ) const 
+        virtual long long getLongProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getLong( name );
         }
-            
+
         /**
          * Gets a short property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual short getShortProperty( const std::string& name ) const 
+        virtual short getShortProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getShort( name );
         }
-            
+
         /**
          * Gets a string property.
          * @param name The name of the property to retrieve.
          * @return The value for the named property.
          * @throws CMSException if the property does not exist.
          */
-        virtual std::string getStringProperty( const std::string& name ) const 
+        virtual std::string getStringProperty( const std::string& name ) const
             throw( cms::CMSException ) {
 
             return properties.getString( name );
         }
-        
+
         /**
          * Sets a boolean property.
          * @param name The name of the property to retrieve.
@@ -288,12 +303,12 @@
          * @throws CMSException
          */
         virtual void setBooleanProperty( const std::string& name,
-                                         bool value ) 
+                                         bool value )
                                             throw( cms::CMSException ) {
-                                                
+
             properties.setBool( name, value );
         }
-            
+
         /**
          * Sets a byte property.
          * @param name The name of the property to retrieve.
@@ -301,12 +316,12 @@
          * @throws CMSException
          */
         virtual void setByteProperty( const std::string& name,
-                                      unsigned char value ) 
+                                      unsigned char value )
                                         throw( cms::CMSException ) {
-                                                
+
             properties.setByte( name, value );
         }
-            
+
         /**
          * Sets a double property.
          * @param name The name of the property to retrieve.
@@ -314,12 +329,12 @@
          * @throws CMSException
          */
         virtual void setDoubleProperty( const std::string& name,
-                                        double value ) 
+                                        double value )
                                             throw( cms::CMSException ) {
-                                                
+
             properties.setDouble( name, value );
         }
-            
+
         /**
          * Sets a float property.
          * @param name The name of the property to retrieve.
@@ -327,9 +342,9 @@
          * @throws CMSException
          */
         virtual void setFloatProperty( const std::string& name,
-                                       float value ) 
+                                       float value )
                                         throw( cms::CMSException ) {
-                                                
+
             properties.setFloat( name, value );
         }
 
@@ -340,12 +355,12 @@
          * @throws CMSException
          */
         virtual void setIntProperty( const std::string& name,
-                                     int value ) 
+                                     int value )
                                         throw( cms::CMSException ) {
-                                                
+
             properties.setInt( name, value );
         }
-            
+
         /**
          * Sets a long property.
          * @param name The name of the property to retrieve.
@@ -353,12 +368,12 @@
          * @throws CMSException
          */
         virtual void setLongProperty( const std::string& name,
-                                      long long value ) 
+                                      long long value )
                                         throw( cms::CMSException ) {
-                                                
+
             properties.setLong( name, value );
         }
-            
+
         /**
          * Sets a short property.
          * @param name The name of the property to retrieve.
@@ -366,12 +381,12 @@
          * @throws CMSException
          */
         virtual void setShortProperty( const std::string& name,
-                                       short value ) 
+                                       short value )
                                         throw( cms::CMSException ) {
-                                                
+
             properties.setShort( name, value );
         }
-            
+
         /**
          * Sets a string property.
          * @param name The name of the property to retrieve.
@@ -379,12 +394,12 @@
          * @throws CMSException
          */
         virtual void setStringProperty( const std::string& name,
-                                        const std::string& value ) 
+                                        const std::string& value )
                                             throw( cms::CMSException ) {
-                                                
+
             properties.setString( name, value );
         }
-      
+
         /**
          * Get the Correlation Id for this message
          * @return string representation of the correlation Id
@@ -416,7 +431,7 @@
         virtual void setCMSDeliveryMode( int mode ) {
             this->setPersistent( mode != 0 );
         }
-      
+
         /**
          * Gets the Destination for this Message, returns a
          * @return Destination object
@@ -425,17 +440,17 @@
             return dynamic_cast<const cms::Destination*>(
                 this->getDestination() );
         }
-      
+
         /**
          * Sets the Destination for this message
          * @param destination - Destination Object
          */
         virtual void setCMSDestination( const cms::Destination* destination ) {
-            this->setDestination( 
-                dynamic_cast<ActiveMQDestination*>( 
+            this->setDestination(
+                dynamic_cast<ActiveMQDestination*>(
                     destination->clone() ) );
         }
-      
+
         /**
          * Gets the Expiration Time for this Message
          * @return time value
@@ -443,7 +458,7 @@
         virtual long long getCMSExpiration(void) const {
             return this->getExpiration();
         }
-      
+
         /**
          * Sets the Expiration Time for this message
          * @param expireTime - time value
@@ -451,7 +466,7 @@
         virtual void setCMSExpiration( long long expireTime ) {
             this->setExpiration( expireTime );
         }
-      
+
         /**
          * Gets the CMS Message Id for this Message
          * @return time value
@@ -459,13 +474,13 @@
         virtual std::string getCMSMessageId(void) const {
             return marshal::BaseDataStreamMarshaller::toString( this->getMessageId() );
         }
-      
+
         /**
          * Sets the CMS Message Id for this message
          * @param id - time value
          */
         virtual void setCMSMessageId( const std::string& id AMQCPP_UNUSED) {}
-      
+
         /**
          * Gets the Priority Value for this Message
          * @return priority value
@@ -473,7 +488,7 @@
         virtual int getCMSPriority(void) const {
             return this->getPriority();
         }
-      
+
         /**
          * Sets the Priority Value for this message
          * @param priority - priority value for this message
@@ -489,7 +504,7 @@
         virtual bool getCMSRedelivered(void) const {
             return this->getRedeliveryCounter() != 0;
         }
-      
+
         /**
          * Sets the Redelivered Flag for this message
          * @param redelivered - boolean redelivered value
@@ -504,13 +519,13 @@
             return dynamic_cast< const cms::Destination* >(
                 this->getReplyTo() );
         }
-      
+
         /**
          * Sets the CMS Reply To Address for this message
          * @param id - Reply To value
          */
         virtual void setCMSReplyTo( const cms::Destination* destination ) {
-            this->setReplyTo( 
+            this->setReplyTo(
                 dynamic_cast<ActiveMQDestination*>(
                     destination->clone() ) );
         }
@@ -522,7 +537,7 @@
         virtual long long getCMSTimeStamp(void) const {
             return this->getTimestamp();
         }
-      
+
         /**
          * Sets the Time Stamp for this message
          * @param timeStamp - integer time stamp value
@@ -538,7 +553,7 @@
         virtual std::string getCMSMessageType(void) const {
             return this->getType();
         }
-      
+
         /**
          * Sets the CMS Message Type for this message
          * @param type - message type value string
@@ -548,7 +563,7 @@
         }
 
     private:
-   
+
         core::ActiveMQAckHandler* ackHandler;
         int redeliveryCount;
         util::PrimitiveMap properties;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp?view=diff&rev=505751&r1=505750&r2=505751
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp
Sat Feb 10 11:38:33 2007
@@ -86,7 +86,7 @@
         return false;
     }
 
-    for( int i = 0; i < magic.size(); i++ ) {
+    for( size_t i = 0; i < magic.size(); i++ ) {
         if( magic[i] != MAGIC[i] ) {
             return false;
         }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h?view=diff&rev=505751&r1=505750&r2=505751
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h
Sat Feb 10 11:38:33 2007
@@ -19,7 +19,9 @@
 #define _ACTIVEMQ_CONNECTOR_OPENWIRE_COMMANDS_WIREFORMATINFO_H_
 
 #include <activemq/connector/openwire/commands/BaseCommand.h>
+#include <activemq/connector/openwire/marshal/PrimitiveMapMarshaller.h>
 #include <activemq/transport/Command.h>
+#include <activemq/util/PrimitiveMap.h>
 
 #include <vector>
 
@@ -62,6 +64,15 @@
         virtual void copyDataStructure( const DataStructure* src );
 
         /**
+         * Indicates that this command is aware of Marshalling, and needs
+         * to have its Marshalling methods invoked.
+         * @returns boolean indicating desire to be in marshalling stages
+         */
+        virtual bool IsMarshallAware() {
+            return true;
+        }
+
+        /**
          * Checks if the stackTraceEnabled flag is on
          * @return true if the flag is on.
          */
@@ -194,15 +205,35 @@
          * @return const reference to a std::vector<char>
          */
         const std::vector<unsigned char>& getMarshalledProperties() const {
-            return magic;
+            return marshalledProperties;
         }
 
         /**
          * Sets the value of the marshalledProperties field
          * @param magic - const std::vector<char>
          */
-        void setMarshalledProperties( const std::vector<unsigned char>& magic )
{
-            this->magic = magic;
+        void setMarshalledProperties( const std::vector<unsigned char>& marshalledProperties
) {
+            this->marshalledProperties = marshalledProperties;
+        }
+
+        /**
+         * Gets the Properties for this Command
+         * @param reference to a PrimitiveMap
+         * @throws cms::CMSException
+         */
+        virtual const util::PrimitiveMap& getProperties() const {
+            return properties;
+        }
+        virtual util::PrimitiveMap& getProperties() {
+            return properties;
+        }
+
+        /**
+         * Sets the Properties for this Command
+         * @param map - PrimtiveMap to copy
+         */
+        virtual void setProperties( const util::PrimitiveMap& map ) {
+            this->properties.copy( map );
         }
 
         /**
@@ -211,12 +242,55 @@
          */
         bool isValid() const;
 
+    public:
+
+        /**
+         * Handles the marshalling of the objects properties into the
+         * internal byte array before the object is marshalled to the
+         * wire
+         * @param wireFormat - the wireformatting controller
+         */
+        virtual void beforeMarshall( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+            try{
+
+                marshalledProperties.clear();
+                if( !properties.isEmpty() )
+                {
+                    marshal::PrimitiveMapMarshaller::marshal(
+                        &properties, marshalledProperties );
+                }
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Called after unmarshaling is started to cleanup the object being
+         * unmarshaled.
+         * @param wireFormat - the wireformat object to control unmarshaling
+         */
+        virtual void afterUnmarshal( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
+            try{
+
+                marshal::PrimitiveMapMarshaller::unmarshal(
+                    &properties, marshalledProperties );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
     private:
 
         static std::vector<char> MAGIC;
 
         std::vector<unsigned char> magic;
         std::vector<unsigned char> marshalledProperties;
+
+        /**
+         * WireFormatInfo Properties, unmarshalled from the marshalled
+         * properties on use.
+         */
+        util::PrimitiveMap properties;
 
         int version;
         bool stackTraceEnabled;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp?view=diff&rev=505751&r1=505750&r2=505751
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
Sat Feb 10 11:38:33 2007
@@ -33,15 +33,15 @@
 using namespace activemq::connector::openwire::marshal;
 
 ///////////////////////////////////////////////////////////////////////////////
-void PrimitiveMapMarshaller::marshal( const util::PrimitiveMap* map, 
-                                      std::vector<unsigned char>& dest ) 
-                                        throw ( cms::CMSException ) 
+void PrimitiveMapMarshaller::marshal( const util::PrimitiveMap* map,
+                                      std::vector<unsigned char>& dest )
+                                        throw ( cms::CMSException )
 {
     try {
 
         ByteArrayOutputStream bytesOut( dest );
         DataOutputStream dataOut( &bytesOut );
-    
+
         if( map == NULL )
         {
             dataOut.writeInt( -1 );
@@ -49,10 +49,10 @@
         else
         {
             dataOut.writeInt( (int)map->size() );
-            
+
             std::vector<std::string> keys = map->getKeys();
             std::vector<std::string>::const_iterator iter = keys.begin();
-            
+
             for(; iter != keys.end(); ++iter ) {
 
                 OpenwireStringSupport::writeString( dataOut, &(*iter) );
@@ -62,36 +62,68 @@
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )        
+    AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-PrimitiveMap* PrimitiveMapMarshaller::unmarshal( 
-    const std::vector<unsigned char>& src ) 
-        throw ( cms::CMSException ) 
+PrimitiveMap* PrimitiveMapMarshaller::unmarshal(
+    const std::vector<unsigned char>& src )
+        throw ( cms::CMSException )
 {
     try{
-        
+
         ByteArrayInputStream bytesIn( src );
         DataInputStream dataIn( &bytesIn );
-    
+
         int size = dataIn.readInt();
-        
+
         if( size > 0 )
         {
             PrimitiveMap* map = new PrimitiveMap;
-    
+
             for( int i=0; i < size; i++ )
             {
                 std::string key = OpenwireStringSupport::readString( dataIn );
                 unmarshalPrimitive( dataIn, key, *map );
             }
-    
+
             return map;
         }
-    
+
         return NULL;
-    
+
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::unmarshal(
+    util::PrimitiveMap* map,
+    const std::vector<unsigned char>& src ) throw ( cms::CMSException ) {
+
+    try {
+
+        if( map == NULL ) {
+            return;
+        }
+
+        // Clear old data
+        map->clear();
+
+        ByteArrayInputStream bytesIn( src );
+        DataInputStream dataIn( &bytesIn );
+
+        int size = dataIn.readInt();
+
+        if( size > 0 )
+        {
+            for( int i=0; i < size; i++ )
+            {
+                std::string key = OpenwireStringSupport::readString( dataIn );
+                unmarshalPrimitive( dataIn, key, *map );
+            }
+        }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -103,7 +135,7 @@
                                                     throw ( cms::CMSException ) {
 
     try {
-        
+
         if( value.getValueType() == PrimitiveMap::BOOLEAN_TYPE )
         {
             dataOut.writeByte( PrimitiveMap::BOOLEAN_TYPE );
@@ -147,16 +179,16 @@
         else if( value.getValueType() == PrimitiveMap::BYTE_ARRAY_TYPE )
         {
             dataOut.writeByte( PrimitiveMap::BYTE_ARRAY_TYPE );
-            
+
             std::vector<unsigned char> data = value.getByteArray();
-            
+
             dataOut.writeInt( (int)data.size() );
             dataOut.write( data );
         }
         else if( value.getValueType() == PrimitiveMap::STRING_TYPE )
         {
             std::string data = value.getString();
-            
+
             // is the string big??
             if( data.size() > 8191 ) {
                 dataOut.writeByte( PrimitiveMap::BIG_STRING_TYPE );
@@ -185,9 +217,9 @@
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )        
+    AMQ_CATCHALL_THROW( ActiveMQException )
 }
-                                                    
+
 ///////////////////////////////////////////////////////////////////////////////
 void PrimitiveMapMarshaller::unmarshalPrimitive( io::DataInputStream& dataIn,
                                                  const std::string& key,
@@ -235,8 +267,8 @@
             }
             case PrimitiveMap::STRING_TYPE:
             case PrimitiveMap::BIG_STRING_TYPE:
-                map.setString( 
-                    key, 
+                map.setString(
+                    key,
                     OpenwireStringSupport::readString( dataIn ) );
                 break;
 //            case PrimitiveMap::MAP_TYPE:
@@ -254,7 +286,7 @@
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )        
+    AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 /*
@@ -277,6 +309,6 @@
             }
             return answer;
         }
-        
+
 
 */

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.h?view=diff&rev=505751&r1=505750&r2=505751
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.h
Sat Feb 10 11:38:33 2007
@@ -35,32 +35,41 @@
     class PrimitiveMapMarshaller
     {
     public:
-    
+
         PrimitiveMapMarshaller() {}
         virtual ~PrimitiveMapMarshaller() {}
-        
+
         /**
          * Static Marshal of a primitive map object
          * @param Map to Marshal
          * @param Reference to a byte array to house the data
          * @throws CMSException
          */
-        static void marshal( const util::PrimitiveMap* map, 
-                             std::vector<unsigned char>& dest ) throw ( cms::CMSException
);        
+        static void marshal( const util::PrimitiveMap* map,
+                             std::vector<unsigned char>& dest ) throw ( cms::CMSException
);
 
         /**
-         * Static Map Unmarshaler, takes an array of bytes and returns a 
+         * Static Map Unmarshaler, takes an array of bytes and returns a
          * new instance of a PrimitiveMap object.  Caller owns the pointer.
          * @param reference to a byte array to read data from.
          * @return newly create PrimitiveMap with unmarshaled data.
          */
-        static util::PrimitiveMap* unmarshal( const std::vector<unsigned char>&
src ) 
+        static util::PrimitiveMap* unmarshal( const std::vector<unsigned char>&
src )
             throw ( cms::CMSException );
-    
+
+        /**
+         * Static Map Unmarshaler, takes an array of bytes and returns a
+         * new instance of a PrimitiveMap object.  Caller owns the pointer.
+         * @param Map to Unmarshal into
+         * @param reference to a byte array to read data from.
+         */
+        static void unmarshal( util::PrimitiveMap* map,
+                               const std::vector<unsigned char>& src ) throw (
cms::CMSException );
+
     protected:
-    
+
         /**
-         * Used to Marshal the Primitive types that are contianed in the 
+         * Used to Marshal the Primitive types that are contianed in the
          * map, out on the Wire.
          * @param dataOut - the DataOutputStream to write to
          * @param value - the ValueNode to write.
@@ -77,7 +86,7 @@
          * @param key - key where the element should be inserted
          * @param map - Map to insert data into.
          * @throws CMSException
-         */        
+         */
         static void unmarshalPrimitive( io::DataInputStream& dataIn,
                                         const std::string& key,
                                         util::PrimitiveMap& map )



Mime
View raw message