00001 #ifndef QPID_FRAMING_MESSAGEFLOWBODY_H
00002 #define QPID_FRAMING_MESSAGEFLOWBODY_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 MessageFlowBody : public AMQMethodBody {
00041 string destination;
00042 uint8_t unit;
00043 uint32_t value;
00044 public:
00045 static const ClassId CLASS_ID = 120;
00046 static const MethodId METHOD_ID = 130;
00047 MessageFlowBody(
00048 ProtocolVersion, const string& _destination,
00049 uint8_t _unit,
00050 uint32_t _value) :
00051 destination(_destination),
00052 unit(_unit),
00053 value(_value){}
00054 MessageFlowBody(ProtocolVersion=ProtocolVersion()) : unit(0), value(0) {}
00055
00056 void setDestination(const string& _destination) { destination = _destination; }
00057 const string& getDestination() const { return destination; }
00058 void setUnit(uint8_t _unit) { unit = _unit; }
00059 uint8_t getUnit() const { return unit; }
00060 void setValue(uint32_t _value) { value = _value; }
00061 uint32_t getValue() const { return value; }
00062 typedef void ResultType;
00063
00064 template <class T> ResultType invoke(T& invocable) const {
00065 return invocable.flow(getDestination(), getUnit(), getValue());
00066 }
00067
00068 using AMQMethodBody::accept;
00069 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00070
00071 ClassId amqpClassId() const { return CLASS_ID; }
00072 MethodId amqpMethodId() const { return METHOD_ID; }
00073 bool isContentBearing() const { return false; }
00074 bool resultExpected() const { return false; }
00075 bool responseExpected() const { return false; }
00076 void encode(Buffer&) const;
00077 void decode(Buffer&, uint32_t=0);
00078 void encodeStructBody(Buffer&) const;
00079 void decodeStructBody(Buffer&, uint32_t=0);
00080 uint32_t size() const;
00081 uint32_t bodySize() const;
00082 void print(std::ostream& out) const;
00083 };
00084
00085 }}
00086 #endif