Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation |
00001 #ifndef _AMQMethodBody_ 00002 #define _AMQMethodBody_ 00003 00004 /* 00005 * 00006 * Licensed to the Apache Software Foundation (ASF) under one 00007 * or more contributor license agreements. See the NOTICE file 00008 * distributed with this work for additional information 00009 * regarding copyright ownership. The ASF licenses this file 00010 * to you under the Apache License, Version 2.0 (the 00011 * "License"); you may not use this file except in compliance 00012 * with the License. You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, 00017 * software distributed under the License is distributed on an 00018 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00019 * KIND, either express or implied. See the License for the 00020 * specific language governing permissions and limitations 00021 * under the License. 00022 * 00023 */ 00024 #include "amqp_types.h" 00025 #include "AMQBody.h" 00026 #include "qpid/framing/ProtocolVersion.h" 00027 #include "qpid/CommonImportExport.h" 00028 00029 #include <boost/shared_ptr.hpp> 00030 #include <ostream> 00031 #include <assert.h> 00032 00033 namespace qpid { 00034 namespace framing { 00035 00036 class Buffer; 00037 class AMQP_ServerOperations; 00038 class MethodBodyConstVisitor; 00039 00040 class AMQMethodBody : public AMQBody { 00041 public: 00042 AMQMethodBody() {} 00043 QPID_COMMON_EXTERN virtual ~AMQMethodBody(); 00044 00045 virtual void accept(MethodBodyConstVisitor&) const = 0; 00046 00047 virtual MethodId amqpMethodId() const = 0; 00048 virtual ClassId amqpClassId() const = 0; 00049 virtual bool isContentBearing() const = 0; 00050 virtual bool resultExpected() const = 0; 00051 virtual bool responseExpected() const = 0; 00052 00053 template <class T> bool isA() const { 00054 return amqpClassId()==T::CLASS_ID && amqpMethodId()==T::METHOD_ID; 00055 } 00056 00057 virtual uint32_t encodedSize() const = 0; 00058 virtual uint8_t type() const { return METHOD_BODY; } 00059 00060 virtual bool isSync() const { return false; /*only ModelMethods can have the sync flag set*/ } 00061 virtual void setSync(bool) const { /*only ModelMethods can have the sync flag set*/ } 00062 00063 AMQMethodBody* getMethod() { return this; } 00064 const AMQMethodBody* getMethod() const { return this; } 00065 void accept(AMQBodyConstVisitor& v) const { v.visit(*this); } 00066 }; 00067 00068 00069 }} // namespace qpid::framing 00070 00071 00072 #endif