activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1330061 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands: BaseCommand.h Command.h ConnectionError.h ConsumerControl.h ControlCommand.h FlushCommand.h MessagePull.h ReplayCommand.h
Date Tue, 24 Apr 2012 23:35:31 GMT
Author: tabish
Date: Tue Apr 24 23:35:31 2012
New Revision: 1330061

URL: http://svn.apache.org/viewvc?rev=1330061&view=rev
Log:
Add some additional isXXX methods for faster type checking

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BaseCommand.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Command.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionError.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerControl.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ControlCommand.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/FlushCommand.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessagePull.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ReplayCommand.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BaseCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BaseCommand.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BaseCommand.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BaseCommand.h Tue
Apr 24 23:35:31 2012
@@ -21,8 +21,8 @@
 #include <activemq/util/Config.h>
 #include <activemq/commands/Command.h>
 
-namespace activemq{
-namespace commands{
+namespace activemq {
+namespace commands {
 
     class AMQCPP_API BaseCommand : public Command {
     private:
@@ -37,7 +37,7 @@ namespace commands{
 
         virtual ~BaseCommand() {}
 
-        virtual void setCommandId( int id ) {
+            virtual void setCommandId(int id) {
             this->commandId = id;
         }
 
@@ -45,7 +45,7 @@ namespace commands{
             return commandId;
         }
 
-        virtual void setResponseRequired( const bool required ) {
+        virtual void setResponseRequired(const bool required) {
             this->responseRequired = required;
         }
 
@@ -53,13 +53,10 @@ namespace commands{
             return responseRequired;
         }
 
-        virtual void copyDataStructure( const DataStructure* src ) {
-
-            const BaseCommand* command =
-                dynamic_cast< const BaseCommand* >( src );
-
-            this->setResponseRequired( command->isResponseRequired() );
-            this->setCommandId( command->getCommandId() );
+        virtual void copyDataStructure(const DataStructure* src) {
+            const BaseCommand* command = dynamic_cast<const BaseCommand*> (src);
+            this->setResponseRequired(command->isResponseRequired());
+            this->setCommandId(command->getCommandId());
         }
 
         /**
@@ -85,20 +82,35 @@ namespace commands{
          * same type, and that each element of the objects are the same.
          * @returns true if DataStructure's are Equal.
          */
-        virtual bool equals( const DataStructure* value ) const {
-            return BaseDataStructure::equals( value );
+        virtual bool equals(const DataStructure* value) const {
+            return BaseDataStructure::equals(value);
         }
 
+        virtual bool isBrokerInfo() const  {
+            return false;
+        }
+        virtual bool isControlCommand() const {
+            return false;
+        }
         virtual bool isConnectionControl() const {
             return false;
         }
+        virtual bool isConnectionError() const {
+            return false;
+        }
         virtual bool isConnectionInfo() const {
             return false;
         }
         virtual bool isConsumerInfo() const {
             return false;
         }
-        virtual bool isBrokerInfo() const  {
+        virtual bool isConsumerControl() const {
+            return false;
+        }
+        virtual bool isDestinationInfo() const {
+            return false;
+        }
+        virtual bool isFlushCommand() const {
             return false;
         }
         virtual bool isMessage() const  {
@@ -107,6 +119,9 @@ namespace commands{
         virtual bool isMessageAck() const  {
             return false;
         }
+        virtual bool isMessagePull() const  {
+            return false;
+        }
         virtual bool isKeepAliveInfo() const {
             return false;
         }
@@ -131,6 +146,12 @@ namespace commands{
         virtual bool isRemoveSubscriptionInfo() const {
             return false;
         }
+        virtual bool isReplayCommand() const {
+            return false;
+        }
+        virtual bool isSessionInfo() const  {
+            return false;
+        }
         virtual bool isShutdownInfo() const  {
             return false;
         }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Command.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Command.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Command.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Command.h Tue Apr
24 23:35:31 2012
@@ -80,20 +80,28 @@ namespace commands{
          * Command is of a certain type.  These are the most commonly used Commands
          * and we save several casts and some ugly code by just adding these here.
          */
+        virtual bool isBrokerInfo() const = 0;
+        virtual bool isControlCommand() const = 0;
         virtual bool isConnectionControl() const = 0;
         virtual bool isConnectionInfo() const = 0;
+        virtual bool isConnectionError() const = 0;
         virtual bool isConsumerInfo() const = 0;
-        virtual bool isBrokerInfo() const = 0;
+        virtual bool isConsumerControl() const = 0;
+        virtual bool isDestinationInfo() const = 0;
+        virtual bool isFlushCommand() const = 0;
         virtual bool isKeepAliveInfo() const = 0;
         virtual bool isMessage() const = 0;
         virtual bool isMessageAck() const = 0;
+        virtual bool isMessagePull() const = 0;
         virtual bool isMessageDispatch() const = 0;
         virtual bool isMessageDispatchNotification() const = 0;
         virtual bool isProducerAck() const = 0;
         virtual bool isProducerInfo() const = 0;
         virtual bool isResponse() const = 0;
+        virtual bool isReplayCommand() const = 0;
         virtual bool isRemoveInfo() const = 0;
         virtual bool isRemoveSubscriptionInfo() const = 0;
+        virtual bool isSessionInfo() const = 0;
         virtual bool isShutdownInfo() const = 0;
         virtual bool isTransactionInfo() const = 0;
         virtual bool isWireFormatInfo() const = 0;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionError.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionError.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionError.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionError.h
Tue Apr 24 23:35:31 2012
@@ -84,6 +84,13 @@ namespace commands{
         virtual Pointer<ConnectionId>& getConnectionId();
         virtual void setConnectionId( const Pointer<ConnectionId>& connectionId
);
 
+        /**
+         * @return an answer of true to the isConnectionError() query.
+         */
+        virtual bool isConnectionError() const {
+            return true;
+        }
+
         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerControl.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerControl.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerControl.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerControl.h
Tue Apr 24 23:35:31 2012
@@ -104,6 +104,13 @@ namespace commands{
         virtual bool isStop() const;
         virtual void setStop( bool stop );
 
+        /**
+         * @return an answer of true to the isConsumerControl() query.
+         */
+        virtual bool isConsumerControl() const {
+            return true;
+        }
+
         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ControlCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ControlCommand.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ControlCommand.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ControlCommand.h Tue
Apr 24 23:35:31 2012
@@ -77,6 +77,13 @@ namespace commands{
         virtual std::string& getCommand();
         virtual void setCommand( const std::string& command );
 
+        /**
+         * @return an answer of true to the isControlCommand() query.
+         */
+        virtual bool isControlCommand() const {
+            return true;
+        }
+
         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/FlushCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/FlushCommand.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/FlushCommand.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/FlushCommand.h Tue
Apr 24 23:35:31 2012
@@ -72,6 +72,13 @@ namespace commands{
 
         virtual bool equals( const DataStructure* value ) const;
 
+        /**
+         * @return an answer of true to the isFlushCommand() query.
+         */
+        virtual bool isFlushCommand() const {
+            return true;
+        }
+
         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessagePull.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessagePull.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessagePull.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessagePull.h Tue
Apr 24 23:35:31 2012
@@ -99,6 +99,13 @@ namespace commands{
         virtual Pointer<MessageId>& getMessageId();
         virtual void setMessageId( const Pointer<MessageId>& messageId );
 
+        /**
+         * @return an answer of true to the isMessagePull() query.
+         */
+        virtual bool isMessagePull() const {
+            return true;
+        }
+
         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ReplayCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ReplayCommand.h?rev=1330061&r1=1330060&r2=1330061&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ReplayCommand.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ReplayCommand.h Tue
Apr 24 23:35:31 2012
@@ -80,6 +80,13 @@ namespace commands{
         virtual int getLastNakNumber() const;
         virtual void setLastNakNumber( int lastNakNumber );
 
+        /**
+         * @return an answer of true to the isReplayCommand() query.
+         */
+        virtual bool isReplayCommand() const {
+            return true;
+        }
+
         virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor );
 
     };



Mime
View raw message