activemq-cpp-3.3.0

src/main/activemq/commands/Command.h

Go to the documentation of this file.
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_COMMAND_H_
00019 #define _ACTIVEMQ_COMMANDS_COMMAND_H_
00020 
00021 #include <string>
00022 #include <activemq/util/Config.h>
00023 #include <activemq/commands/BaseDataStructure.h>
00024 #include <activemq/exceptions/ActiveMQException.h>
00025 #include <decaf/lang/Pointer.h>
00026 
00027 namespace activemq{
00028 namespace state{
00029     class CommandVisitor;
00030 }
00031 namespace commands{
00032 
00033     class AMQCPP_API Command : public BaseDataStructure {
00034     public:
00035 
00036         virtual ~Command() {}
00037 
00042         virtual void setCommandId( int id ) = 0;
00043 
00048         virtual int getCommandId() const = 0;
00049 
00054         virtual void setResponseRequired( const bool required ) = 0;
00055 
00060         virtual bool isResponseRequired() const = 0;
00061 
00066         virtual std::string toString() const = 0;
00067 
00075         virtual decaf::lang::Pointer<commands::Command> visit(
00076             activemq::state::CommandVisitor* visitor ) = 0;
00077 
00078         /*
00079          * This section contains a set of short-cut methods for determining if a
00080          * Command is of a certain type.  These are the most commonly used Commands
00081          * and we save several casts and some ugly code by just adding these here.
00082          */
00083         virtual bool isConnectionControl() const = 0;
00084         virtual bool isConnectionInfo() const = 0;
00085         virtual bool isConsumerInfo() const = 0;
00086         virtual bool isBrokerInfo() const = 0;
00087         virtual bool isKeepAliveInfo() const = 0;
00088         virtual bool isMessage() const = 0;
00089         virtual bool isMessageAck() const = 0;
00090         virtual bool isMessageDispatch() const = 0;
00091         virtual bool isMessageDispatchNotification() const = 0;
00092         virtual bool isProducerAck() const = 0;
00093         virtual bool isProducerInfo() const = 0;
00094         virtual bool isResponse() const = 0;
00095         virtual bool isRemoveInfo() const = 0;
00096         virtual bool isRemoveSubscriptionInfo() const = 0;
00097         virtual bool isShutdownInfo() const = 0;
00098         virtual bool isTransactionInfo() const = 0;
00099         virtual bool isWireFormatInfo() const = 0;
00100 
00101     };
00102 
00103 }}
00104 
00105 #endif /*_ACTIVEMQ_COMMANDS_COMMAND_H_*/