00001 #ifndef QPID_FRAMING_FILEPUBLISHBODY_H
00002 #define QPID_FRAMING_FILEPUBLISHBODY_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 FilePublishBody : public ModelMethod {
00042 string exchange;
00043 string routingKey;
00044 string identifier;
00045 uint16_t flags;
00046 public:
00047 static const ClassId CLASS_ID = 0x9;
00048 static const MethodId METHOD_ID = 0x9;
00049 FilePublishBody(
00050 ProtocolVersion, const string& _exchange,
00051 const string& _routingKey,
00052 bool _mandatory,
00053 bool _immediate,
00054 const string& _identifier) :
00055 exchange(_exchange),
00056 routingKey(_routingKey),
00057 identifier(_identifier),
00058 flags(0){
00059 setMandatory(_mandatory);
00060 setImmediate(_immediate);
00061 flags |= (1 << 8);
00062 flags |= (1 << 9);
00063 flags |= (1 << 12);
00064 }
00065 FilePublishBody(ProtocolVersion=ProtocolVersion()) : flags(0) {}
00066
00067 void setExchange(const string& _exchange);
00068 const string& getExchange() const;
00069 bool hasExchange() const;
00070 void clearExchangeFlag();
00071 void setRoutingKey(const string& _routingKey);
00072 const string& getRoutingKey() const;
00073 bool hasRoutingKey() const;
00074 void clearRoutingKeyFlag();
00075 void setMandatory(bool _mandatory);
00076 bool getMandatory() const;
00077 void setImmediate(bool _immediate);
00078 bool getImmediate() const;
00079 void setIdentifier(const string& _identifier);
00080 const string& getIdentifier() const;
00081 bool hasIdentifier() const;
00082 void clearIdentifierFlag();
00083 typedef void ResultType;
00084
00085 template <class T> ResultType invoke(T& invocable) const {
00086 return invocable.publish(getExchange(), getRoutingKey(), getMandatory(), getImmediate(), getIdentifier());
00087 }
00088
00089 using AMQMethodBody::accept;
00090 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00091
00092 ClassId amqpClassId() const { return CLASS_ID; }
00093 MethodId amqpMethodId() const { return METHOD_ID; }
00094 bool isContentBearing() const { return false; }
00095 bool resultExpected() const { return false; }
00096 bool responseExpected() const { return false; }
00097 void encode(Buffer&) const;
00098 void decode(Buffer&, uint32_t=0);
00099 void encodeStructBody(Buffer&) const;
00100 void decodeStructBody(Buffer&, uint32_t=0);
00101 uint32_t size() const;
00102 uint32_t bodySize() const;
00103 void print(std::ostream& out) const;
00104 };
00105
00106 }}
00107 #endif