activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r741774 [2/17] - in /activemq/activemq-cpp/trunk/src: main/ main/activemq/commands/ main/activemq/core/ main/activemq/exceptions/ main/activemq/state/ main/activemq/wireformat/openwire/marshal/ main/activemq/wireformat/openwire/marshal/v1/ ...
Date Fri, 06 Feb 2009 23:11:39 GMT
Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h?rev=741774&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h Fri Feb  6 23:11:28 2009
@@ -0,0 +1,548 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQMESSAGETEMPLATE_H_
+#define _ACTIVEMQ_COMMANDS_ACTIVEMQMESSAGETEMPLATE_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/ActiveMQMessageBase.h>
+#include <activemq/wireformat/openwire/utils/MessagePropertyInterceptor.h>
+
+namespace activemq {
+namespace commands {
+
+    template< typename T >
+    class AMQCPP_API ActiveMQMessageTemplate : public T, public ActiveMQMessageBase {
+    private:
+
+        std::auto_ptr<wireformat::openwire::utils::MessagePropertyInterceptor> propertiesInterceptor;
+
+    public:
+
+        ActiveMQMessageTemplate() : ActiveMQMessageBase() {
+            this->propertiesInterceptor.reset(
+                new wireformat::openwire::utils::MessagePropertyInterceptor(
+                    this, &this->properties ) );
+        }
+
+        virtual ~ActiveMQMessageTemplate() {}
+
+    public:  // cms::Message related methods
+
+        /**
+         * Acknowledges all consumed messages of the session
+         * of this consumed message.
+         */
+        virtual void acknowledge() const throw( cms::CMSException ) {
+            try{
+                this->getAckHandler()->acknowledgeMessage( this );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Clears out the body of the message.  This does not clear the
+         * headers or properties.
+         */
+        virtual void clearBody() {
+            this->setContent( std::vector<unsigned char>() );
+        }
+
+        /**
+         * Clears the message properties.  Does not clear the body or
+         * header values.
+         */
+        virtual void clearProperties() {
+            properties.clear();
+        }
+
+        /**
+         * Retrieves the property names.
+         * @return The complete set of property names currently in this
+         * message.
+         */
+        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.
+         * @return True if the property exists in this message.
+         */
+        virtual bool propertyExists( const std::string& name ) const {
+            return properties.containsKey( 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getBooleanProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getByteProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getDoubleProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getFloatProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getIntProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getLongProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getShortProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * 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
+            throw( cms::CMSException ) {
+
+            try{
+                return this->propertiesInterceptor->getStringProperty( name );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a boolean property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setBooleanProperty( const std::string& name,
+                                         bool value )
+                                            throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setBooleanProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a byte property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setByteProperty( const std::string& name,
+                                      unsigned char value )
+                                        throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setByteProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a double property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setDoubleProperty( const std::string& name,
+                                        double value )
+                                            throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setDoubleProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a float property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setFloatProperty( const std::string& name,
+                                       float value )
+                                        throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setFloatProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a int property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setIntProperty( const std::string& name,
+                                     int value )
+                                        throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setIntProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a long property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setLongProperty( const std::string& name,
+                                      long long value )
+                                        throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setLongProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a short property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setShortProperty( const std::string& name,
+                                       short value )
+                                        throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setShortProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Sets a string property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setStringProperty( const std::string& name,
+                                        const std::string& value )
+                                            throw( cms::CMSException ) {
+
+            try{
+                this->propertiesInterceptor->setStringProperty( name, value );
+            }
+            AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+            AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+        /**
+         * Get the Correlation Id for this message
+         * @return string representation of the correlation Id
+         */
+        virtual std::string getCMSCorrelationID() const {
+            return this->getCorrelationId();
+        }
+
+        /**
+         * Sets the Correlation Id used by this message
+         * @param correlationId - String representing the correlation id.
+         */
+        virtual void setCMSCorrelationID( const std::string& correlationId ) {
+            this->setCorrelationId( correlationId );
+        }
+
+        /**
+         * Gets the DeliveryMode for this message
+         * @return DeliveryMode enumerated value.
+         */
+        virtual int getCMSDeliveryMode() const {
+            return this->isPersistent();
+        }
+
+        /**
+         * Sets the DeliveryMode for this message
+         * @param mode - DeliveryMode enumerated value.
+         */
+        virtual void setCMSDeliveryMode( int mode ) {
+            this->setPersistent( mode == (int)cms::DeliveryMode::PERSISTENT );
+        }
+
+        /**
+         * Gets the Destination for this Message, returns a
+         * @return Destination object
+         */
+        virtual const cms::Destination* getCMSDestination(void) const {
+            return dynamic_cast<const cms::Destination*>( this->getDestination().get() );
+        }
+
+        /**
+         * Sets the Destination for this message
+         * @param destination - Destination Object
+         */
+        virtual void setCMSDestination( const cms::Destination* destination ) {
+
+            if( destination != NULL ) {
+                this->setDestination(
+                    decaf::lang::Pointer<ActiveMQDestination>(
+                        dynamic_cast<ActiveMQDestination*>( destination->clone() ) ) );
+            } else {
+                this->getDestination().reset( NULL );
+            }
+        }
+
+        /**
+         * Gets the Expiration Time for this Message
+         * @return time value
+         */
+        virtual long long getCMSExpiration() const {
+            return this->getExpiration();
+        }
+
+        /**
+         * Sets the Expiration Time for this message
+         * @param expireTime - time value
+         */
+        virtual void setCMSExpiration( long long expireTime ) {
+            this->setExpiration( expireTime );
+        }
+
+        /**
+         * Gets the CMS Message Id for this Message
+         * @return time value
+         */
+        virtual std::string getCMSMessageID() const {
+            return wireformat::openwire::marshal::BaseDataStreamMarshaller::toString( this->getMessageId().get() );
+        }
+
+        /**
+         * 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
+         */
+        virtual int getCMSPriority() const {
+            return this->getPriority();
+        }
+
+        /**
+         * Sets the Priority Value for this message
+         * @param priority - priority value for this message
+         */
+        virtual void setCMSPriority( int priority ) {
+            this->setPriority( priority );
+        }
+
+        /**
+         * Gets the Redelivered Flag for this Message
+         * @return redelivered value
+         */
+        virtual bool getCMSRedelivered() const {
+            return this->getRedeliveryCounter() != 0;
+        }
+
+        /**
+         * Sets the Redelivered Flag for this message
+         * @param redelivered - boolean redelivered value
+         */
+        virtual void setCMSRedelivered( bool redelivered AMQCPP_UNUSED) {}
+
+        /**
+         * Gets the CMS Reply To Address for this Message
+         * @return Reply To Value
+         */
+        virtual const cms::Destination* getCMSReplyTo() const {
+            return dynamic_cast< const cms::Destination* >(
+                this->getReplyTo().get() );
+        }
+
+        /**
+         * Sets the CMS Reply To Address for this message
+         * @param id - Reply To value
+         */
+        virtual void setCMSReplyTo( const cms::Destination* destination ) {
+
+            if( destination != NULL ) {
+                this->setReplyTo(
+                    decaf::lang::Pointer<ActiveMQDestination>(
+                        dynamic_cast<ActiveMQDestination*>( destination->clone() ) ) );
+            } else {
+                this->setReplyTo( decaf::lang::Pointer<ActiveMQDestination>() );
+            }
+        }
+
+        /**
+         * Gets the Time Stamp for this Message
+         * @return time stamp value
+         */
+        virtual long long getCMSTimestamp() const {
+            return this->getTimestamp();
+        }
+
+        /**
+         * Sets the Time Stamp for this message
+         * @param timeStamp - integer time stamp value
+         */
+        virtual void setCMSTimestamp( long long timeStamp ) {
+            this->setTimestamp( timeStamp );
+        }
+
+        /**
+         * Gets the CMS Message Type for this Message
+         * @return type value
+         */
+        virtual std::string getCMSType() const {
+            return this->getType();
+        }
+
+        /**
+         * Sets the CMS Message Type for this message
+         * @param type - message type value string
+         */
+        virtual void setCMSType( const std::string& type ) {
+            this->setType( type );
+        }
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_COMMANDS_ACTIVEMQMESSAGETEMPLATE_H_ */

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.cpp Fri Feb  6 23:11:28 2009
@@ -22,7 +22,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQObjectMessage::ActiveMQObjectMessage() :
-    ActiveMQMessageBase<cms::ObjectMessage>() {
+    ActiveMQMessageTemplate<cms::ObjectMessage>() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.h Fri Feb  6 23:11:28 2009
@@ -23,15 +23,16 @@
 #pragma warning( disable : 4290 )
 #endif
 
-#include <activemq/commands/ActiveMQMessageBase.h>
+#include <activemq/commands/ActiveMQMessageTemplate.h>
 #include <cms/ObjectMessage.h>
 #include <activemq/util/Config.h>
+#include <memory>
 
 namespace activemq{
 namespace commands{
 
     class AMQCPP_API ActiveMQObjectMessage :
-        public ActiveMQMessageBase<cms::ObjectMessage> {
+        public ActiveMQMessageTemplate<cms::ObjectMessage> {
 
     public:
 
@@ -50,9 +51,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQObjectMessage* cloneDataStructure() const {
-            ActiveMQObjectMessage* message = new ActiveMQObjectMessage();
+            std::auto_ptr<ActiveMQObjectMessage> message( new ActiveMQObjectMessage() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**
@@ -61,7 +62,7 @@
          * @return src - Source Object
          */
         virtual void copyDataStructure( const DataStructure* src ) {
-            ActiveMQMessageBase<cms::ObjectMessage>::copyDataStructure( src );
+            ActiveMQMessageTemplate<cms::ObjectMessage>::copyDataStructure( src );
         }
 
         /**
@@ -73,7 +74,7 @@
             std::ostringstream stream;
 
             stream << "Begin Class = ActiveMQObjectMessage" << std::endl;
-            stream << ActiveMQMessageBase<cms::ObjectMessage>::toString();
+            stream << ActiveMQMessageTemplate<cms::ObjectMessage>::toString();
             stream << "Begin Class = ActiveMQObjectMessage" << std::endl;
 
             return stream.str();
@@ -86,7 +87,7 @@
          * @returns true if DataStructure's are Equal.
          */
         virtual bool equals( const DataStructure* value ) const {
-            return ActiveMQMessageBase<cms::ObjectMessage>::equals( value );
+            return ActiveMQMessageTemplate<cms::ObjectMessage>::equals( value );
         }
 
     public:  // cms::Message
@@ -97,8 +98,7 @@
          * @return new copy of this message
          */
         virtual cms::Message* clone() const {
-            return dynamic_cast<cms::Message*>(
-                this->cloneDataStructure() );
+            return dynamic_cast<cms::Message*>( this->cloneDataStructure() );
         }
 
     };

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQQueue.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQQueue.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQQueue.h Fri Feb  6 23:11:28 2009
@@ -30,6 +30,7 @@
 #include <cms/Queue.h>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
@@ -54,9 +55,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQQueue* cloneDataStructure() const {
-            ActiveMQQueue* message = new ActiveMQQueue();
+            std::auto_ptr<ActiveMQQueue> message( new ActiveMQQueue() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQStreamMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQStreamMessage.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQStreamMessage.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQStreamMessage.h Fri Feb  6 23:11:28 2009
@@ -26,6 +26,7 @@
 #include <activemq/util/Config.h>
 #include <activemq/commands/ActiveMQMessage.h>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
@@ -48,9 +49,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQStreamMessage* cloneDataStructure() const {
-            ActiveMQStreamMessage* message = new ActiveMQStreamMessage();
+            std::auto_ptr<ActiveMQStreamMessage> message( new ActiveMQStreamMessage() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempQueue.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempQueue.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempQueue.h Fri Feb  6 23:11:28 2009
@@ -28,6 +28,7 @@
 #include <cms/TemporaryQueue.h>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
@@ -52,9 +53,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQTempQueue* cloneDataStructure() const {
-            ActiveMQTempQueue* message = new ActiveMQTempQueue();
+            std::auto_ptr<ActiveMQTempQueue> message( new ActiveMQTempQueue() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempTopic.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempTopic.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempTopic.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempTopic.h Fri Feb  6 23:11:28 2009
@@ -28,6 +28,7 @@
 #include <cms/TemporaryTopic.h>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
@@ -52,9 +53,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQTempTopic* cloneDataStructure() const {
-            ActiveMQTempTopic* message = new ActiveMQTempTopic();
+            std::auto_ptr<ActiveMQTempTopic> message( new ActiveMQTempTopic() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp Fri Feb  6 23:11:28 2009
@@ -27,7 +27,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQTextMessage::ActiveMQTextMessage() :
-    ActiveMQMessageBase<cms::TextMessage>() {
+    ActiveMQMessageTemplate<cms::TextMessage>() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.h Fri Feb  6 23:11:28 2009
@@ -24,16 +24,17 @@
 #endif
 
 #include <activemq/util/Config.h>
-#include <activemq/commands/ActiveMQMessageBase.h>
+#include <activemq/commands/ActiveMQMessageTemplate.h>
 #include <cms/TextMessage.h>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
 
     class AMQCPP_API ActiveMQTextMessage :
-        public ActiveMQMessageBase<cms::TextMessage> {
+        public ActiveMQMessageTemplate<cms::TextMessage> {
     public:
 
         const static unsigned char ID_ACTIVEMQTEXTMESSAGE = 28;
@@ -51,9 +52,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQTextMessage* cloneDataStructure() const {
-            ActiveMQTextMessage* message = new ActiveMQTextMessage();
+            std::auto_ptr<ActiveMQTextMessage> message( new ActiveMQTextMessage() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**
@@ -62,7 +63,7 @@
          * @return src - Source Object
          */
         virtual void copyDataStructure( const DataStructure* src ) {
-            ActiveMQMessageBase<cms::TextMessage>::copyDataStructure( src );
+            ActiveMQMessageTemplate<cms::TextMessage>::copyDataStructure( src );
         }
 
         /**
@@ -74,7 +75,7 @@
             std::ostringstream stream;
 
             stream << "Begin Class = ActiveMQTextMessage" << std::endl;
-            stream << ActiveMQMessageBase<cms::TextMessage>::toString();
+            stream << ActiveMQMessageTemplate<cms::TextMessage>::toString();
             stream << "End Class = ActiveMQTextMessage" << std::endl;
 
             return stream.str();
@@ -87,7 +88,7 @@
          * @returns true if DataStructure's are Equal.
          */
         virtual bool equals( const DataStructure* value ) const {
-            return ActiveMQMessageBase<cms::TextMessage>::equals( value );
+            return ActiveMQMessageTemplate<cms::TextMessage>::equals( value );
         }
 
     public:   // CMS Message
@@ -98,8 +99,7 @@
          * @return new copy of this message
          */
         virtual cms::TextMessage* clone(void) const {
-            return dynamic_cast<cms::TextMessage*>(
-                this->cloneDataStructure() );
+            return dynamic_cast<cms::TextMessage*>( this->cloneDataStructure() );
         }
 
     public:   // cms::TextMessage

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTopic.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTopic.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTopic.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTopic.h Fri Feb  6 23:11:28 2009
@@ -30,6 +30,7 @@
 #include <cms/Topic.h>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
@@ -54,9 +55,9 @@
          * @returns new copy of this object.
          */
         virtual ActiveMQTopic* cloneDataStructure() const {
-            ActiveMQTopic* message = new ActiveMQTopic();
+            std::auto_ptr<ActiveMQTopic> message( new ActiveMQTopic() );
             message->copyDataStructure( this );
-            return message;
+            return message.release();
         }
 
         /**
@@ -132,7 +133,7 @@
         }
 
         /**
-         * Copies the contents of the given Destinastion object to this one.
+         * Copies the contents of the given Destination object to this one.
          * @param source The source Destination object.
          */
         virtual void copy( const cms::Destination& source ) {

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.cpp Fri Feb  6 23:11:28 2009
@@ -27,9 +27,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 BrokerError::~BrokerError() {
-    for( unsigned int i = 0; i < stackTraceElements.size(); ++i ) {
-        delete stackTraceElements[i];
-    }
+    this->stackTraceElements.clear();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -45,25 +43,12 @@
 
     this->setMessage( srcErr->getMessage() );
     this->setExceptionClass( srcErr->getExceptionClass() );
-
-    for( unsigned int i = 0; i < srcErr->getStackTraceElements().size(); ++i ) {
-        if( srcErr->getStackTraceElements()[i] != NULL ) {
-            StackTraceElement* element = new StackTraceElement;
-            *element = *( srcErr->getStackTraceElements()[i] );
-
-            // store the copy
-            this->stackTraceElements.push_back( element );
-        }
-    }
-
-    if( srcErr->getCause() ) {
-        this->cause = dynamic_cast<BrokerError*>(
-            srcErr->getCause()->cloneDataStructure() );
-    }
+    this->setStackTraceElements( srcErr->getStackTraceElements() );
+    this->setCause( srcErr->getCause() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* BrokerError::visit( activemq::state::CommandVisitor* visitor )
+decaf::lang::Pointer<commands::Command> BrokerError::visit( activemq::state::CommandVisitor* visitor )
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processBrokerError( this );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.h Fri Feb  6 23:11:28 2009
@@ -21,6 +21,7 @@
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseCommand.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/Pointer.h>
 
 #include <string>
 #include <vector>
@@ -43,6 +44,13 @@
             int LineNumber;
         };
 
+    private:
+
+        std::string message;
+        std::string exceptionClass;
+        std::vector< decaf::lang::Pointer<StackTraceElement> > stackTraceElements;
+        decaf::lang::Pointer<BrokerError> cause;
+
     public:
 
         BrokerError() {}
@@ -57,11 +65,11 @@
         }
 
         /**
-         * Clone this obbject and return a new instance that the
+         * Clone this object and return a new instance that the
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual DataStructure* cloneDataStructure() const {
+        virtual BrokerError* cloneDataStructure() const {
 
             BrokerError* error = new BrokerError();
             error->copyDataStructure( this );
@@ -82,8 +90,8 @@
          *
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
-            throw( exceptions::ActiveMQException );
+        virtual decaf::lang::Pointer<commands::Command> visit(
+            activemq::state::CommandVisitor* visitor ) throw( exceptions::ActiveMQException );
 
         /**
          * Gets the string holding the error message
@@ -121,7 +129,7 @@
          * Gets the Broker Error that caused this exception
          * @returns Broker Error Pointer
          */
-        virtual BrokerError* getCause() const {
+        virtual const decaf::lang::Pointer<BrokerError>& getCause() const {
             return cause;
         }
 
@@ -129,15 +137,15 @@
          * Sets the Broker Error that caused this exception
          * @param cause - Broker Error
          */
-        virtual void setCause( BrokerError* cause ) {
+        virtual void setCause( const decaf::lang::Pointer<BrokerError>& cause ) {
             this->cause = cause;
         }
 
         /**
-         * Gets the Stack Trace Elemtns for the Exception
+         * Gets the Stack Trace Elements for the Exception
          * @returns Stack Trace Elements
          */
-        virtual const std::vector<StackTraceElement*>& getStackTraceElements() const {
+        virtual const std::vector< decaf::lang::Pointer<StackTraceElement> >& getStackTraceElements() const {
             return stackTraceElements;
         }
 
@@ -145,17 +153,10 @@
          * Sets the Stack Trace Elements for this Exception
          * @param stackTraceElements - Stack Trace Elements
          */
-        virtual void setStackTraceElements( const std::vector<StackTraceElement*>& stackTraceElements ) {
+        virtual void setStackTraceElements( const std::vector< decaf::lang::Pointer<StackTraceElement> >& stackTraceElements ) {
             this->stackTraceElements = stackTraceElements;
         }
 
-    private:
-
-        std::string message;
-        std::string exceptionClass;
-        std::vector<StackTraceElement*> stackTraceElements;
-        BrokerError* cause;
-
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.cpp Fri Feb  6 23:11:28 2009
@@ -54,12 +54,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 BrokerId* BrokerId::cloneDataStructure() const {
-    BrokerId* brokerId = new BrokerId();
+    std::auto_ptr<BrokerId> brokerId( new BrokerId() );
 
     // Copy the data from the base class or classes
     brokerId->copyDataStructure( this );
 
-    return brokerId;
+    return brokerId.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseDataStructure.h>
+#include <decaf/lang/Pointer.h>
 #include <decaf/lang/Comparable.h>
 #include <vector>
 #include <string>
@@ -51,6 +52,8 @@
 
         const static unsigned char ID_BROKERID = 124;
 
+        typedef decaf::lang::PointerComparator<BrokerId> COMPARATOR;
+
     public:
 
         BrokerId();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.cpp Fri Feb  6 23:11:28 2009
@@ -38,7 +38,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 BrokerInfo::BrokerInfo() {
 
-    this->brokerId = NULL;
     this->brokerURL = "";
     this->brokerName = "";
     this->slaveBroker = false;
@@ -54,20 +53,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 BrokerInfo::~BrokerInfo() {
 
-    delete this->brokerId;
-    for( size_t ipeerBrokerInfos = 0; ipeerBrokerInfos < peerBrokerInfos.size(); ++ipeerBrokerInfos ) {
-        delete peerBrokerInfos[ipeerBrokerInfos];
-    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 BrokerInfo* BrokerInfo::cloneDataStructure() const {
-    BrokerInfo* brokerInfo = new BrokerInfo();
+    std::auto_ptr<BrokerInfo> brokerInfo( new BrokerInfo() );
 
     // Copy the data from the base class or classes
     brokerInfo->copyDataStructure( this );
 
-    return brokerInfo;
+    return brokerInfo.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -88,21 +83,9 @@
             __FILE__, __LINE__,
             "BrokerInfo::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getBrokerId() != NULL ) {
-        this->setBrokerId(
-            dynamic_cast<BrokerId*>(
-                srcPtr->getBrokerId()->cloneDataStructure() ) );
-    }
+    this->setBrokerId( srcPtr->getBrokerId() );
     this->setBrokerURL( srcPtr->getBrokerURL() );
-    for( size_t ipeerBrokerInfos = 0; ipeerBrokerInfos < srcPtr->getPeerBrokerInfos().size(); ++ipeerBrokerInfos ) {
-        if( srcPtr->getPeerBrokerInfos()[ipeerBrokerInfos] != NULL ) {
-            this->getPeerBrokerInfos().push_back(
-                dynamic_cast<BrokerInfo*>(
-                    srcPtr->getPeerBrokerInfos()[ipeerBrokerInfos]->cloneDataStructure() ) );
-        } else {
-            this->getPeerBrokerInfos().push_back( NULL );
-        }
-    }
+    this->setPeerBrokerInfos( srcPtr->getPeerBrokerInfos() );
     this->setBrokerName( srcPtr->getBrokerName() );
     this->setSlaveBroker( srcPtr->isSlaveBroker() );
     this->setMasterBroker( srcPtr->isMasterBroker() );
@@ -169,7 +152,7 @@
         return false;
     }
     if( this->getBrokerId() != NULL ) {
-        if( !this->getBrokerId()->equals( valuePtr->getBrokerId() ) ) {
+        if( !this->getBrokerId()->equals( valuePtr->getBrokerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getBrokerId() != NULL ) {
@@ -180,7 +163,7 @@
     }
     for( size_t ipeerBrokerInfos = 0; ipeerBrokerInfos < this->getPeerBrokerInfos().size(); ++ipeerBrokerInfos ) {
         if( this->getPeerBrokerInfos()[ipeerBrokerInfos] != NULL ) {
-            if( !this->getPeerBrokerInfos()[ipeerBrokerInfos]->equals( valuePtr->getPeerBrokerInfos()[ipeerBrokerInfos] ) ) {
+            if( !this->getPeerBrokerInfos()[ipeerBrokerInfos]->equals( valuePtr->getPeerBrokerInfos()[ipeerBrokerInfos].get() ) ) {
                 return false;
             }
         } else if( valuePtr->getPeerBrokerInfos()[ipeerBrokerInfos] != NULL ) {
@@ -221,24 +204,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* BrokerInfo::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> BrokerInfo::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processBrokerInfo( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const BrokerId* BrokerInfo::getBrokerId() const {
+const decaf::lang::Pointer<BrokerId>& BrokerInfo::getBrokerId() const {
     return brokerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-BrokerId* BrokerInfo::getBrokerId() {
+decaf::lang::Pointer<BrokerId>& BrokerInfo::getBrokerId() {
     return brokerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BrokerInfo::setBrokerId( BrokerId* brokerId ) {
+void BrokerInfo::setBrokerId( const decaf::lang::Pointer<BrokerId>& brokerId ) {
     this->brokerId = brokerId;
 }
 
@@ -258,17 +241,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const std::vector<BrokerInfo*>& BrokerInfo::getPeerBrokerInfos() const {
+const std::vector< decaf::lang::Pointer<BrokerInfo> >& BrokerInfo::getPeerBrokerInfos() const {
     return peerBrokerInfos;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<BrokerInfo*>& BrokerInfo::getPeerBrokerInfos() {
+std::vector< decaf::lang::Pointer<BrokerInfo> >& BrokerInfo::getPeerBrokerInfos() {
     return peerBrokerInfos;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void BrokerInfo::setPeerBrokerInfos( const std::vector<BrokerInfo*>& peerBrokerInfos ) {
+void BrokerInfo::setPeerBrokerInfos( const std::vector< decaf::lang::Pointer<BrokerInfo> >& peerBrokerInfos ) {
     this->peerBrokerInfos = peerBrokerInfos;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseCommand.h>
+#include <decaf/lang/Pointer.h>
 #include <activemq/commands/BrokerId.h>
 #include <activemq/commands/BrokerInfo.h>
 #include <vector>
@@ -46,9 +47,9 @@
     class AMQCPP_API BrokerInfo : public BaseCommand {
     protected:
 
-        BrokerId* brokerId;
+        decaf::lang::Pointer<BrokerId> brokerId;
         std::string brokerURL;
-        std::vector<BrokerInfo*> peerBrokerInfos;
+        std::vector< decaf::lang::Pointer<BrokerInfo> > peerBrokerInfos;
         std::string brokerName;
         bool slaveBroker;
         bool masterBroker;
@@ -116,20 +117,20 @@
          * 
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
+        virtual decaf::lang::Pointer<commands::Command> visit( activemq::state::CommandVisitor* visitor )
             throw( exceptions::ActiveMQException );
 
-        virtual const BrokerId* getBrokerId() const;
-        virtual BrokerId* getBrokerId();
-        virtual void setBrokerId( BrokerId* brokerId );
+        virtual const decaf::lang::Pointer<BrokerId>& getBrokerId() const;
+        virtual decaf::lang::Pointer<BrokerId>& getBrokerId();
+        virtual void setBrokerId( const decaf::lang::Pointer<BrokerId>& brokerId );
 
         virtual const std::string& getBrokerURL() const;
         virtual std::string& getBrokerURL();
         virtual void setBrokerURL( const std::string& brokerURL );
 
-        virtual const std::vector<BrokerInfo*>& getPeerBrokerInfos() const;
-        virtual std::vector<BrokerInfo*>& getPeerBrokerInfos();
-        virtual void setPeerBrokerInfos( const std::vector<BrokerInfo*>& peerBrokerInfos );
+        virtual const std::vector< decaf::lang::Pointer<BrokerInfo> >& getPeerBrokerInfos() const;
+        virtual std::vector< decaf::lang::Pointer<BrokerInfo> >& getPeerBrokerInfos();
+        virtual void setPeerBrokerInfos( const std::vector< decaf::lang::Pointer<BrokerInfo> >& peerBrokerInfos );
 
         virtual const std::string& getBrokerName() const;
         virtual std::string& getBrokerName();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h Fri Feb  6 23:11:28 2009
@@ -22,6 +22,7 @@
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseDataStructure.h>
 #include <activemq/exceptions/ActiveMQException.h>
+#include <decaf/lang/Pointer.h>
 
 namespace activemq{
 namespace state{
@@ -71,8 +72,8 @@
          *
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
-            throw( exceptions::ActiveMQException ) = 0;
+        virtual decaf::lang::Pointer<commands::Command> visit(
+            activemq::state::CommandVisitor* visitor ) throw( exceptions::ActiveMQException ) = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.cpp Fri Feb  6 23:11:28 2009
@@ -52,12 +52,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionControl* ConnectionControl::cloneDataStructure() const {
-    ConnectionControl* connectionControl = new ConnectionControl();
+    std::auto_ptr<ConnectionControl> connectionControl( new ConnectionControl() );
 
     // Copy the data from the base class or classes
     connectionControl->copyDataStructure( this );
 
-    return connectionControl;
+    return connectionControl.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -142,7 +142,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ConnectionControl::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ConnectionControl::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processConnectionControl( this );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseCommand.h>
+#include <decaf/lang/Pointer.h>
 #include <vector>
 #include <string>
 
@@ -107,7 +108,7 @@
          * 
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
+        virtual decaf::lang::Pointer<commands::Command> visit( activemq::state::CommandVisitor* visitor )
             throw( exceptions::ActiveMQException );
 
         virtual bool isClose() const;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.cpp Fri Feb  6 23:11:28 2009
@@ -38,25 +38,21 @@
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionError::ConnectionError() {
 
-    this->exception = NULL;
-    this->connectionId = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionError::~ConnectionError() {
 
-    delete this->exception;
-    delete this->connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionError* ConnectionError::cloneDataStructure() const {
-    ConnectionError* connectionError = new ConnectionError();
+    std::auto_ptr<ConnectionError> connectionError( new ConnectionError() );
 
     // Copy the data from the base class or classes
     connectionError->copyDataStructure( this );
 
-    return connectionError;
+    return connectionError.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -77,16 +73,8 @@
             __FILE__, __LINE__,
             "ConnectionError::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getException() != NULL ) {
-        this->setException(
-            dynamic_cast<BrokerError*>(
-                srcPtr->getException()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getConnectionId() != NULL ) {
-        this->setConnectionId(
-            dynamic_cast<ConnectionId*>(
-                srcPtr->getConnectionId()->cloneDataStructure() ) );
-    }
+    this->setException( srcPtr->getException() );
+    this->setConnectionId( srcPtr->getConnectionId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -132,14 +120,14 @@
         return false;
     }
     if( this->getException() != NULL ) {
-        if( !this->getException()->equals( valuePtr->getException() ) ) {
+        if( !this->getException()->equals( valuePtr->getException().get() ) ) {
             return false;
         }
     } else if( valuePtr->getException() != NULL ) {
         return false;
     }
     if( this->getConnectionId() != NULL ) {
-        if( !this->getConnectionId()->equals( valuePtr->getConnectionId() ) ) {
+        if( !this->getConnectionId()->equals( valuePtr->getConnectionId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getConnectionId() != NULL ) {
@@ -152,39 +140,39 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ConnectionError::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ConnectionError::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processConnectionError( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const BrokerError* ConnectionError::getException() const {
+const decaf::lang::Pointer<BrokerError>& ConnectionError::getException() const {
     return exception;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-BrokerError* ConnectionError::getException() {
+decaf::lang::Pointer<BrokerError>& ConnectionError::getException() {
     return exception;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConnectionError::setException( BrokerError* exception ) {
+void ConnectionError::setException( const decaf::lang::Pointer<BrokerError>& exception ) {
     this->exception = exception;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConnectionId* ConnectionError::getConnectionId() const {
+const decaf::lang::Pointer<ConnectionId>& ConnectionError::getConnectionId() const {
     return connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConnectionId* ConnectionError::getConnectionId() {
+decaf::lang::Pointer<ConnectionId>& ConnectionError::getConnectionId() {
     return connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConnectionError::setConnectionId( ConnectionId* connectionId ) {
+void ConnectionError::setConnectionId( const decaf::lang::Pointer<ConnectionId>& connectionId ) {
     this->connectionId = connectionId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseCommand.h>
+#include <decaf/lang/Pointer.h>
 #include <activemq/commands/BrokerError.h>
 #include <activemq/commands/ConnectionId.h>
 #include <vector>
@@ -46,8 +47,8 @@
     class AMQCPP_API ConnectionError : public BaseCommand {
     protected:
 
-        BrokerError* exception;
-        ConnectionId* connectionId;
+        decaf::lang::Pointer<BrokerError> exception;
+        decaf::lang::Pointer<ConnectionId> connectionId;
 
     protected:
 
@@ -106,16 +107,16 @@
          * 
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
+        virtual decaf::lang::Pointer<commands::Command> visit( activemq::state::CommandVisitor* visitor )
             throw( exceptions::ActiveMQException );
 
-        virtual const BrokerError* getException() const;
-        virtual BrokerError* getException();
-        virtual void setException( BrokerError* exception );
-
-        virtual const ConnectionId* getConnectionId() const;
-        virtual ConnectionId* getConnectionId();
-        virtual void setConnectionId( ConnectionId* connectionId );
+        virtual const decaf::lang::Pointer<BrokerError>& getException() const;
+        virtual decaf::lang::Pointer<BrokerError>& getException();
+        virtual void setException( const decaf::lang::Pointer<BrokerError>& exception );
+
+        virtual const decaf::lang::Pointer<ConnectionId>& getConnectionId() const;
+        virtual decaf::lang::Pointer<ConnectionId>& getConnectionId();
+        virtual void setConnectionId( const decaf::lang::Pointer<ConnectionId>& connectionId );
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.cpp Fri Feb  6 23:11:28 2009
@@ -54,12 +54,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionId* ConnectionId::cloneDataStructure() const {
-    ConnectionId* connectionId = new ConnectionId();
+    std::auto_ptr<ConnectionId> connectionId( new ConnectionId() );
 
     // Copy the data from the base class or classes
     connectionId->copyDataStructure( this );
 
-    return connectionId;
+    return connectionId.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseDataStructure.h>
+#include <decaf/lang/Pointer.h>
 #include <decaf/lang/Comparable.h>
 #include <vector>
 #include <string>
@@ -51,6 +52,8 @@
 
         const static unsigned char ID_CONNECTIONID = 120;
 
+        typedef decaf::lang::PointerComparator<ConnectionId> COMPARATOR;
+
     public:
 
         ConnectionId();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.cpp Fri Feb  6 23:11:28 2009
@@ -38,7 +38,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionInfo::ConnectionInfo() {
 
-    this->connectionId = NULL;
     this->clientId = "";
     this->password = "";
     this->userName = "";
@@ -50,20 +49,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionInfo::~ConnectionInfo() {
 
-    delete this->connectionId;
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        delete brokerPath[ibrokerPath];
-    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ConnectionInfo* ConnectionInfo::cloneDataStructure() const {
-    ConnectionInfo* connectionInfo = new ConnectionInfo();
+    std::auto_ptr<ConnectionInfo> connectionInfo( new ConnectionInfo() );
 
     // Copy the data from the base class or classes
     connectionInfo->copyDataStructure( this );
 
-    return connectionInfo;
+    return connectionInfo.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -84,23 +79,11 @@
             __FILE__, __LINE__,
             "ConnectionInfo::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getConnectionId() != NULL ) {
-        this->setConnectionId(
-            dynamic_cast<ConnectionId*>(
-                srcPtr->getConnectionId()->cloneDataStructure() ) );
-    }
+    this->setConnectionId( srcPtr->getConnectionId() );
     this->setClientId( srcPtr->getClientId() );
     this->setPassword( srcPtr->getPassword() );
     this->setUserName( srcPtr->getUserName() );
-    for( size_t ibrokerPath = 0; ibrokerPath < srcPtr->getBrokerPath().size(); ++ibrokerPath ) {
-        if( srcPtr->getBrokerPath()[ibrokerPath] != NULL ) {
-            this->getBrokerPath().push_back(
-                dynamic_cast<BrokerId*>(
-                    srcPtr->getBrokerPath()[ibrokerPath]->cloneDataStructure() ) );
-        } else {
-            this->getBrokerPath().push_back( NULL );
-        }
-    }
+    this->setBrokerPath( srcPtr->getBrokerPath() );
     this->setBrokerMasterConnector( srcPtr->isBrokerMasterConnector() );
     this->setManageable( srcPtr->isManageable() );
     this->setClientMaster( srcPtr->isClientMaster() );
@@ -157,7 +140,7 @@
         return false;
     }
     if( this->getConnectionId() != NULL ) {
-        if( !this->getConnectionId()->equals( valuePtr->getConnectionId() ) ) {
+        if( !this->getConnectionId()->equals( valuePtr->getConnectionId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getConnectionId() != NULL ) {
@@ -174,7 +157,7 @@
     }
     for( size_t ibrokerPath = 0; ibrokerPath < this->getBrokerPath().size(); ++ibrokerPath ) {
         if( this->getBrokerPath()[ibrokerPath] != NULL ) {
-            if( !this->getBrokerPath()[ibrokerPath]->equals( valuePtr->getBrokerPath()[ibrokerPath] ) ) {
+            if( !this->getBrokerPath()[ibrokerPath]->equals( valuePtr->getBrokerPath()[ibrokerPath].get() ) ) {
                 return false;
             }
         } else if( valuePtr->getBrokerPath()[ibrokerPath] != NULL ) {
@@ -197,24 +180,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ConnectionInfo::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ConnectionInfo::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processConnectionInfo( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConnectionId* ConnectionInfo::getConnectionId() const {
+const decaf::lang::Pointer<ConnectionId>& ConnectionInfo::getConnectionId() const {
     return connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConnectionId* ConnectionInfo::getConnectionId() {
+decaf::lang::Pointer<ConnectionId>& ConnectionInfo::getConnectionId() {
     return connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConnectionInfo::setConnectionId( ConnectionId* connectionId ) {
+void ConnectionInfo::setConnectionId( const decaf::lang::Pointer<ConnectionId>& connectionId ) {
     this->connectionId = connectionId;
 }
 
@@ -264,17 +247,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const std::vector<BrokerId*>& ConnectionInfo::getBrokerPath() const {
+const std::vector< decaf::lang::Pointer<BrokerId> >& ConnectionInfo::getBrokerPath() const {
     return brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<BrokerId*>& ConnectionInfo::getBrokerPath() {
+std::vector< decaf::lang::Pointer<BrokerId> >& ConnectionInfo::getBrokerPath() {
     return brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConnectionInfo::setBrokerPath( const std::vector<BrokerId*>& brokerPath ) {
+void ConnectionInfo::setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath ) {
     this->brokerPath = brokerPath;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseCommand.h>
+#include <decaf/lang/Pointer.h>
 #include <activemq/commands/ConnectionId.h>
 #include <activemq/commands/BrokerId.h>
 #include <vector>
@@ -46,11 +47,11 @@
     class AMQCPP_API ConnectionInfo : public BaseCommand {
     protected:
 
-        ConnectionId* connectionId;
+        decaf::lang::Pointer<ConnectionId> connectionId;
         std::string clientId;
         std::string password;
         std::string userName;
-        std::vector<BrokerId*> brokerPath;
+        std::vector< decaf::lang::Pointer<BrokerId> > brokerPath;
         bool brokerMasterConnector;
         bool manageable;
         bool clientMaster;
@@ -112,12 +113,12 @@
          * 
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
+        virtual decaf::lang::Pointer<commands::Command> visit( activemq::state::CommandVisitor* visitor )
             throw( exceptions::ActiveMQException );
 
-        virtual const ConnectionId* getConnectionId() const;
-        virtual ConnectionId* getConnectionId();
-        virtual void setConnectionId( ConnectionId* connectionId );
+        virtual const decaf::lang::Pointer<ConnectionId>& getConnectionId() const;
+        virtual decaf::lang::Pointer<ConnectionId>& getConnectionId();
+        virtual void setConnectionId( const decaf::lang::Pointer<ConnectionId>& connectionId );
 
         virtual const std::string& getClientId() const;
         virtual std::string& getClientId();
@@ -131,9 +132,9 @@
         virtual std::string& getUserName();
         virtual void setUserName( const std::string& userName );
 
-        virtual const std::vector<BrokerId*>& getBrokerPath() const;
-        virtual std::vector<BrokerId*>& getBrokerPath();
-        virtual void setBrokerPath( const std::vector<BrokerId*>& brokerPath );
+        virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath() const;
+        virtual std::vector< decaf::lang::Pointer<BrokerId> >& getBrokerPath();
+        virtual void setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath );
 
         virtual bool isBrokerMasterConnector() const;
         virtual void setBrokerMasterConnector( bool brokerMasterConnector );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.cpp Fri Feb  6 23:11:28 2009
@@ -39,7 +39,6 @@
 ConsumerControl::ConsumerControl() {
 
     this->close = false;
-    this->consumerId = NULL;
     this->prefetch = 0;
     this->flush = false;
     this->start = false;
@@ -49,17 +48,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 ConsumerControl::~ConsumerControl() {
 
-    delete this->consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ConsumerControl* ConsumerControl::cloneDataStructure() const {
-    ConsumerControl* consumerControl = new ConsumerControl();
+    std::auto_ptr<ConsumerControl> consumerControl( new ConsumerControl() );
 
     // Copy the data from the base class or classes
     consumerControl->copyDataStructure( this );
 
-    return consumerControl;
+    return consumerControl.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -81,11 +79,7 @@
             "ConsumerControl::copyDataStructure - src is NULL or invalid" );
     }
     this->setClose( srcPtr->isClose() );
-    if( srcPtr->getConsumerId() != NULL ) {
-        this->setConsumerId(
-            dynamic_cast<ConsumerId*>(
-                srcPtr->getConsumerId()->cloneDataStructure() ) );
-    }
+    this->setConsumerId( srcPtr->getConsumerId() );
     this->setPrefetch( srcPtr->getPrefetch() );
     this->setFlush( srcPtr->isFlush() );
     this->setStart( srcPtr->isStart() );
@@ -137,7 +131,7 @@
         return false;
     }
     if( this->getConsumerId() != NULL ) {
-        if( !this->getConsumerId()->equals( valuePtr->getConsumerId() ) ) {
+        if( !this->getConsumerId()->equals( valuePtr->getConsumerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getConsumerId() != NULL ) {
@@ -162,7 +156,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ConsumerControl::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ConsumerControl::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processConsumerControl( this );
@@ -179,17 +173,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConsumerId* ConsumerControl::getConsumerId() const {
+const decaf::lang::Pointer<ConsumerId>& ConsumerControl::getConsumerId() const {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConsumerId* ConsumerControl::getConsumerId() {
+decaf::lang::Pointer<ConsumerId>& ConsumerControl::getConsumerId() {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConsumerControl::setConsumerId( ConsumerId* consumerId ) {
+void ConsumerControl::setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId ) {
     this->consumerId = consumerId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseCommand.h>
+#include <decaf/lang/Pointer.h>
 #include <activemq/commands/ConsumerId.h>
 #include <vector>
 #include <string>
@@ -46,7 +47,7 @@
     protected:
 
         bool close;
-        ConsumerId* consumerId;
+        decaf::lang::Pointer<ConsumerId> consumerId;
         int prefetch;
         bool flush;
         bool start;
@@ -109,15 +110,15 @@
          * 
          * @return a Response to the visitor being called or NULL if no response.
          */
-        virtual commands::Command* visit( activemq::state::CommandVisitor* visitor )
+        virtual decaf::lang::Pointer<commands::Command> visit( activemq::state::CommandVisitor* visitor )
             throw( exceptions::ActiveMQException );
 
         virtual bool isClose() const;
         virtual void setClose( bool close );
 
-        virtual const ConsumerId* getConsumerId() const;
-        virtual ConsumerId* getConsumerId();
-        virtual void setConsumerId( ConsumerId* consumerId );
+        virtual const decaf::lang::Pointer<ConsumerId>& getConsumerId() const;
+        virtual decaf::lang::Pointer<ConsumerId>& getConsumerId();
+        virtual void setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId );
 
         virtual int getPrefetch() const;
         virtual void setPrefetch( int prefetch );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.cpp Fri Feb  6 23:11:28 2009
@@ -56,12 +56,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ConsumerId* ConsumerId::cloneDataStructure() const {
-    ConsumerId* consumerId = new ConsumerId();
+    std::auto_ptr<ConsumerId> consumerId( new ConsumerId() );
 
     // Copy the data from the base class or classes
     consumerId->copyDataStructure( this );
 
-    return consumerId;
+    return consumerId.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.h Fri Feb  6 23:11:28 2009
@@ -25,6 +25,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/BaseDataStructure.h>
+#include <decaf/lang/Pointer.h>
 #include <decaf/lang/Comparable.h>
 #include <vector>
 #include <string>
@@ -53,6 +54,8 @@
 
         const static unsigned char ID_CONSUMERID = 122;
 
+        typedef decaf::lang::PointerComparator<ConsumerId> COMPARATOR;
+
     public:
 
         ConsumerId();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerInfo.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerInfo.cpp Fri Feb  6 23:11:28 2009
@@ -38,9 +38,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ConsumerInfo::ConsumerInfo() {
 
-    this->consumerId = NULL;
     this->browser = false;
-    this->destination = NULL;
     this->prefetchSize = 0;
     this->maximumPendingMessageLimit = 0;
     this->dispatchAsync = false;
@@ -50,7 +48,6 @@
     this->exclusive = false;
     this->retroactive = false;
     this->priority = 0;
-    this->additionalPredicate = NULL;
     this->networkSubscription = false;
     this->optimizedAcknowledge = false;
     this->noRangeAcks = false;
@@ -59,22 +56,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 ConsumerInfo::~ConsumerInfo() {
 
-    delete this->consumerId;
-    delete this->destination;
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        delete brokerPath[ibrokerPath];
-    }
-    delete this->additionalPredicate;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ConsumerInfo* ConsumerInfo::cloneDataStructure() const {
-    ConsumerInfo* consumerInfo = new ConsumerInfo();
+    std::auto_ptr<ConsumerInfo> consumerInfo( new ConsumerInfo() );
 
     // Copy the data from the base class or classes
     consumerInfo->copyDataStructure( this );
 
-    return consumerInfo;
+    return consumerInfo.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -95,17 +86,9 @@
             __FILE__, __LINE__,
             "ConsumerInfo::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getConsumerId() != NULL ) {
-        this->setConsumerId(
-            dynamic_cast<ConsumerId*>(
-                srcPtr->getConsumerId()->cloneDataStructure() ) );
-    }
+    this->setConsumerId( srcPtr->getConsumerId() );
     this->setBrowser( srcPtr->isBrowser() );
-    if( srcPtr->getDestination() != NULL ) {
-        this->setDestination(
-            dynamic_cast<ActiveMQDestination*>(
-                srcPtr->getDestination()->cloneDataStructure() ) );
-    }
+    this->setDestination( srcPtr->getDestination() );
     this->setPrefetchSize( srcPtr->getPrefetchSize() );
     this->setMaximumPendingMessageLimit( srcPtr->getMaximumPendingMessageLimit() );
     this->setDispatchAsync( srcPtr->isDispatchAsync() );
@@ -115,20 +98,8 @@
     this->setExclusive( srcPtr->isExclusive() );
     this->setRetroactive( srcPtr->isRetroactive() );
     this->setPriority( srcPtr->getPriority() );
-    for( size_t ibrokerPath = 0; ibrokerPath < srcPtr->getBrokerPath().size(); ++ibrokerPath ) {
-        if( srcPtr->getBrokerPath()[ibrokerPath] != NULL ) {
-            this->getBrokerPath().push_back(
-                dynamic_cast<BrokerId*>(
-                    srcPtr->getBrokerPath()[ibrokerPath]->cloneDataStructure() ) );
-        } else {
-            this->getBrokerPath().push_back( NULL );
-        }
-    }
-    if( srcPtr->getAdditionalPredicate() != NULL ) {
-        this->setAdditionalPredicate(
-            dynamic_cast<BooleanExpression*>(
-                srcPtr->getAdditionalPredicate()->cloneDataStructure() ) );
-    }
+    this->setBrokerPath( srcPtr->getBrokerPath() );
+    this->setAdditionalPredicate( srcPtr->getAdditionalPredicate() );
     this->setNetworkSubscription( srcPtr->isNetworkSubscription() );
     this->setOptimizedAcknowledge( srcPtr->isOptimizedAcknowledge() );
     this->setNoRangeAcks( srcPtr->isNoRangeAcks() );
@@ -204,7 +175,7 @@
         return false;
     }
     if( this->getConsumerId() != NULL ) {
-        if( !this->getConsumerId()->equals( valuePtr->getConsumerId() ) ) {
+        if( !this->getConsumerId()->equals( valuePtr->getConsumerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getConsumerId() != NULL ) {
@@ -214,7 +185,7 @@
         return false;
     }
     if( this->getDestination() != NULL ) {
-        if( !this->getDestination()->equals( valuePtr->getDestination() ) ) {
+        if( !this->getDestination()->equals( valuePtr->getDestination().get() ) ) {
             return false;
         }
     } else if( valuePtr->getDestination() != NULL ) {
@@ -249,7 +220,7 @@
     }
     for( size_t ibrokerPath = 0; ibrokerPath < this->getBrokerPath().size(); ++ibrokerPath ) {
         if( this->getBrokerPath()[ibrokerPath] != NULL ) {
-            if( !this->getBrokerPath()[ibrokerPath]->equals( valuePtr->getBrokerPath()[ibrokerPath] ) ) {
+            if( !this->getBrokerPath()[ibrokerPath]->equals( valuePtr->getBrokerPath()[ibrokerPath].get() ) ) {
                 return false;
             }
         } else if( valuePtr->getBrokerPath()[ibrokerPath] != NULL ) {
@@ -257,7 +228,7 @@
         }
     }
     if( this->getAdditionalPredicate() != NULL ) {
-        if( !this->getAdditionalPredicate()->equals( valuePtr->getAdditionalPredicate() ) ) {
+        if( !this->getAdditionalPredicate()->equals( valuePtr->getAdditionalPredicate().get() ) ) {
             return false;
         }
     } else if( valuePtr->getAdditionalPredicate() != NULL ) {
@@ -279,24 +250,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ConsumerInfo::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ConsumerInfo::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processConsumerInfo( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConsumerId* ConsumerInfo::getConsumerId() const {
+const decaf::lang::Pointer<ConsumerId>& ConsumerInfo::getConsumerId() const {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConsumerId* ConsumerInfo::getConsumerId() {
+decaf::lang::Pointer<ConsumerId>& ConsumerInfo::getConsumerId() {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConsumerInfo::setConsumerId( ConsumerId* consumerId ) {
+void ConsumerInfo::setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId ) {
     this->consumerId = consumerId;
 }
 
@@ -311,17 +282,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ActiveMQDestination* ConsumerInfo::getDestination() const {
+const decaf::lang::Pointer<ActiveMQDestination>& ConsumerInfo::getDestination() const {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQDestination* ConsumerInfo::getDestination() {
+decaf::lang::Pointer<ActiveMQDestination>& ConsumerInfo::getDestination() {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConsumerInfo::setDestination( ActiveMQDestination* destination ) {
+void ConsumerInfo::setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination ) {
     this->destination = destination;
 }
 
@@ -426,32 +397,32 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const std::vector<BrokerId*>& ConsumerInfo::getBrokerPath() const {
+const std::vector< decaf::lang::Pointer<BrokerId> >& ConsumerInfo::getBrokerPath() const {
     return brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<BrokerId*>& ConsumerInfo::getBrokerPath() {
+std::vector< decaf::lang::Pointer<BrokerId> >& ConsumerInfo::getBrokerPath() {
     return brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConsumerInfo::setBrokerPath( const std::vector<BrokerId*>& brokerPath ) {
+void ConsumerInfo::setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath ) {
     this->brokerPath = brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const BooleanExpression* ConsumerInfo::getAdditionalPredicate() const {
+const decaf::lang::Pointer<BooleanExpression>& ConsumerInfo::getAdditionalPredicate() const {
     return additionalPredicate;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-BooleanExpression* ConsumerInfo::getAdditionalPredicate() {
+decaf::lang::Pointer<BooleanExpression>& ConsumerInfo::getAdditionalPredicate() {
     return additionalPredicate;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ConsumerInfo::setAdditionalPredicate( BooleanExpression* additionalPredicate ) {
+void ConsumerInfo::setAdditionalPredicate( const decaf::lang::Pointer<BooleanExpression>& additionalPredicate ) {
     this->additionalPredicate = additionalPredicate;
 }
 



Mime
View raw message