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
00034 #include <ostream>
00035 #include "qpid/framing/amqp_types_full.h"
00036
00037 namespace qpid {
00038 namespace framing {
00039
00040 class QueueDeclareBody : public AMQMethodBody {
00041 uint16_t ticket;
00042 string queue;
00043 string alternateExchange;
00044 bool passive;
00045 bool durable;
00046 bool exclusive;
00047 bool autoDelete;
00048 FieldTable arguments;
00049 public:
00050 static const ClassId CLASS_ID = 50;
00051 static const MethodId METHOD_ID = 10;
00052 QueueDeclareBody(
00053 ProtocolVersion, uint16_t _ticket,
00054 const string& _queue,
00055 const string& _alternateExchange,
00056 bool _passive,
00057 bool _durable,
00058 bool _exclusive,
00059 bool _autoDelete,
00060 const FieldTable& _arguments) :
00061 ticket(_ticket),
00062 queue(_queue),
00063 alternateExchange(_alternateExchange),
00064 passive(_passive),
00065 durable(_durable),
00066 exclusive(_exclusive),
00067 autoDelete(_autoDelete),
00068 arguments(_arguments){}
00069 QueueDeclareBody(ProtocolVersion=ProtocolVersion()) : ticket(0), passive(0), durable(0), exclusive(0), autoDelete(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 setAlternateExchange(const string& _alternateExchange) { alternateExchange = _alternateExchange; }
00076 const string& getAlternateExchange() const { return alternateExchange; }
00077 void setPassive(bool _passive) { passive = _passive; }
00078 bool getPassive() const { return passive; }
00079 void setDurable(bool _durable) { durable = _durable; }
00080 bool getDurable() const { return durable; }
00081 void setExclusive(bool _exclusive) { exclusive = _exclusive; }
00082 bool getExclusive() const { return exclusive; }
00083 void setAutoDelete(bool _autoDelete) { autoDelete = _autoDelete; }
00084 bool getAutoDelete() const { return autoDelete; }
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.declare(getTicket(), getQueue(), getAlternateExchange(), getPassive(), getDurable(), getExclusive(), getAutoDelete(), 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 false; }
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