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 bool _enqueued,
00063 uint32_t _credit) :
00064 queue(_queue),
00065 position(_position),
00066 tag(_tag),
00067 id(_id),
00068 credit(_credit),
00069 flags(0){
00070 setAcquired(_acquired);
00071 setAccepted(_accepted);
00072 setCancelled(_cancelled);
00073 setCompleted(_completed);
00074 setEnded(_ended);
00075 setWindowing(_windowing);
00076 setEnqueued(_enqueued);
00077 flags |= (1 << 8);
00078 flags |= (1 << 9);
00079 flags |= (1 << 10);
00080 flags |= (1 << 11);
00081 flags |= (1 << 3);
00082 }
00083 ClusterConnectionDeliveryRecordBody(ProtocolVersion=ProtocolVersion()) : credit(0), flags(0) {}
00084
00085 void setQueue(const string& _queue);
00086 const string& getQueue() const;
00087 bool hasQueue() const;
00088 void clearQueueFlag();
00089 void setPosition(const SequenceNumber& _position);
00090 SequenceNumber getPosition() const;
00091 bool hasPosition() const;
00092 void clearPositionFlag();
00093 void setTag(const string& _tag);
00094 const string& getTag() const;
00095 bool hasTag() const;
00096 void clearTagFlag();
00097 void setId(const SequenceNumber& _id);
00098 SequenceNumber getId() const;
00099 bool hasId() const;
00100 void clearIdFlag();
00101 void setAcquired(bool _acquired);
00102 bool getAcquired() const;
00103 void setAccepted(bool _accepted);
00104 bool getAccepted() const;
00105 void setCancelled(bool _cancelled);
00106 bool getCancelled() const;
00107 void setCompleted(bool _completed);
00108 bool getCompleted() const;
00109 void setEnded(bool _ended);
00110 bool getEnded() const;
00111 void setWindowing(bool _windowing);
00112 bool getWindowing() const;
00113 void setEnqueued(bool _enqueued);
00114 bool getEnqueued() const;
00115 void setCredit(uint32_t _credit);
00116 uint32_t getCredit() const;
00117 bool hasCredit() const;
00118 void clearCreditFlag();
00119 typedef void ResultType;
00120
00121 template <class T> ResultType invoke(T& invocable) const {
00122 return invocable.deliveryRecord(getQueue(), getPosition(), getTag(), getId(), getAcquired(), getAccepted(), getCancelled(), getCompleted(), getEnded(), getWindowing(), getEnqueued(), getCredit());
00123 }
00124
00125 using AMQMethodBody::accept;
00126 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00127 boost::intrusive_ptr<AMQBody> clone() const { return BodyFactory::copy(*this); }
00128
00129 ClassId amqpClassId() const { return CLASS_ID; }
00130 MethodId amqpMethodId() const { return METHOD_ID; }
00131 bool isContentBearing() const { return false; }
00132 bool resultExpected() const { return false; }
00133 bool responseExpected() const { return false; }
00134 void encode(Buffer&) const;
00135 void decode(Buffer&, uint32_t=0);
00136 void encodeStructBody(Buffer&) const;
00137 void decodeStructBody(Buffer&, uint32_t=0);
00138 uint32_t encodedSize() const;
00139 uint32_t bodySize() const;
00140 void print(std::ostream& out) const;
00141 };
00142
00143 }}
00144 #endif