00001 #ifndef QPID_FRAMING_BASICCONSUMEBODY_H
00002 #define QPID_FRAMING_BASICCONSUMEBODY_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
00034 #include <ostream>
00035 #include "qpid/framing/amqp_types_full.h"
00036
00037 namespace qpid {
00038 namespace framing {
00039
00040 class BasicConsumeBody : public AMQMethodBody {
00041 uint16_t ticket;
00042 string queue;
00043 string consumerTag;
00044 bool noLocal;
00045 bool noAck;
00046 bool exclusive;
00047 bool nowait;
00048 FieldTable arguments;
00049 public:
00050 static const ClassId CLASS_ID = 60;
00051 static const MethodId METHOD_ID = 20;
00052 BasicConsumeBody(
00053 ProtocolVersion, uint16_t _ticket,
00054 const string& _queue,
00055 const string& _consumerTag,
00056 bool _noLocal,
00057 bool _noAck,
00058 bool _exclusive,
00059 bool _nowait,
00060 const FieldTable& _arguments) :
00061 ticket(_ticket),
00062 queue(_queue),
00063 consumerTag(_consumerTag),
00064 noLocal(_noLocal),
00065 noAck(_noAck),
00066 exclusive(_exclusive),
00067 nowait(_nowait),
00068 arguments(_arguments){}
00069 BasicConsumeBody(ProtocolVersion=ProtocolVersion()) : ticket(0), noLocal(0), noAck(0), exclusive(0), nowait(0) {}
00070
00071 void setTicket(uint16_t _ticket) { ticket = _ticket; }
00072 uint16_t getTicket() const { return ticket; }
00073 void setQueue(const string& _queue) { queue = _queue; }
00074 const string& getQueue() const { return queue; }
00075 void setConsumerTag(const string& _consumerTag) { consumerTag = _consumerTag; }
00076 const string& getConsumerTag() const { return consumerTag; }
00077 void setNoLocal(bool _noLocal) { noLocal = _noLocal; }
00078 bool getNoLocal() const { return noLocal; }
00079 void setNoAck(bool _noAck) { noAck = _noAck; }
00080 bool getNoAck() const { return noAck; }
00081 void setExclusive(bool _exclusive) { exclusive = _exclusive; }
00082 bool getExclusive() const { return exclusive; }
00083 void setNowait(bool _nowait) { nowait = _nowait; }
00084 bool getNowait() const { return nowait; }
00085 void setArguments(const FieldTable& _arguments) { arguments = _arguments; }
00086 const FieldTable& getArguments() const { return arguments; }
00087 FieldTable& getArguments() { return arguments; }
00088 typedef void ResultType;
00089
00090 template <class T> ResultType invoke(T& invocable) const {
00091 return invocable.consume(getTicket(), getQueue(), getConsumerTag(), getNoLocal(), getNoAck(), getExclusive(), getNowait(), getArguments());
00092 }
00093
00094 using AMQMethodBody::accept;
00095 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00096
00097 ClassId amqpClassId() const { return CLASS_ID; }
00098 MethodId amqpMethodId() const { return METHOD_ID; }
00099 bool isContentBearing() const { return false; }
00100 bool resultExpected() const { return false; }
00101 bool responseExpected() const { return true; }
00102 void encode(Buffer&) const;
00103 void decode(Buffer&, uint32_t=0);
00104 void encodeStructBody(Buffer&) const;
00105 void decodeStructBody(Buffer&, uint32_t=0);
00106 uint32_t size() const;
00107 uint32_t bodySize() const;
00108 void print(std::ostream& out) const;
00109 };
00110
00111 }}
00112 #endif