00001 #ifndef QPID_FRAMING_CLUSTERCONNECTIONDELIVERYRECORDBODY_H
00002 #define QPID_FRAMING_CLUSTERCONNECTIONDELIVERYRECORDBODY_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028
00029
00030 #include "qpid/framing/AMQMethodBody.h"
00031 #include "qpid/framing/AMQP_ServerOperations.h"
00032 #include "qpid/framing/MethodBodyConstVisitor.h"
00033 #include "qpid/framing/ModelMethod.h"
00034
00035 #include <ostream>
00036 #include "qpid/framing/amqp_types_full.h"
00037
00038 namespace qpid {
00039 namespace framing {
00040
00041 class ClusterConnectionDeliveryRecordBody : public ModelMethod {
00042 string queue;
00043 SequenceNumber position;
00044 string tag;
00045 SequenceNumber id;
00046 uint32_t credit;
00047 uint16_t flags;
00048 public:
00049 static const ClassId CLASS_ID = 0x81;
00050 static const MethodId METHOD_ID = 0x11;
00051 ClusterConnectionDeliveryRecordBody(
00052 ProtocolVersion, const string& _queue,
00053 const SequenceNumber& _position,
00054 const string& _tag,
00055 const SequenceNumber& _id,
00056 bool _acquired,
00057 bool _accepted,
00058 bool _cancelled,
00059 bool _completed,
00060 bool _ended,
00061 bool _windowing,
00062 uint32_t _credit) :
00063 queue(_queue),
00064 position(_position),
00065 tag(_tag),
00066 id(_id),
00067 credit(_credit),
00068 flags(0){
00069 setAcquired(_acquired);
00070 setAccepted(_accepted);
00071 setCancelled(_cancelled);
00072 setCompleted(_completed);
00073 setEnded(_ended);
00074 setWindowing(_windowing);
00075 flags |= (1 << 8);
00076 flags |= (1 << 9);
00077 flags |= (1 << 10);
00078 flags |= (1 << 11);
00079 flags |= (1 << 2);
00080 }
00081 ClusterConnectionDeliveryRecordBody(ProtocolVersion=ProtocolVersion()) : credit(0), flags(0) {}
00082
00083 void setQueue(const string& _queue);
00084 const string& getQueue() const;
00085 bool hasQueue() const;
00086 void clearQueueFlag();
00087 void setPosition(const SequenceNumber& _position);
00088 SequenceNumber getPosition() const;
00089 bool hasPosition() const;
00090 void clearPositionFlag();
00091 void setTag(const string& _tag);
00092 const string& getTag() const;
00093 bool hasTag() const;
00094 void clearTagFlag();
00095 void setId(const SequenceNumber& _id);
00096 SequenceNumber getId() const;
00097 bool hasId() const;
00098 void clearIdFlag();
00099 void setAcquired(bool _acquired);
00100 bool getAcquired() const;
00101 void setAccepted(bool _accepted);
00102 bool getAccepted() const;
00103 void setCancelled(bool _cancelled);
00104 bool getCancelled() const;
00105 void setCompleted(bool _completed);
00106 bool getCompleted() const;
00107 void setEnded(bool _ended);
00108 bool getEnded() const;
00109 void setWindowing(bool _windowing);
00110 bool getWindowing() const;
00111 void setCredit(uint32_t _credit);
00112 uint32_t getCredit() const;
00113 bool hasCredit() const;
00114 void clearCreditFlag();
00115 typedef void ResultType;
00116
00117 template <class T> ResultType invoke(T& invocable) const {
00118 return invocable.deliveryRecord(getQueue(), getPosition(), getTag(), getId(), getAcquired(), getAccepted(), getCancelled(), getCompleted(), getEnded(), getWindowing(), getCredit());
00119 }
00120
00121 using AMQMethodBody::accept;
00122 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00123 boost::intrusive_ptr<AMQBody> clone() const { return BodyFactory::copy(*this); }
00124
00125 ClassId amqpClassId() const { return CLASS_ID; }
00126 MethodId amqpMethodId() const { return METHOD_ID; }
00127 bool isContentBearing() const { return false; }
00128 bool resultExpected() const { return false; }
00129 bool responseExpected() const { return false; }
00130 void encode(Buffer&) const;
00131 void decode(Buffer&, uint32_t=0);
00132 void encodeStructBody(Buffer&) const;
00133 void decodeStructBody(Buffer&, uint32_t=0);
00134 uint32_t encodedSize() const;
00135 uint32_t bodySize() const;
00136 void print(std::ostream& out) const;
00137 };
00138
00139 }}
00140 #endif