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 const BaseCommand* command = dynamic_cast<const BaseCommand*> (src); 00058 this->setResponseRequired(command->isResponseRequired()); 00059 this->setCommandId(command->getCommandId()); 00060 } 00061 00067 virtual std::string toString() const { 00068 std::ostringstream stream; 00069 00070 stream << "Begin Class = BaseCommand" << std::endl; 00071 stream << BaseDataStructure::toString(); 00072 stream << " Response Required = " << responseRequired << std::endl; 00073 stream << " Command Id = " << commandId << std::endl; 00074 stream << "End Class = BaseCommand" << std::endl; 00075 00076 return stream.str(); 00077 } 00078 00085 virtual bool equals(const DataStructure* value) const { 00086 return BaseDataStructure::equals(value); 00087 } 00088 00089 virtual bool isBrokerInfo() const { 00090 return false; 00091 } 00092 virtual bool isControlCommand() const { 00093 return false; 00094 } 00095 virtual bool isConnectionControl() const { 00096 return false; 00097 } 00098 virtual bool isConnectionError() const { 00099 return false; 00100 } 00101 virtual bool isConnectionInfo() const { 00102 return false; 00103 } 00104 virtual bool isConsumerInfo() const { 00105 return false; 00106 } 00107 virtual bool isConsumerControl() const { 00108 return false; 00109 } 00110 virtual bool isDestinationInfo() const { 00111 return false; 00112 } 00113 virtual bool isFlushCommand() const { 00114 return false; 00115 } 00116 virtual bool isMessage() const { 00117 return false; 00118 } 00119 virtual bool isMessageAck() const { 00120 return false; 00121 } 00122 virtual bool isMessagePull() const { 00123 return false; 00124 } 00125 virtual bool isKeepAliveInfo() const { 00126 return false; 00127 } 00128 virtual bool isMessageDispatch() const { 00129 return false; 00130 } 00131 virtual bool isMessageDispatchNotification() const { 00132 return false; 00133 } 00134 virtual bool isProducerAck() const { 00135 return false; 00136 } 00137 virtual bool isProducerInfo() const { 00138 return false; 00139 } 00140 virtual bool isResponse() const { 00141 return false; 00142 } 00143 virtual bool isRemoveInfo() const { 00144 return false; 00145 } 00146 virtual bool isRemoveSubscriptionInfo() const { 00147 return false; 00148 } 00149 virtual bool isReplayCommand() const { 00150 return false; 00151 } 00152 virtual bool isSessionInfo() const { 00153 return false; 00154 } 00155 virtual bool isShutdownInfo() const { 00156 return false; 00157 } 00158 virtual bool isTransactionInfo() const { 00159 return false; 00160 } 00161 virtual bool isWireFormatInfo() const { 00162 return false; 00163 } 00164 00165 }; 00166 00167 }} 00168 00169 #endif /*_ACTIVEMQ_COMMANDS_BASECOMMAND_H_*/
1.6.1