You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/02/07 00:11:39 UTC

svn commit: r741774 [4/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/ ...

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.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/ProducerId.h>
 #include <activemq/commands/ActiveMQDestination.h>
 #include <activemq/commands/TransactionId.h>
@@ -57,33 +58,33 @@
 
         static const unsigned int DEFAULT_MESSAGE_SIZE = 1024;
 
-        ProducerId* producerId;
-        ActiveMQDestination* destination;
-        TransactionId* transactionId;
-        ActiveMQDestination* originalDestination;
-        MessageId* messageId;
-        TransactionId* originalTransactionId;
+        decaf::lang::Pointer<ProducerId> producerId;
+        decaf::lang::Pointer<ActiveMQDestination> destination;
+        decaf::lang::Pointer<TransactionId> transactionId;
+        decaf::lang::Pointer<ActiveMQDestination> originalDestination;
+        decaf::lang::Pointer<MessageId> messageId;
+        decaf::lang::Pointer<TransactionId> originalTransactionId;
         std::string groupID;
         int groupSequence;
         std::string correlationId;
         bool persistent;
         long long expiration;
         unsigned char priority;
-        ActiveMQDestination* replyTo;
+        decaf::lang::Pointer<ActiveMQDestination> replyTo;
         long long timestamp;
         std::string type;
         std::vector<unsigned char> content;
         std::vector<unsigned char> marshalledProperties;
-        DataStructure* dataStructure;
-        ConsumerId* targetConsumerId;
+        decaf::lang::Pointer<DataStructure> dataStructure;
+        decaf::lang::Pointer<ConsumerId> targetConsumerId;
         bool compressed;
         int redeliveryCounter;
-        std::vector<BrokerId*> brokerPath;
+        std::vector< decaf::lang::Pointer<BrokerId> > brokerPath;
         long long arrival;
         std::string userID;
         bool recievedByDFBridge;
         bool droppable;
-        std::vector<BrokerId*> cluster;
+        std::vector< decaf::lang::Pointer<BrokerId> > cluster;
         long long brokerInTime;
         long long brokerOutTime;
 
@@ -150,32 +151,32 @@
          * 
          * @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 ProducerId* getProducerId() const;
-        virtual ProducerId* getProducerId();
-        virtual void setProducerId( ProducerId* producerId );
-
-        virtual const ActiveMQDestination* getDestination() const;
-        virtual ActiveMQDestination* getDestination();
-        virtual void setDestination( ActiveMQDestination* destination );
-
-        virtual const TransactionId* getTransactionId() const;
-        virtual TransactionId* getTransactionId();
-        virtual void setTransactionId( TransactionId* transactionId );
-
-        virtual const ActiveMQDestination* getOriginalDestination() const;
-        virtual ActiveMQDestination* getOriginalDestination();
-        virtual void setOriginalDestination( ActiveMQDestination* originalDestination );
-
-        virtual const MessageId* getMessageId() const;
-        virtual MessageId* getMessageId();
-        virtual void setMessageId( MessageId* messageId );
-
-        virtual const TransactionId* getOriginalTransactionId() const;
-        virtual TransactionId* getOriginalTransactionId();
-        virtual void setOriginalTransactionId( TransactionId* originalTransactionId );
+        virtual const decaf::lang::Pointer<ProducerId>& getProducerId() const;
+        virtual decaf::lang::Pointer<ProducerId>& getProducerId();
+        virtual void setProducerId( const decaf::lang::Pointer<ProducerId>& producerId );
+
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getDestination();
+        virtual void setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination );
+
+        virtual const decaf::lang::Pointer<TransactionId>& getTransactionId() const;
+        virtual decaf::lang::Pointer<TransactionId>& getTransactionId();
+        virtual void setTransactionId( const decaf::lang::Pointer<TransactionId>& transactionId );
+
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getOriginalDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getOriginalDestination();
+        virtual void setOriginalDestination( const decaf::lang::Pointer<ActiveMQDestination>& originalDestination );
+
+        virtual const decaf::lang::Pointer<MessageId>& getMessageId() const;
+        virtual decaf::lang::Pointer<MessageId>& getMessageId();
+        virtual void setMessageId( const decaf::lang::Pointer<MessageId>& messageId );
+
+        virtual const decaf::lang::Pointer<TransactionId>& getOriginalTransactionId() const;
+        virtual decaf::lang::Pointer<TransactionId>& getOriginalTransactionId();
+        virtual void setOriginalTransactionId( const decaf::lang::Pointer<TransactionId>& originalTransactionId );
 
         virtual const std::string& getGroupID() const;
         virtual std::string& getGroupID();
@@ -197,9 +198,9 @@
         virtual unsigned char getPriority() const;
         virtual void setPriority( unsigned char priority );
 
-        virtual const ActiveMQDestination* getReplyTo() const;
-        virtual ActiveMQDestination* getReplyTo();
-        virtual void setReplyTo( ActiveMQDestination* replyTo );
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getReplyTo() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getReplyTo();
+        virtual void setReplyTo( const decaf::lang::Pointer<ActiveMQDestination>& replyTo );
 
         virtual long long getTimestamp() const;
         virtual void setTimestamp( long long timestamp );
@@ -216,13 +217,13 @@
         virtual std::vector<unsigned char>& getMarshalledProperties();
         virtual void setMarshalledProperties( const std::vector<unsigned char>& marshalledProperties );
 
-        virtual const DataStructure* getDataStructure() const;
-        virtual DataStructure* getDataStructure();
-        virtual void setDataStructure( DataStructure* dataStructure );
-
-        virtual const ConsumerId* getTargetConsumerId() const;
-        virtual ConsumerId* getTargetConsumerId();
-        virtual void setTargetConsumerId( ConsumerId* targetConsumerId );
+        virtual const decaf::lang::Pointer<DataStructure>& getDataStructure() const;
+        virtual decaf::lang::Pointer<DataStructure>& getDataStructure();
+        virtual void setDataStructure( const decaf::lang::Pointer<DataStructure>& dataStructure );
+
+        virtual const decaf::lang::Pointer<ConsumerId>& getTargetConsumerId() const;
+        virtual decaf::lang::Pointer<ConsumerId>& getTargetConsumerId();
+        virtual void setTargetConsumerId( const decaf::lang::Pointer<ConsumerId>& targetConsumerId );
 
         virtual bool isCompressed() const;
         virtual void setCompressed( bool compressed );
@@ -230,9 +231,9 @@
         virtual int getRedeliveryCounter() const;
         virtual void setRedeliveryCounter( int redeliveryCounter );
 
-        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 long long getArrival() const;
         virtual void setArrival( long long arrival );
@@ -247,9 +248,9 @@
         virtual bool isDroppable() const;
         virtual void setDroppable( bool droppable );
 
