/opt/workspace/qpid/tags/M2/Final/cpp/lib/common/framing/AMQMethodBody.h

00001 /*
00002  *
00003  * Licensed to the Apache Software Foundation (ASF) under one
00004  * or more contributor license agreements.  See the NOTICE file
00005  * distributed with this work for additional information
00006  * regarding copyright ownership.  The ASF licenses this file
00007  * to you under the Apache License, Version 2.0 (the
00008  * "License"); you may not use this file except in compliance
00009  * with the License.  You may obtain a copy of the License at
00010  * 
00011  *   http://www.apache.org/licenses/LICENSE-2.0
00012  * 
00013  * Unless required by applicable law or agreed to in writing,
00014  * software distributed under the License is distributed on an
00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00016  * KIND, either express or implied.  See the License for the
00017  * specific language governing permissions and limitations
00018  * under the License.
00019  *
00020  */
00021 #include <iostream>
00022 #include <amqp_types.h>
00023 #include <AMQBody.h>
00024 #include <Buffer.h>
00025 #include <AMQP_ServerOperations.h>
00026 
00027 #ifndef _AMQMethodBody_
00028 #define _AMQMethodBody_
00029 
00030 namespace qpid {
00031 namespace framing {
00032 
00033 class AMQMethodBody : virtual public AMQBody
00034 {
00035 public:
00036     typedef boost::shared_ptr<AMQMethodBody> shared_ptr;
00037 
00038         ProtocolVersion version;
00039     inline u_int8_t type() const { return METHOD_BODY; }
00040     inline u_int32_t size() const { return 4 + bodySize(); }
00041     inline AMQMethodBody(u_int8_t major, u_int8_t minor) : version(major, minor) {}
00042     inline AMQMethodBody(ProtocolVersion version) : version(version) {}
00043     inline virtual ~AMQMethodBody() {}
00044     virtual void print(std::ostream& out) const = 0;
00045     virtual u_int16_t amqpMethodId() const = 0;
00046     virtual u_int16_t amqpClassId() const = 0;
00047     virtual void invoke(AMQP_ServerOperations& target, u_int16_t channel);
00048     virtual void encodeContent(Buffer& buffer) const = 0;
00049     virtual void decodeContent(Buffer& buffer) = 0;
00050     virtual u_int32_t bodySize() const = 0;
00051     void encode(Buffer& buffer) const;
00052     void decode(Buffer& buffer, u_int32_t size);
00053     bool match(AMQMethodBody* other) const;
00054 };
00055 
00056 std::ostream& operator<<(std::ostream& out, const AMQMethodBody& body);
00057 
00058 }
00059 }
00060 
00061 
00062 #endif

Generated on Mon Nov 26 19:13:17 2007 for Qpid by  doxygen 1.5.1