/usr/share/cruisecontrol-bin-2.6.1/projects/qpid-trunk/cpp/src/qpid/framing/AMQBody.h

00001 #ifndef QPID_FRAMING_AMQBODY_H
00002 #define QPID_FRAMING_AMQBODY_H
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 "qpid/framing/amqp_types.h"
00025 
00026 #include <ostream>
00027 
00028 namespace qpid {
00029 namespace framing {
00030 
00031 class Buffer;
00032 
00033 class AMQMethodBody;
00034 class AMQHeaderBody;
00035 class AMQContentBody;
00036 class AMQHeartbeatBody;
00037 
00038 struct AMQBodyConstVisitor {
00039     virtual ~AMQBodyConstVisitor() {}
00040     virtual void visit(const AMQHeaderBody&) = 0;
00041     virtual void visit(const AMQContentBody&) = 0;
00042     virtual void visit(const AMQHeartbeatBody&) = 0;
00043     virtual void visit(const AMQMethodBody&) = 0;
00044 };
00045 
00046 class AMQBody
00047 {
00048   public:
00049     virtual ~AMQBody();
00050 
00051     virtual uint8_t type() const = 0;
00052 
00053     virtual void encode(Buffer& buffer) const = 0;
00054     virtual void decode(Buffer& buffer, uint32_t=0) = 0;
00055     virtual uint32_t size() const = 0;
00056 
00057     virtual void print(std::ostream& out) const = 0;
00058     virtual void accept(AMQBodyConstVisitor&) const = 0;
00059 
00060     virtual AMQMethodBody* getMethod() { return 0; }
00061     virtual const AMQMethodBody* getMethod() const { return 0; }
00062 
00064     static bool match(const AMQBody& , const AMQBody& );
00065 };
00066 
00067 std::ostream& operator<<(std::ostream& out, const AMQBody& body) ;
00068 
00069 enum BodyTypes {
00070     METHOD_BODY = 1,
00071     HEADER_BODY = 2,
00072     CONTENT_BODY = 3,
00073     HEARTBEAT_BODY = 8
00074 };
00075 
00076 }} // namespace qpid::framing
00077 
00078 #endif  

Generated on Thu Apr 10 11:08:18 2008 for Qpid by  doxygen 1.4.7