-        virtual const std::vector<BrokerId*>& getCluster() const;
-        virtual std::vector<BrokerId*>& getCluster();
-        virtual void setCluster( const std::vector<BrokerId*>& cluster );
+        virtual const std::vector< decaf::lang::Pointer<BrokerId> >& getCluster() const;
+        virtual std::vector< decaf::lang::Pointer<BrokerId> >& getCluster();
+        virtual void setCluster( const std::vector< decaf::lang::Pointer<BrokerId> >& cluster );
 
         virtual long long getBrokerInTime() const;
         virtual void setBrokerInTime( long long brokerInTime );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.cpp Fri Feb  6 23:11:28 2009
@@ -38,33 +38,23 @@
 ////////////////////////////////////////////////////////////////////////////////
 MessageAck::MessageAck() {
 
-    this->destination = NULL;
-    this->transactionId = NULL;
-    this->consumerId = NULL;
     this->ackType = 0;
-    this->firstMessageId = NULL;
-    this->lastMessageId = NULL;
     this->messageCount = 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageAck::~MessageAck() {
 
-    delete this->destination;
-    delete this->transactionId;
-    delete this->consumerId;
-    delete this->firstMessageId;
-    delete this->lastMessageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageAck* MessageAck::cloneDataStructure() const {
-    MessageAck* messageAck = new MessageAck();
+    std::auto_ptr<MessageAck> messageAck( new MessageAck() );
 
     // Copy the data from the base class or classes
     messageAck->copyDataStructure( this );
 
-    return messageAck;
+    return messageAck.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -85,32 +75,12 @@
             __FILE__, __LINE__,
             "MessageAck::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getDestination() != NULL ) {
-        this->setDestination(
-            dynamic_cast<ActiveMQDestination*>(
-                srcPtr->getDestination()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getTransactionId() != NULL ) {
-        this->setTransactionId(
-            dynamic_cast<TransactionId*>(
-                srcPtr->getTransactionId()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getConsumerId() != NULL ) {
-        this->setConsumerId(
-            dynamic_cast<ConsumerId*>(
-                srcPtr->getConsumerId()->cloneDataStructure() ) );
-    }
+    this->setDestination( srcPtr->getDestination() );
+    this->setTransactionId( srcPtr->getTransactionId() );
+    this->setConsumerId( srcPtr->getConsumerId() );
     this->setAckType( srcPtr->getAckType() );
-    if( srcPtr->getFirstMessageId() != NULL ) {
-        this->setFirstMessageId(
-            dynamic_cast<MessageId*>(
-                srcPtr->getFirstMessageId()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getLastMessageId() != NULL ) {
-        this->setLastMessageId(
-            dynamic_cast<MessageId*>(
-                srcPtr->getLastMessageId()->cloneDataStructure() ) );
-    }
+    this->setFirstMessageId( srcPtr->getFirstMessageId() );
+    this->setLastMessageId( srcPtr->getLastMessageId() );
     this->setMessageCount( srcPtr->getMessageCount() );
 }
 
@@ -177,21 +147,21 @@
         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 ) {
         return false;
     }
     if( this->getTransactionId() != NULL ) {
-        if( !this->getTransactionId()->equals( valuePtr->getTransactionId() ) ) {
+        if( !this->getTransactionId()->equals( valuePtr->getTransactionId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getTransactionId() != NULL ) {
         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 ) {
@@ -201,14 +171,14 @@
         return false;
     }
     if( this->getFirstMessageId() != NULL ) {
-        if( !this->getFirstMessageId()->equals( valuePtr->getFirstMessageId() ) ) {
+        if( !this->getFirstMessageId()->equals( valuePtr->getFirstMessageId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getFirstMessageId() != NULL ) {
         return false;
     }
     if( this->getLastMessageId() != NULL ) {
-        if( !this->getLastMessageId()->equals( valuePtr->getLastMessageId() ) ) {
+        if( !this->getLastMessageId()->equals( valuePtr->getLastMessageId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getLastMessageId() != NULL ) {
@@ -224,54 +194,54 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* MessageAck::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> MessageAck::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processMessageAck( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ActiveMQDestination* MessageAck::getDestination() const {
+const decaf::lang::Pointer<ActiveMQDestination>& MessageAck::getDestination() const {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQDestination* MessageAck::getDestination() {
+decaf::lang::Pointer<ActiveMQDestination>& MessageAck::getDestination() {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageAck::setDestination( ActiveMQDestination* destination ) {
+void MessageAck::setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination ) {
     this->destination = destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const TransactionId* MessageAck::getTransactionId() const {
+const decaf::lang::Pointer<TransactionId>& MessageAck::getTransactionId() const {
     return transactionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-TransactionId* MessageAck::getTransactionId() {
+decaf::lang::Pointer<TransactionId>& MessageAck::getTransactionId() {
     return transactionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageAck::setTransactionId( TransactionId* transactionId ) {
+void MessageAck::setTransactionId( const decaf::lang::Pointer<TransactionId>& transactionId ) {
     this->transactionId = transactionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConsumerId* MessageAck::getConsumerId() const {
+const decaf::lang::Pointer<ConsumerId>& MessageAck::getConsumerId() const {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConsumerId* MessageAck::getConsumerId() {
+decaf::lang::Pointer<ConsumerId>& MessageAck::getConsumerId() {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageAck::setConsumerId( ConsumerId* consumerId ) {
+void MessageAck::setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId ) {
     this->consumerId = consumerId;
 }
 
@@ -286,32 +256,32 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const MessageId* MessageAck::getFirstMessageId() const {
+const decaf::lang::Pointer<MessageId>& MessageAck::getFirstMessageId() const {
     return firstMessageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageId* MessageAck::getFirstMessageId() {
+decaf::lang::Pointer<MessageId>& MessageAck::getFirstMessageId() {
     return firstMessageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageAck::setFirstMessageId( MessageId* firstMessageId ) {
+void MessageAck::setFirstMessageId( const decaf::lang::Pointer<MessageId>& firstMessageId ) {
     this->firstMessageId = firstMessageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const MessageId* MessageAck::getLastMessageId() const {
+const decaf::lang::Pointer<MessageId>& MessageAck::getLastMessageId() const {
     return lastMessageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageId* MessageAck::getLastMessageId() {
+decaf::lang::Pointer<MessageId>& MessageAck::getLastMessageId() {
     return lastMessageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageAck::setLastMessageId( MessageId* lastMessageId ) {
+void MessageAck::setLastMessageId( const decaf::lang::Pointer<MessageId>& lastMessageId ) {
     this->lastMessageId = lastMessageId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.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/ActiveMQDestination.h>
 #include <activemq/commands/TransactionId.h>
 #include <activemq/commands/ConsumerId.h>
@@ -49,12 +50,12 @@
     class AMQCPP_API MessageAck : public BaseCommand {
     protected:
 
-        ActiveMQDestination* destination;
-        TransactionId* transactionId;
-        ConsumerId* consumerId;
+        decaf::lang::Pointer<ActiveMQDestination> destination;
+        decaf::lang::Pointer<TransactionId> transactionId;
+        decaf::lang::Pointer<ConsumerId> consumerId;
         unsigned char ackType;
-        MessageId* firstMessageId;
-        MessageId* lastMessageId;
+        decaf::lang::Pointer<MessageId> firstMessageId;
+        decaf::lang::Pointer<MessageId> lastMessageId;
         int messageCount;
 
     protected:
@@ -114,31 +115,31 @@
          * 
          * @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 ActiveMQDestination* getDestination() const;
-        virtual ActiveMQDestination* getDestination();
-        virtual void setDestination( ActiveMQDestination* destination );
-
-        virtual const TransactionId* getTransactionId() const;
-        virtual TransactionId* getTransactionId();
-        virtual void setTransactionId( TransactionId* transactionId );
-
-        virtual const ConsumerId* getConsumerId() const;
-        virtual ConsumerId* getConsumerId();
-        virtual void setConsumerId( ConsumerId* consumerId );
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getDestination();
+        virtual void setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination );
+
+        virtual const decaf::lang::Pointer<TransactionId>& getTransactionId() const;
+        virtual decaf::lang::Pointer<TransactionId>& getTransactionId();
+        virtual void setTransactionId( const decaf::lang::Pointer<TransactionId>& transactionId );
+
+        virtual const decaf::lang::Pointer<ConsumerId>& getConsumerId() const;
+        virtual decaf::lang::Pointer<ConsumerId>& getConsumerId();
+        virtual void setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId );
 
         virtual unsigned char getAckType() const;
         virtual void setAckType( unsigned char ackType );
 
-        virtual const MessageId* getFirstMessageId() const;
-        virtual MessageId* getFirstMessageId();
-        virtual void setFirstMessageId( MessageId* firstMessageId );
-
-        virtual const MessageId* getLastMessageId() const;
-        virtual MessageId* getLastMessageId();
-        virtual void setLastMessageId( MessageId* lastMessageId );
+        virtual const decaf::lang::Pointer<MessageId>& getFirstMessageId() const;
+        virtual decaf::lang::Pointer<MessageId>& getFirstMessageId();
+        virtual void setFirstMessageId( const decaf::lang::Pointer<MessageId>& firstMessageId );
+
+        virtual const decaf::lang::Pointer<MessageId>& getLastMessageId() const;
+        virtual decaf::lang::Pointer<MessageId>& getLastMessageId();
+        virtual void setLastMessageId( const decaf::lang::Pointer<MessageId>& lastMessageId );
 
         virtual int getMessageCount() const;
         virtual void setMessageCount( int messageCount );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.cpp Fri Feb  6 23:11:28 2009
@@ -38,28 +38,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 MessageDispatch::MessageDispatch() {
 
-    this->consumerId = NULL;
-    this->destination = NULL;
-    this->message = NULL;
     this->redeliveryCounter = 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageDispatch::~MessageDispatch() {
 
-    delete this->consumerId;
-    delete this->destination;
-    delete this->message;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageDispatch* MessageDispatch::cloneDataStructure() const {
-    MessageDispatch* messageDispatch = new MessageDispatch();
+    std::auto_ptr<MessageDispatch> messageDispatch( new MessageDispatch() );
 
     // Copy the data from the base class or classes
     messageDispatch->copyDataStructure( this );
 
-    return messageDispatch;
+    return messageDispatch.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -80,21 +74,9 @@
             __FILE__, __LINE__,
             "MessageDispatch::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getConsumerId() != NULL ) {
-        this->setConsumerId(
-            dynamic_cast<ConsumerId*>(
-                srcPtr->getConsumerId()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getDestination() != NULL ) {
-        this->setDestination(
-            dynamic_cast<ActiveMQDestination*>(
-                srcPtr->getDestination()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getMessage() != NULL ) {
-        this->setMessage(
-            dynamic_cast<Message*>(
-                srcPtr->getMessage()->cloneDataStructure() ) );
-    }
+    this->setConsumerId( srcPtr->getConsumerId() );
+    this->setDestination( srcPtr->getDestination() );
+    this->setMessage( srcPtr->getMessage() );
     this->setRedeliveryCounter( srcPtr->getRedeliveryCounter() );
 }
 
@@ -148,21 +130,21 @@
         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 ) {
         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 ) {
         return false;
     }
     if( this->getMessage() != NULL ) {
-        if( !this->getMessage()->equals( valuePtr->getMessage() ) ) {
+        if( !this->getMessage()->equals( valuePtr->getMessage().get() ) ) {
             return false;
         }
     } else if( valuePtr->getMessage() != NULL ) {
@@ -178,54 +160,54 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* MessageDispatch::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> MessageDispatch::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processMessageDispatch( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConsumerId* MessageDispatch::getConsumerId() const {
+const decaf::lang::Pointer<ConsumerId>& MessageDispatch::getConsumerId() const {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConsumerId* MessageDispatch::getConsumerId() {
+decaf::lang::Pointer<ConsumerId>& MessageDispatch::getConsumerId() {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatch::setConsumerId( ConsumerId* consumerId ) {
+void MessageDispatch::setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId ) {
     this->consumerId = consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ActiveMQDestination* MessageDispatch::getDestination() const {
+const decaf::lang::Pointer<ActiveMQDestination>& MessageDispatch::getDestination() const {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQDestination* MessageDispatch::getDestination() {
+decaf::lang::Pointer<ActiveMQDestination>& MessageDispatch::getDestination() {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatch::setDestination( ActiveMQDestination* destination ) {
+void MessageDispatch::setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination ) {
     this->destination = destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const Message* MessageDispatch::getMessage() const {
+const decaf::lang::Pointer<Message>& MessageDispatch::getMessage() const {
     return message;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-Message* MessageDispatch::getMessage() {
+decaf::lang::Pointer<Message>& MessageDispatch::getMessage() {
     return message;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatch::setMessage( Message* message ) {
+void MessageDispatch::setMessage( const decaf::lang::Pointer<Message>& message ) {
     this->message = message;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.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 <activemq/commands/ActiveMQDestination.h>
 #include <activemq/commands/Message.h>
@@ -47,9 +48,9 @@
     class AMQCPP_API MessageDispatch : public BaseCommand {
     protected:
 
-        ConsumerId* consumerId;
-        ActiveMQDestination* destination;
-        Message* message;
+        decaf::lang::Pointer<ConsumerId> consumerId;
+        decaf::lang::Pointer<ActiveMQDestination> destination;
+        decaf::lang::Pointer<Message> message;
         int redeliveryCounter;
 
     protected:
@@ -109,20 +110,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 ConsumerId* getConsumerId() const;
-        virtual ConsumerId* getConsumerId();
-        virtual void setConsumerId( ConsumerId* consumerId );
-
-        virtual const ActiveMQDestination* getDestination() const;
-        virtual ActiveMQDestination* getDestination();
-        virtual void setDestination( ActiveMQDestination* destination );
-
-        virtual const Message* getMessage() const;
-        virtual Message* getMessage();
-        virtual void setMessage( Message* message );
+        virtual const decaf::lang::Pointer<ConsumerId>& getConsumerId() const;
+        virtual decaf::lang::Pointer<ConsumerId>& getConsumerId();
+        virtual void setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId );
+
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getDestination();
+        virtual void setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination );
+
+        virtual const decaf::lang::Pointer<Message>& getMessage() const;
+        virtual decaf::lang::Pointer<Message>& getMessage();
+        virtual void setMessage( const decaf::lang::Pointer<Message>& message );
 
         virtual int getRedeliveryCounter() const;
         virtual void setRedeliveryCounter( int redeliveryCounter );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.cpp Fri Feb  6 23:11:28 2009
@@ -38,28 +38,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 MessageDispatchNotification::MessageDispatchNotification() {
 
-    this->consumerId = NULL;
-    this->destination = NULL;
     this->deliverySequenceId = 0;
-    this->messageId = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageDispatchNotification::~MessageDispatchNotification() {
 
-    delete this->consumerId;
-    delete this->destination;
-    delete this->messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageDispatchNotification* MessageDispatchNotification::cloneDataStructure() const {
-    MessageDispatchNotification* messageDispatchNotification = new MessageDispatchNotification();
+    std::auto_ptr<MessageDispatchNotification> messageDispatchNotification( new MessageDispatchNotification() );
 
     // Copy the data from the base class or classes
     messageDispatchNotification->copyDataStructure( this );
 
-    return messageDispatchNotification;
+    return messageDispatchNotification.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -80,22 +74,10 @@
             __FILE__, __LINE__,
             "MessageDispatchNotification::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getConsumerId() != NULL ) {
-        this->setConsumerId(
-            dynamic_cast<ConsumerId*>(
-                srcPtr->getConsumerId()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getDestination() != NULL ) {
-        this->setDestination(
-            dynamic_cast<ActiveMQDestination*>(
-                srcPtr->getDestination()->cloneDataStructure() ) );
-    }
+    this->setConsumerId( srcPtr->getConsumerId() );
+    this->setDestination( srcPtr->getDestination() );
     this->setDeliverySequenceId( srcPtr->getDeliverySequenceId() );
-    if( srcPtr->getMessageId() != NULL ) {
-        this->setMessageId(
-            dynamic_cast<MessageId*>(
-                srcPtr->getMessageId()->cloneDataStructure() ) );
-    }
+    this->setMessageId( srcPtr->getMessageId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -148,14 +130,14 @@
         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 ) {
         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 ) {
@@ -165,7 +147,7 @@
         return false;
     }
     if( this->getMessageId() != NULL ) {
-        if( !this->getMessageId()->equals( valuePtr->getMessageId() ) ) {
+        if( !this->getMessageId()->equals( valuePtr->getMessageId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getMessageId() != NULL ) {
@@ -178,39 +160,39 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* MessageDispatchNotification::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> MessageDispatchNotification::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processMessageDispatchNotification( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConsumerId* MessageDispatchNotification::getConsumerId() const {
+const decaf::lang::Pointer<ConsumerId>& MessageDispatchNotification::getConsumerId() const {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConsumerId* MessageDispatchNotification::getConsumerId() {
+decaf::lang::Pointer<ConsumerId>& MessageDispatchNotification::getConsumerId() {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatchNotification::setConsumerId( ConsumerId* consumerId ) {
+void MessageDispatchNotification::setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId ) {
     this->consumerId = consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ActiveMQDestination* MessageDispatchNotification::getDestination() const {
+const decaf::lang::Pointer<ActiveMQDestination>& MessageDispatchNotification::getDestination() const {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQDestination* MessageDispatchNotification::getDestination() {
+decaf::lang::Pointer<ActiveMQDestination>& MessageDispatchNotification::getDestination() {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatchNotification::setDestination( ActiveMQDestination* destination ) {
+void MessageDispatchNotification::setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination ) {
     this->destination = destination;
 }
 
@@ -225,17 +207,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const MessageId* MessageDispatchNotification::getMessageId() const {
+const decaf::lang::Pointer<MessageId>& MessageDispatchNotification::getMessageId() const {
     return messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageId* MessageDispatchNotification::getMessageId() {
+decaf::lang::Pointer<MessageId>& MessageDispatchNotification::getMessageId() {
     return messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatchNotification::setMessageId( MessageId* messageId ) {
+void MessageDispatchNotification::setMessageId( const decaf::lang::Pointer<MessageId>& messageId ) {
     this->messageId = messageId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.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 <activemq/commands/ActiveMQDestination.h>
 #include <activemq/commands/MessageId.h>
@@ -47,10 +48,10 @@
     class AMQCPP_API MessageDispatchNotification : public BaseCommand {
     protected:
 
-        ConsumerId* consumerId;
-        ActiveMQDestination* destination;
+        decaf::lang::Pointer<ConsumerId> consumerId;
+        decaf::lang::Pointer<ActiveMQDestination> destination;
         long long deliverySequenceId;
-        MessageId* messageId;
+        decaf::lang::Pointer<MessageId> messageId;
 
     protected:
 
@@ -109,23 +110,23 @@
          * 
          * @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 ConsumerId* getConsumerId() const;
-        virtual ConsumerId* getConsumerId();
-        virtual void setConsumerId( ConsumerId* consumerId );
-
-        virtual const ActiveMQDestination* getDestination() const;
-        virtual ActiveMQDestination* getDestination();
-        virtual void setDestination( ActiveMQDestination* destination );
+        virtual const decaf::lang::Pointer<ConsumerId>& getConsumerId() const;
+        virtual decaf::lang::Pointer<ConsumerId>& getConsumerId();
+        virtual void setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId );
+
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getDestination();
+        virtual void setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination );
 
         virtual long long getDeliverySequenceId() const;
         virtual void setDeliverySequenceId( long long deliverySequenceId );
 
-        virtual const MessageId* getMessageId() const;
-        virtual MessageId* getMessageId();
-        virtual void setMessageId( MessageId* messageId );
+        virtual const decaf::lang::Pointer<MessageId>& getMessageId() const;
+        virtual decaf::lang::Pointer<MessageId>& getMessageId();
+        virtual void setMessageId( const decaf::lang::Pointer<MessageId>& messageId );
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.cpp Fri Feb  6 23:11:28 2009
@@ -39,7 +39,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 MessageId::MessageId() {
 
-    this->producerId = NULL;
     this->producerSequenceId = 0;
     this->brokerSequenceId = 0;
 }
@@ -52,17 +51,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 MessageId::~MessageId() {
 
-    delete this->producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessageId* MessageId::cloneDataStructure() const {
-    MessageId* messageId = new MessageId();
+    std::auto_ptr<MessageId> messageId( new MessageId() );
 
     // Copy the data from the base class or classes
     messageId->copyDataStructure( this );
 
-    return messageId;
+    return messageId.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -83,11 +81,7 @@
             __FILE__, __LINE__,
             "MessageId::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getProducerId() != NULL ) {
-        this->setProducerId(
-            dynamic_cast<ProducerId*>(
-                srcPtr->getProducerId()->cloneDataStructure() ) );
-    }
+    this->setProducerId( srcPtr->getProducerId() );
     this->setProducerSequenceId( srcPtr->getProducerSequenceId() );
     this->setBrokerSequenceId( srcPtr->getBrokerSequenceId() );
 }
@@ -131,7 +125,7 @@
         return false;
     }
     if( this->getProducerId() != NULL ) {
-        if( !this->getProducerId()->equals( valuePtr->getProducerId() ) ) {
+        if( !this->getProducerId()->equals( valuePtr->getProducerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getProducerId() != NULL ) {
@@ -150,17 +144,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ProducerId* MessageId::getProducerId() const {
+const decaf::lang::Pointer<ProducerId>& MessageId::getProducerId() const {
     return producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ProducerId* MessageId::getProducerId() {
+decaf::lang::Pointer<ProducerId>& MessageId::getProducerId() {
     return producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageId::setProducerId( ProducerId* producerId ) {
+void MessageId::setProducerId( const decaf::lang::Pointer<ProducerId>& producerId ) {
     this->producerId = producerId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.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 <activemq/commands/ProducerId.h>
 #include <vector>
@@ -46,7 +47,7 @@
     class AMQCPP_API MessageId : public BaseDataStructure, public decaf::lang::Comparable<MessageId> {
     protected:
 
-        ProducerId* producerId;
+        decaf::lang::Pointer<ProducerId> producerId;
         long long producerSequenceId;
         long long brokerSequenceId;
 
@@ -54,6 +55,8 @@
 
         const static unsigned char ID_MESSAGEID = 110;
 
+        typedef decaf::lang::PointerComparator<MessageId> COMPARATOR;
+
     public:
 
         MessageId();
@@ -96,9 +99,9 @@
          */
         virtual bool equals( const DataStructure* value ) const;
 
-        virtual const ProducerId* getProducerId() const;
-        virtual ProducerId* getProducerId();
-        virtual void setProducerId( ProducerId* producerId );
+        virtual const decaf::lang::Pointer<ProducerId>& getProducerId() const;
+        virtual decaf::lang::Pointer<ProducerId>& getProducerId();
+        virtual void setProducerId( const decaf::lang::Pointer<ProducerId>& producerId );
 
         virtual long long getProducerSequenceId() const;
         virtual void setProducerSequenceId( long long producerSequenceId );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.cpp Fri Feb  6 23:11:28 2009
@@ -38,29 +38,23 @@
 ////////////////////////////////////////////////////////////////////////////////
 MessagePull::MessagePull() {
 
-    this->consumerId = NULL;
-    this->destination = NULL;
     this->timeout = 0;
     this->correlationId = "";
-    this->messageId = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessagePull::~MessagePull() {
 
-    delete this->consumerId;
-    delete this->destination;
-    delete this->messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 MessagePull* MessagePull::cloneDataStructure() const {
-    MessagePull* messagePull = new MessagePull();
+    std::auto_ptr<MessagePull> messagePull( new MessagePull() );
 
     // Copy the data from the base class or classes
     messagePull->copyDataStructure( this );
 
-    return messagePull;
+    return messagePull.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -81,23 +75,11 @@
             __FILE__, __LINE__,
             "MessagePull::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getConsumerId() != NULL ) {
-        this->setConsumerId(
-            dynamic_cast<ConsumerId*>(
-                srcPtr->getConsumerId()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getDestination() != NULL ) {
-        this->setDestination(
-            dynamic_cast<ActiveMQDestination*>(
-                srcPtr->getDestination()->cloneDataStructure() ) );
-    }
+    this->setConsumerId( srcPtr->getConsumerId() );
+    this->setDestination( srcPtr->getDestination() );
     this->setTimeout( srcPtr->getTimeout() );
     this->setCorrelationId( srcPtr->getCorrelationId() );
-    if( srcPtr->getMessageId() != NULL ) {
-        this->setMessageId(
-            dynamic_cast<MessageId*>(
-                srcPtr->getMessageId()->cloneDataStructure() ) );
-    }
+    this->setMessageId( srcPtr->getMessageId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -151,14 +133,14 @@
         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 ) {
         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 ) {
@@ -171,7 +153,7 @@
         return false;
     }
     if( this->getMessageId() != NULL ) {
-        if( !this->getMessageId()->equals( valuePtr->getMessageId() ) ) {
+        if( !this->getMessageId()->equals( valuePtr->getMessageId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getMessageId() != NULL ) {
@@ -184,39 +166,39 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* MessagePull::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> MessagePull::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processMessagePull( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConsumerId* MessagePull::getConsumerId() const {
+const decaf::lang::Pointer<ConsumerId>& MessagePull::getConsumerId() const {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConsumerId* MessagePull::getConsumerId() {
+decaf::lang::Pointer<ConsumerId>& MessagePull::getConsumerId() {
     return consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessagePull::setConsumerId( ConsumerId* consumerId ) {
+void MessagePull::setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId ) {
     this->consumerId = consumerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ActiveMQDestination* MessagePull::getDestination() const {
+const decaf::lang::Pointer<ActiveMQDestination>& MessagePull::getDestination() const {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQDestination* MessagePull::getDestination() {
+decaf::lang::Pointer<ActiveMQDestination>& MessagePull::getDestination() {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessagePull::setDestination( ActiveMQDestination* destination ) {
+void MessagePull::setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination ) {
     this->destination = destination;
 }
 
@@ -246,17 +228,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const MessageId* MessagePull::getMessageId() const {
+const decaf::lang::Pointer<MessageId>& MessagePull::getMessageId() const {
     return messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageId* MessagePull::getMessageId() {
+decaf::lang::Pointer<MessageId>& MessagePull::getMessageId() {
     return messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessagePull::setMessageId( MessageId* messageId ) {
+void MessagePull::setMessageId( const decaf::lang::Pointer<MessageId>& messageId ) {
     this->messageId = messageId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.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 <activemq/commands/ActiveMQDestination.h>
 #include <activemq/commands/MessageId.h>
@@ -47,11 +48,11 @@
     class AMQCPP_API MessagePull : public BaseCommand {
     protected:
 
-        ConsumerId* consumerId;
-        ActiveMQDestination* destination;
+        decaf::lang::Pointer<ConsumerId> consumerId;
+        decaf::lang::Pointer<ActiveMQDestination> destination;
         long long timeout;
         std::string correlationId;
-        MessageId* messageId;
+        decaf::lang::Pointer<MessageId> messageId;
 
     protected:
 
@@ -110,16 +111,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 ConsumerId* getConsumerId() const;
-        virtual ConsumerId* getConsumerId();
-        virtual void setConsumerId( ConsumerId* consumerId );
-
-        virtual const ActiveMQDestination* getDestination() const;
-        virtual ActiveMQDestination* getDestination();
-        virtual void setDestination( ActiveMQDestination* destination );
+        virtual const decaf::lang::Pointer<ConsumerId>& getConsumerId() const;
+        virtual decaf::lang::Pointer<ConsumerId>& getConsumerId();
+        virtual void setConsumerId( const decaf::lang::Pointer<ConsumerId>& consumerId );
+
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getDestination();
+        virtual void setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination );
 
         virtual long long getTimeout() const;
         virtual void setTimeout( long long timeout );
@@ -128,9 +129,9 @@
         virtual std::string& getCorrelationId();
         virtual void setCorrelationId( const std::string& correlationId );
 
-        virtual const MessageId* getMessageId() const;
-        virtual MessageId* getMessageId();
-        virtual void setMessageId( MessageId* messageId );
+        virtual const decaf::lang::Pointer<MessageId>& getMessageId() const;
+        virtual decaf::lang::Pointer<MessageId>& getMessageId();
+        virtual void setMessageId( const decaf::lang::Pointer<MessageId>& messageId );
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.cpp Fri Feb  6 23:11:28 2009
@@ -39,23 +39,21 @@
 NetworkBridgeFilter::NetworkBridgeFilter() {
 
     this->networkTTL = 0;
-    this->networkBrokerId = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 NetworkBridgeFilter::~NetworkBridgeFilter() {
 
-    delete this->networkBrokerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 NetworkBridgeFilter* NetworkBridgeFilter::cloneDataStructure() const {
-    NetworkBridgeFilter* networkBridgeFilter = new NetworkBridgeFilter();
+    std::auto_ptr<NetworkBridgeFilter> networkBridgeFilter( new NetworkBridgeFilter() );
 
     // Copy the data from the base class or classes
     networkBridgeFilter->copyDataStructure( this );
 
-    return networkBridgeFilter;
+    return networkBridgeFilter.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -77,11 +75,7 @@
             "NetworkBridgeFilter::copyDataStructure - src is NULL or invalid" );
     }
     this->setNetworkTTL( srcPtr->getNetworkTTL() );
-    if( srcPtr->getNetworkBrokerId() != NULL ) {
-        this->setNetworkBrokerId(
-            dynamic_cast<BrokerId*>(
-                srcPtr->getNetworkBrokerId()->cloneDataStructure() ) );
-    }
+    this->setNetworkBrokerId( srcPtr->getNetworkBrokerId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -125,7 +119,7 @@
         return false;
     }
     if( this->getNetworkBrokerId() != NULL ) {
-        if( !this->getNetworkBrokerId()->equals( valuePtr->getNetworkBrokerId() ) ) {
+        if( !this->getNetworkBrokerId()->equals( valuePtr->getNetworkBrokerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getNetworkBrokerId() != NULL ) {
@@ -148,17 +142,17 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const BrokerId* NetworkBridgeFilter::getNetworkBrokerId() const {
+const decaf::lang::Pointer<BrokerId>& NetworkBridgeFilter::getNetworkBrokerId() const {
     return networkBrokerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-BrokerId* NetworkBridgeFilter::getNetworkBrokerId() {
+decaf::lang::Pointer<BrokerId>& NetworkBridgeFilter::getNetworkBrokerId() {
     return networkBrokerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void NetworkBridgeFilter::setNetworkBrokerId( BrokerId* networkBrokerId ) {
+void NetworkBridgeFilter::setNetworkBrokerId( const decaf::lang::Pointer<BrokerId>& networkBrokerId ) {
     this->networkBrokerId = networkBrokerId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.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 <activemq/commands/BrokerId.h>
 #include <vector>
 #include <string>
@@ -46,7 +47,7 @@
     protected:
 
         int networkTTL;
-        BrokerId* networkBrokerId;
+        decaf::lang::Pointer<BrokerId> networkBrokerId;
 
     protected:
 
@@ -101,9 +102,9 @@
         virtual int getNetworkTTL() const;
         virtual void setNetworkTTL( int networkTTL );
 
-        virtual const BrokerId* getNetworkBrokerId() const;
-        virtual BrokerId* getNetworkBrokerId();
-        virtual void setNetworkBrokerId( BrokerId* networkBrokerId );
+        virtual const decaf::lang::Pointer<BrokerId>& getNetworkBrokerId() const;
+        virtual decaf::lang::Pointer<BrokerId>& getNetworkBrokerId();
+        virtual void setNetworkBrokerId( const decaf::lang::Pointer<BrokerId>& networkBrokerId );
 
     };
 

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

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/PartialCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/PartialCommand.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/PartialCommand.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/PartialCommand.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 <vector>
 #include <string>
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.cpp Fri Feb  6 23:11:28 2009
@@ -38,24 +38,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 ProducerAck::ProducerAck() {
 
-    this->producerId = NULL;
     this->size = 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ProducerAck::~ProducerAck() {
 
-    delete this->producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ProducerAck* ProducerAck::cloneDataStructure() const {
-    ProducerAck* producerAck = new ProducerAck();
+    std::auto_ptr<ProducerAck> producerAck( new ProducerAck() );
 
     // Copy the data from the base class or classes
     producerAck->copyDataStructure( this );
 
-    return producerAck;
+    return producerAck.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -76,11 +74,7 @@
             __FILE__, __LINE__,
             "ProducerAck::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getProducerId() != NULL ) {
-        this->setProducerId(
-            dynamic_cast<ProducerId*>(
-                srcPtr->getProducerId()->cloneDataStructure() ) );
-    }
+    this->setProducerId( srcPtr->getProducerId() );
     this->setSize( srcPtr->getSize() );
 }
 
@@ -122,7 +116,7 @@
         return false;
     }
     if( this->getProducerId() != NULL ) {
-        if( !this->getProducerId()->equals( valuePtr->getProducerId() ) ) {
+        if( !this->getProducerId()->equals( valuePtr->getProducerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getProducerId() != NULL ) {
@@ -138,24 +132,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ProducerAck::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ProducerAck::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processProducerAck( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ProducerId* ProducerAck::getProducerId() const {
+const decaf::lang::Pointer<ProducerId>& ProducerAck::getProducerId() const {
     return producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ProducerId* ProducerAck::getProducerId() {
+decaf::lang::Pointer<ProducerId>& ProducerAck::getProducerId() {
     return producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ProducerAck::setProducerId( ProducerId* producerId ) {
+void ProducerAck::setProducerId( const decaf::lang::Pointer<ProducerId>& producerId ) {
     this->producerId = producerId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.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/ProducerId.h>
 #include <vector>
 #include <string>
@@ -45,7 +46,7 @@
     class AMQCPP_API ProducerAck : public BaseCommand {
     protected:
 
-        ProducerId* producerId;
+        decaf::lang::Pointer<ProducerId> producerId;
         int size;
 
     protected:
@@ -105,12 +106,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 ProducerId* getProducerId() const;
-        virtual ProducerId* getProducerId();
-        virtual void setProducerId( ProducerId* producerId );
+        virtual const decaf::lang::Pointer<ProducerId>& getProducerId() const;
+        virtual decaf::lang::Pointer<ProducerId>& getProducerId();
+        virtual void setProducerId( const decaf::lang::Pointer<ProducerId>& producerId );
 
         virtual int getSize() const;
         virtual void setSize( int size );

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

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerId.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerId.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerId.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerId.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_PRODUCERID = 123;
 
+        typedef decaf::lang::PointerComparator<ProducerId> COMPARATOR;
+
     public:
 
         ProducerId();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.cpp Fri Feb  6 23:11:28 2009
@@ -38,8 +38,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 ProducerInfo::ProducerInfo() {
 
-    this->producerId = NULL;
-    this->destination = NULL;
     this->dispatchAsync = false;
     this->windowSize = 0;
 }
@@ -47,21 +45,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 ProducerInfo::~ProducerInfo() {
 
-    delete this->producerId;
-    delete this->destination;
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        delete brokerPath[ibrokerPath];
-    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ProducerInfo* ProducerInfo::cloneDataStructure() const {
-    ProducerInfo* producerInfo = new ProducerInfo();
+    std::auto_ptr<ProducerInfo> producerInfo( new ProducerInfo() );
 
     // Copy the data from the base class or classes
     producerInfo->copyDataStructure( this );
 
-    return producerInfo;
+    return producerInfo.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -82,25 +75,9 @@
             __FILE__, __LINE__,
             "ProducerInfo::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getProducerId() != NULL ) {
-        this->setProducerId(
-            dynamic_cast<ProducerId*>(
-                srcPtr->getProducerId()->cloneDataStructure() ) );
-    }
-    if( srcPtr->getDestination() != NULL ) {
-        this->setDestination(
-            dynamic_cast<ActiveMQDestination*>(
-                srcPtr->getDestination()->cloneDataStructure() ) );
-    }
-    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->setProducerId( srcPtr->getProducerId() );
+    this->setDestination( srcPtr->getDestination() );
+    this->setBrokerPath( srcPtr->getBrokerPath() );
     this->setDispatchAsync( srcPtr->isDispatchAsync() );
     this->setWindowSize( srcPtr->getWindowSize() );
 }
@@ -158,14 +135,14 @@
         return false;
     }
     if( this->getProducerId() != NULL ) {
-        if( !this->getProducerId()->equals( valuePtr->getProducerId() ) ) {
+        if( !this->getProducerId()->equals( valuePtr->getProducerId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getProducerId() != NULL ) {
         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 ) {
@@ -173,7 +150,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 ) {
@@ -193,54 +170,54 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* ProducerInfo::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> ProducerInfo::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processProducerInfo( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ProducerId* ProducerInfo::getProducerId() const {
+const decaf::lang::Pointer<ProducerId>& ProducerInfo::getProducerId() const {
     return producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ProducerId* ProducerInfo::getProducerId() {
+decaf::lang::Pointer<ProducerId>& ProducerInfo::getProducerId() {
     return producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ProducerInfo::setProducerId( ProducerId* producerId ) {
+void ProducerInfo::setProducerId( const decaf::lang::Pointer<ProducerId>& producerId ) {
     this->producerId = producerId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ActiveMQDestination* ProducerInfo::getDestination() const {
+const decaf::lang::Pointer<ActiveMQDestination>& ProducerInfo::getDestination() const {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQDestination* ProducerInfo::getDestination() {
+decaf::lang::Pointer<ActiveMQDestination>& ProducerInfo::getDestination() {
     return destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ProducerInfo::setDestination( ActiveMQDestination* destination ) {
+void ProducerInfo::setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination ) {
     this->destination = destination;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const std::vector<BrokerId*>& ProducerInfo::getBrokerPath() const {
+const std::vector< decaf::lang::Pointer<BrokerId> >& ProducerInfo::getBrokerPath() const {
     return brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::vector<BrokerId*>& ProducerInfo::getBrokerPath() {
+std::vector< decaf::lang::Pointer<BrokerId> >& ProducerInfo::getBrokerPath() {
     return brokerPath;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ProducerInfo::setBrokerPath( const std::vector<BrokerId*>& brokerPath ) {
+void ProducerInfo::setBrokerPath( const std::vector< decaf::lang::Pointer<BrokerId> >& brokerPath ) {
     this->brokerPath = brokerPath;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.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/ProducerId.h>
 #include <activemq/commands/ActiveMQDestination.h>
 #include <activemq/commands/BrokerId.h>
@@ -47,9 +48,9 @@
     class AMQCPP_API ProducerInfo : public BaseCommand {
     protected:
 
-        ProducerId* producerId;
-        ActiveMQDestination* destination;
-        std::vector<BrokerId*> brokerPath;
+        decaf::lang::Pointer<ProducerId> producerId;
+        decaf::lang::Pointer<ActiveMQDestination> destination;
+        std::vector< decaf::lang::Pointer<BrokerId> > brokerPath;
         bool dispatchAsync;
         int windowSize;
 
@@ -110,20 +111,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 ProducerId* getProducerId() const;
-        virtual ProducerId* getProducerId();
-        virtual void setProducerId( ProducerId* producerId );
-
-        virtual const ActiveMQDestination* getDestination() const;
-        virtual ActiveMQDestination* getDestination();
-        virtual void setDestination( ActiveMQDestination* destination );
-
-        virtual const std::vector<BrokerId*>& getBrokerPath() const;
-        virtual std::vector<BrokerId*>& getBrokerPath();
-        virtual void setBrokerPath( const std::vector<BrokerId*>& brokerPath );
+        virtual const decaf::lang::Pointer<ProducerId>& getProducerId() const;
+        virtual decaf::lang::Pointer<ProducerId>& getProducerId();
+        virtual void setProducerId( const decaf::lang::Pointer<ProducerId>& producerId );
+
+        virtual const decaf::lang::Pointer<ActiveMQDestination>& getDestination() const;
+        virtual decaf::lang::Pointer<ActiveMQDestination>& getDestination();
+        virtual void setDestination( const decaf::lang::Pointer<ActiveMQDestination>& destination );
+
+        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 isDispatchAsync() const;
         virtual void setDispatchAsync( bool dispatchAsync );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.cpp Fri Feb  6 23:11:28 2009
@@ -38,23 +38,21 @@
 ////////////////////////////////////////////////////////////////////////////////
 RemoveInfo::RemoveInfo() {
 
-    this->objectId = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 RemoveInfo::~RemoveInfo() {
 
-    delete this->objectId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 RemoveInfo* RemoveInfo::cloneDataStructure() const {
-    RemoveInfo* removeInfo = new RemoveInfo();
+    std::auto_ptr<RemoveInfo> removeInfo( new RemoveInfo() );
 
     // Copy the data from the base class or classes
     removeInfo->copyDataStructure( this );
 
-    return removeInfo;
+    return removeInfo.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -75,11 +73,7 @@
             __FILE__, __LINE__,
             "RemoveInfo::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getObjectId() != NULL ) {
-        this->setObjectId(
-            dynamic_cast<DataStructure*>(
-                srcPtr->getObjectId()->cloneDataStructure() ) );
-    }
+    this->setObjectId( srcPtr->getObjectId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -119,7 +113,7 @@
         return false;
     }
     if( this->getObjectId() != NULL ) {
-        if( !this->getObjectId()->equals( valuePtr->getObjectId() ) ) {
+        if( !this->getObjectId()->equals( valuePtr->getObjectId().get() ) ) {
             return false;
         }
     } else if( valuePtr->getObjectId() != NULL ) {
@@ -132,24 +126,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* RemoveInfo::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> RemoveInfo::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processRemoveInfo( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const DataStructure* RemoveInfo::getObjectId() const {
+const decaf::lang::Pointer<DataStructure>& RemoveInfo::getObjectId() const {
     return objectId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-DataStructure* RemoveInfo::getObjectId() {
+decaf::lang::Pointer<DataStructure>& RemoveInfo::getObjectId() {
     return objectId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void RemoveInfo::setObjectId( DataStructure* objectId ) {
+void RemoveInfo::setObjectId( const decaf::lang::Pointer<DataStructure>& objectId ) {
     this->objectId = objectId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.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/DataStructure.h>
 #include <vector>
 #include <string>
@@ -45,7 +46,7 @@
     class AMQCPP_API RemoveInfo : public BaseCommand {
     protected:
 
-        DataStructure* objectId;
+        decaf::lang::Pointer<DataStructure> objectId;
 
     protected:
 
@@ -104,12 +105,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 DataStructure* getObjectId() const;
-        virtual DataStructure* getObjectId();
-        virtual void setObjectId( DataStructure* objectId );
+        virtual const decaf::lang::Pointer<DataStructure>& getObjectId() const;
+        virtual decaf::lang::Pointer<DataStructure>& getObjectId();
+        virtual void setObjectId( const decaf::lang::Pointer<DataStructure>& objectId );
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.cpp?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.cpp Fri Feb  6 23:11:28 2009
@@ -38,7 +38,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 RemoveSubscriptionInfo::RemoveSubscriptionInfo() {
 
-    this->connectionId = NULL;
     this->subcriptionName = "";
     this->clientId = "";
 }
@@ -46,17 +45,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 RemoveSubscriptionInfo::~RemoveSubscriptionInfo() {
 
-    delete this->connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 RemoveSubscriptionInfo* RemoveSubscriptionInfo::cloneDataStructure() const {
-    RemoveSubscriptionInfo* removeSubscriptionInfo = new RemoveSubscriptionInfo();
+    std::auto_ptr<RemoveSubscriptionInfo> removeSubscriptionInfo( new RemoveSubscriptionInfo() );
 
     // Copy the data from the base class or classes
     removeSubscriptionInfo->copyDataStructure( this );
 
-    return removeSubscriptionInfo;
+    return removeSubscriptionInfo.release();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -77,11 +75,7 @@
             __FILE__, __LINE__,
             "RemoveSubscriptionInfo::copyDataStructure - src is NULL or invalid" );
     }
-    if( srcPtr->getConnectionId() != NULL ) {
-        this->setConnectionId(
-            dynamic_cast<ConnectionId*>(
-                srcPtr->getConnectionId()->cloneDataStructure() ) );
-    }
+    this->setConnectionId( srcPtr->getConnectionId() );
     this->setSubcriptionName( srcPtr->getSubcriptionName() );
     this->setClientId( srcPtr->getClientId() );
 }
@@ -125,7 +119,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 ) {
@@ -144,24 +138,24 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-commands::Command* RemoveSubscriptionInfo::visit( activemq::state::CommandVisitor* visitor ) 
+decaf::lang::Pointer<commands::Command> RemoveSubscriptionInfo::visit( activemq::state::CommandVisitor* visitor ) 
     throw( exceptions::ActiveMQException ) {
 
     return visitor->processRemoveSubscriptionInfo( this );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const ConnectionId* RemoveSubscriptionInfo::getConnectionId() const {
+const decaf::lang::Pointer<ConnectionId>& RemoveSubscriptionInfo::getConnectionId() const {
     return connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ConnectionId* RemoveSubscriptionInfo::getConnectionId() {
+decaf::lang::Pointer<ConnectionId>& RemoveSubscriptionInfo::getConnectionId() {
     return connectionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void RemoveSubscriptionInfo::setConnectionId( ConnectionId* connectionId ) {
+void RemoveSubscriptionInfo::setConnectionId( const decaf::lang::Pointer<ConnectionId>& connectionId ) {
     this->connectionId = connectionId;
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.h?rev=741774&r1=741773&r2=741774&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.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 <vector>
 #include <string>
@@ -45,7 +46,7 @@
     class AMQCPP_API RemoveSubscriptionInfo : public BaseCommand {
     protected:
 
-        ConnectionId* connectionId;
+        decaf::lang::Pointer<ConnectionId> connectionId;
         std::string subcriptionName;
         std::string clientId;
 
@@ -106,12 +107,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& getSubcriptionName() const;
         virtual std::string& getSubcriptionName();