00001 #ifndef QPID_FRAMING_EXCHANGEDECLAREBODY_H
00002 #define QPID_FRAMING_EXCHANGEDECLAREBODY_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 ExchangeDeclareBody : public AMQMethodBody {
00041 uint16_t ticket;
00042 string exchange;
00043 string type;
00044 string alternateExchange;
00045 bool passive;
00046 bool durable;
00047 bool autoDelete;
00048 FieldTable arguments;
00049 public:
00050 static const ClassId CLASS_ID = 40;
00051 static const MethodId METHOD_ID = 10;
00052 ExchangeDeclareBody(
00053 ProtocolVersion, uint16_t _ticket,
00054 const string& _exchange,
00055 const string& _type,
00056 const string& _alternateExchange,
00057 bool _passive,
00058 bool _durable,
00059 bool _autoDelete,
00060 const FieldTable& _arguments) :
00061 ticket(_ticket),
00062 exchange(_exchange),
00063 type(_type),
00064 alternateExchange(_alternateExchange),
00065 passive(_passive),
00066 durable(_durable),
00067 autoDelete(_autoDelete),
00068 arguments(_arguments){}
00069 ExchangeDeclareBody(ProtocolVersion=ProtocolVersion()) : ticket(0), passive(0), durable(0), autoDelete(0) {}
00070
00071 void setTicket(uint16_t _ticket) { ticket = _ticket; }
00072 uint16_t getTicket() const { return ticket; }
00073 void setExchange(const string& _exchange) { exchange = _exchange; }
00074 const string& getExchange() const { return exchange; }
00075 void setType(const string& _type) { type = _type; }
00076 const string& getType() const { return type; }
00077 void setAlternateExchange(const string& _alternateExchange) { alternateExchange = _alternateExchange; }
00078 const string& getAlternateExchange() const { return alternateExchange; }
00079 void setPassive(bool _passive) { passive = _passive; }
00080 bool getPassive() const { return passive; }
00081 void setDurable(bool _durable) { durable = _durable; }
00082 bool getDurable() const { return durable; }
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(), getExchange(), getType(), getAlternateExchange(), getPassive(), getDurable(), 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