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