00001 #ifndef QPID_FRAMING_QUEUEDECLAREBODY_H
00002 #define QPID_FRAMING_QUEUEDECLAREBODY_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 QueueDeclareBody : public ModelMethod {
00042 string queue;
00043 string alternateExchange;
00044 FieldTable arguments;
00045 uint16_t flags;
00046 public:
00047 static const ClassId CLASS_ID = 0x8;
00048 static const MethodId METHOD_ID = 0x1;
00049 QueueDeclareBody(
00050 ProtocolVersion, const string& _queue,
00051 const string& _alternateExchange,
00052 bool _passive,
00053 bool _durable,
00054 bool _exclusive,
00055 bool _autoDelete,
00056 const FieldTable& _arguments) :
00057 queue(_queue),
00058 alternateExchange(_alternateExchange),
00059 arguments(_arguments),
00060 flags(0){
00061 setPassive(_passive);
00062 setDurable(_durable);
00063 setExclusive(_exclusive);
00064 setAutoDelete(_autoDelete);
00065 flags |= (1 << 8);
00066 flags |= (1 << 9);
00067 flags |= (1 << 14);
00068 }
00069 QueueDeclareBody(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 setAlternateExchange(const string& _alternateExchange);
00076 const string& getAlternateExchange() const;
00077 bool hasAlternateExchange() const;
00078 void clearAlternateExchangeFlag();
00079 void setPassive(bool _passive);
00080 bool getPassive() const;
00081 void setDurable(bool _durable);
00082 bool getDurable() const;
00083 void setExclusive(bool _exclusive);
00084 bool getExclusive() const;
00085 void setAutoDelete(bool _autoDelete);
00086 bool getAutoDelete() 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.declare(getQueue(), getAlternateExchange(), getPassive(), getDurable(), getExclusive(), getAutoDelete(), 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 false; }
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