00001 #ifndef QPID_FRAMING_FILECONSUMEBODY_H
00002 #define QPID_FRAMING_FILECONSUMEBODY_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 FileConsumeBody : public ModelMethod {
00042 string queue;
00043 string consumerTag;
00044 FieldTable arguments;
00045 uint16_t flags;
00046 public:
00047 static const ClassId CLASS_ID = 0x9;
00048 static const MethodId METHOD_ID = 0x3;
00049 FileConsumeBody(
00050 ProtocolVersion, const string& _queue,
00051 const string& _consumerTag,
00052 bool _noLocal,
00053 bool _noAck,
00054 bool _exclusive,
00055 bool _nowait,
00056 const FieldTable& _arguments) :
00057 queue(_queue),
00058 consumerTag(_consumerTag),
00059 arguments(_arguments),
00060 flags(0){
00061 setNoLocal(_noLocal);
00062 setNoAck(_noAck);
00063 setExclusive(_exclusive);
00064 setNowait(_nowait);
00065 flags |= (1 << 8);
00066 flags |= (1 << 9);
00067 flags |= (1 << 14);
00068 }
00069 FileConsumeBody(ProtocolVersion=ProtocolVersion()) : flags(0) {}
00070
00071 void setQueue(const string& _queue);
00072 const string& getQueue() const;
00073 bool hasQueue() const;
00074 void clearQueueFlag();
00075 void setConsumerTag(const string& _consumerTag);
00076 const string& getConsumerTag() const;
00077 bool hasConsumerTag() const;
00078 void clearConsumerTagFlag();
00079 void setNoLocal(bool _noLocal);
00080 bool getNoLocal() const;
00081 void setNoAck(bool _noAck);
00082 bool getNoAck() const;
00083 void setExclusive(bool _exclusive);
00084 bool getExclusive() const;
00085 void setNowait(bool _nowait);
00086 bool getNowait() const;
00087 void setArguments(const FieldTable& _arguments);
00088 const FieldTable& getArguments() const;
00089 FieldTable& getArguments();
00090 bool hasArguments() const;
00091 void clearArgumentsFlag();
00092 typedef void ResultType;
00093
00094 template <class T> ResultType invoke(T& invocable) const {
00095 return invocable.consume(getQueue(), getConsumerTag(), getNoLocal(), getNoAck(), getExclusive(), getNowait(), getArguments());
00096 }
00097
00098 using AMQMethodBody::accept;
00099 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00100
00101 ClassId amqpClassId() const { return CLASS_ID; }
00102 MethodId amqpMethodId() const { return METHOD_ID; }
00103 bool isContentBearing() const { return false; }
00104 bool resultExpected() const { return false; }
00105 bool responseExpected() const { return true; }
00106 void encode(Buffer&) const;
00107 void decode(Buffer&, uint32_t=0);
00108 void encodeStructBody(Buffer&) const;
00109 void decodeStructBody(Buffer&, uint32_t=0);
00110 uint32_t size() const;
00111 uint32_t bodySize() const;
00112 void print(std::ostream& out) const;
00113 };
00114
00115 }}
00116 #endif