00001 #ifndef QPID_FRAMING_MESSAGESUBSCRIBEBODY_H
00002 #define QPID_FRAMING_MESSAGESUBSCRIBEBODY_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 MessageSubscribeBody : public ModelMethod {
00042 string queue;
00043 string destination;
00044 uint8_t acceptMode;
00045 uint8_t acquireMode;
00046 string resumeId;
00047 uint64_t resumeTtl;
00048 FieldTable arguments;
00049 uint16_t flags;
00050 public:
00051 static const ClassId CLASS_ID = 0x4;
00052 static const MethodId METHOD_ID = 0x7;
00053 MessageSubscribeBody(
00054 ProtocolVersion, const string& _queue,
00055 const string& _destination,
00056 uint8_t _acceptMode,
00057 uint8_t _acquireMode,
00058 bool _exclusive,
00059 const string& _resumeId,
00060 uint64_t _resumeTtl,
00061 const FieldTable& _arguments) :
00062 queue(_queue),
00063 destination(_destination),
00064 acceptMode(_acceptMode),
00065 acquireMode(_acquireMode),
00066 resumeId(_resumeId),
00067 resumeTtl(_resumeTtl),
00068 arguments(_arguments),
00069 flags(0){
00070 setExclusive(_exclusive);
00071 flags |= (1 << 8);
00072 flags |= (1 << 9);
00073 flags |= (1 << 10);
00074 flags |= (1 << 11);
00075 flags |= (1 << 13);
00076 flags |= (1 << 14);
00077 flags |= (1 << 15);
00078 }
00079 MessageSubscribeBody(ProtocolVersion=ProtocolVersion()) : acceptMode(0), acquireMode(0), resumeTtl(0), flags(0) {}
00080
00081 void setQueue(const string& _queue);
00082 const string& getQueue() const;
00083 bool hasQueue() const;
00084 void clearQueueFlag();
00085 void setDestination(const string& _destination);
00086 const string& getDestination() const;
00087 bool hasDestination() const;
00088 void clearDestinationFlag();
00089 void setAcceptMode(uint8_t _acceptMode);
00090 uint8_t getAcceptMode() const;
00091 bool hasAcceptMode() const;
00092 void clearAcceptModeFlag();
00093 void setAcquireMode(uint8_t _acquireMode);
00094 uint8_t getAcquireMode() const;
00095 bool hasAcquireMode() const;
00096 void clearAcquireModeFlag();
00097 void setExclusive(bool _exclusive);
00098 bool getExclusive() const;
00099 void setResumeId(const string& _resumeId);
00100 const string& getResumeId() const;
00101 bool hasResumeId() const;
00102 void clearResumeIdFlag();
00103 void setResumeTtl(uint64_t _resumeTtl);
00104 uint64_t getResumeTtl() const;
00105 bool hasResumeTtl() const;
00106 void clearResumeTtlFlag();
00107 void setArguments(const FieldTable& _arguments);
00108 const FieldTable& getArguments() const;
00109 FieldTable& getArguments();
00110 bool hasArguments() const;
00111 void clearArgumentsFlag();
00112 typedef void ResultType;
00113
00114 template <class T> ResultType invoke(T& invocable) const {
00115 return invocable.subscribe(getQueue(), getDestination(), getAcceptMode(), getAcquireMode(), getExclusive(), getResumeId(), getResumeTtl(), getArguments());
00116 }
00117
00118 using AMQMethodBody::accept;
00119 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00120
00121 ClassId amqpClassId() const { return CLASS_ID; }
00122 MethodId amqpMethodId() const { return METHOD_ID; }
00123 bool isContentBearing() const { return false; }
00124 bool resultExpected() const { return false; }
00125 bool responseExpected() const { return false; }
00126 void encode(Buffer&) const;
00127 void decode(Buffer&, uint32_t=0);
00128 void encodeStructBody(Buffer&) const;
00129 void decodeStructBody(Buffer&, uint32_t=0);
00130 uint32_t size() const;
00131 uint32_t bodySize() const;
00132 void print(std::ostream& out) const;
00133 };
00134
00135 }}
00136 #endif