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 #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 StreamConsumeBody : public ModelMethod {
00042 string queue;
00043 string consumerTag;
00044 FieldTable arguments;
00045 uint16_t flags;
00046 public:
00047 static const ClassId CLASS_ID = 0xa;
00048 static const MethodId METHOD_ID = 0x3;
00049 StreamConsumeBody(
00050 ProtocolVersion, const string& _queue,
00051 const string& _consumerTag,
00052 bool _noLocal,
00053 bool _exclusive,
00054 bool _nowait,
00055 const FieldTable& _arguments) :
00056 queue(_queue),
00057 consumerTag(_consumerTag),
00058 arguments(_arguments),
00059 flags(0){
00060 setNoLocal(_noLocal);
00061 setExclusive(_exclusive);
00062 setNowait(_nowait);
00063 flags |= (1 << 8);
00064 flags |= (1 << 9);
00065 flags |= (1 << 13);
00066 }
00067 StreamConsumeBody(ProtocolVersion=ProtocolVersion()) : flags(0) {}
00068
00069 void setQueue(const string& _queue);
00070 const string& getQueue() const;
00071 bool hasQueue() const;
00072 void clearQueueFlag();
00073 void setConsumerTag(const string& _consumerTag);
00074 const string& getConsumerTag() const;
00075 bool hasConsumerTag() const;
00076 void clearConsumerTagFlag();
00077 void setNoLocal(bool _noLocal);
00078 bool getNoLocal() const;
00079 void setExclusive(bool _exclusive);
00080 bool getExclusive() const;
00081 void setNowait(bool _nowait);
00082 bool getNowait() const;
00083 void setArguments(const FieldTable& _arguments);
00084 const FieldTable& getArguments() const;
00085 FieldTable& getArguments();
00086 bool hasArguments() const;
00087 void clearArgumentsFlag();
00088 typedef void ResultType;
00089
00090 template <class T> ResultType invoke(T& invocable) const {
00091 return invocable.consume(getQueue(), getConsumerTag(), getNoLocal(), 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