Apache Qpid C++ API
Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation

qpid/framing/AMQBody.h

Go to the documentation of this file.
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 #include "qpid/RefCounted.h"
00026 #include "qpid/framing/BodyFactory.h"
00027 #include <boost/intrusive_ptr.hpp>
00028 #include <ostream>
00029 
00030 namespace qpid {
00031 namespace framing {
00032 
00033 class Buffer;
00034 
00035 class AMQMethodBody;
00036 class AMQHeaderBody;
00037 class AMQContentBody;
00038 class AMQHeartbeatBody;
00039 
00040 struct AMQBodyConstVisitor {
00041     virtual ~AMQBodyConstVisitor() {}
00042     virtual void visit(const AMQHeaderBody&) = 0;
00043     virtual void visit(const AMQContentBody&) = 0;
00044     virtual void visit(const AMQHeartbeatBody&) = 0;
00045     virtual void visit(const AMQMethodBody&) = 0;
00046 };
00047 
00048 class AMQBody : public RefCounted {
00049   public:
00050     AMQBody() {}
00051     virtual ~AMQBody();
00052 
00053     // Make AMQBody copyable even though RefCounted. 
00054     AMQBody(const AMQBody&) : RefCounted() {}  
00055     AMQBody& operator=(const AMQBody&) { return *this; }
00056 
00057     virtual uint8_t type() const = 0;
00058 
00059     virtual void encode(Buffer& buffer) const = 0;
00060     virtual void decode(Buffer& buffer, uint32_t=0) = 0;
00061     virtual uint32_t encodedSize() const = 0;
00062 
00063     virtual void print(std::ostream& out) const = 0;
00064     virtual void accept(AMQBodyConstVisitor&) const = 0;
00065 
00066     virtual AMQMethodBody* getMethod() { return 0; }
00067     virtual const AMQMethodBody* getMethod() const { return 0; }
00068 
00070     static bool match(const AMQBody& , const AMQBody& );
00071     virtual boost::intrusive_ptr<AMQBody> clone() const = 0;
00072 };
00073 
00074 std::ostream& operator<<(std::ostream& out, const AMQBody& body) ;
00075 
00076 enum BodyTypes {
00077     METHOD_BODY = 1,
00078     HEADER_BODY = 2,
00079     CONTENT_BODY = 3,
00080     HEARTBEAT_BODY = 8
00081 };
00082 
00083 }} // namespace qpid::framing
00084 
00085 #endif  

Qpid C++ API Reference
Generated on Tue Dec 8 15:39:48 2009 for Qpid C++ Client API by doxygen 1.4.7