|
activemq-cpp-3.4.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _ACTIVEMQ_COMMANDS_BASECOMMAND_H_ 00019 #define _ACTIVEMQ_COMMANDS_BASECOMMAND_H_ 00020 00021 #include <activemq/util/Config.h> 00022 #include <activemq/commands/Command.h> 00023 00024 namespace activemq{ 00025 namespace commands{ 00026 00027 class AMQCPP_API BaseCommand : public Command { 00028 private: 00029 00030 bool responseRequired; 00031 int commandId; 00032 00033 public: 00034 00035 BaseCommand() : Command(), responseRequired(false), commandId(0) { 00036 } 00037 00038 virtual ~BaseCommand() {} 00039 00040 virtual void setCommandId( int id ) { 00041 this->commandId = id; 00042 } 00043 00044 virtual int getCommandId() const { 00045 return commandId; 00046 } 00047 00048 virtual void setResponseRequired( const bool required ) { 00049 this->responseRequired = required; 00050 } 00051 00052 virtual bool isResponseRequired() const { 00053 return responseRequired; 00054 } 00055 00056 virtual void copyDataStructure( const DataStructure* src ) { 00057 00058 const BaseCommand* command = 00059 dynamic_cast< const BaseCommand* >( src ); 00060 00061 this->setResponseRequired( command->isResponseRequired() ); 00062 this->setCommandId( command->getCommandId() ); 00063 } 00064 00070 virtual std::string toString() const { 00071 std::ostringstream stream; 00072 00073 stream << "Begin Class = BaseCommand" << std::endl; 00074 stream << BaseDataStructure::toString(); 00075 stream << " Response Required = " << responseRequired << std::endl; 00076 stream << " Command Id = " << commandId << std::endl; 00077 stream << "End Class = BaseCommand" << std::endl; 00078 00079 return stream.str(); 00080 } 00081 00088 virtual bool equals( const DataStructure* value ) const { 00089 return BaseDataStructure::equals( value ); 00090 } 00091 00092 virtual bool isConnectionControl() const { 00093 return false; 00094 } 00095 virtual bool isConnectionInfo() const { 00096 return false; 00097 } 00098 virtual bool isConsumerInfo() const { 00099 return false; 00100 } 00101 virtual bool isBrokerInfo() const { 00102 return false; 00103 } 00104 virtual bool isMessage() const { 00105 return false; 00106 } 00107 virtual bool isMessageAck() const { 00108 return false; 00109 } 00110 virtual bool isKeepAliveInfo() const { 00111 return false; 00112 } 00113 virtual bool isMessageDispatch() const { 00114 return false; 00115 } 00116 virtual bool isMessageDispatchNotification() const { 00117 return false; 00118 } 00119 virtual bool isProducerAck() const { 00120 return false; 00121 } 00122 virtual bool isProducerInfo() const { 00123 return false; 00124 } 00125 virtual bool isResponse() const { 00126 return false; 00127 } 00128 virtual bool isRemoveInfo() const { 00129 return false; 00130 } 00131 virtual bool isRemoveSubscriptionInfo() const { 00132 return false; 00133 } 00134 virtual bool isShutdownInfo() const { 00135 return false; 00136 } 00137 virtual bool isTransactionInfo() const { 00138 return false; 00139 } 00140 virtual bool isWireFormatInfo() const { 00141 return false; 00142 } 00143 00144 }; 00145 00146 }} 00147 00148 #endif /*_ACTIVEMQ_COMMANDS_BASECOMMAND_H_*/