00001 #ifndef QPID_FRAMING_DELIVERYPROPERTIES_H
00002 #define QPID_FRAMING_DELIVERYPROPERTIES_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
00031 #include <ostream>
00032 #include "qpid/framing/amqp_types_full.h"
00033
00034 namespace qpid {
00035 namespace framing {
00036
00037 class DeliveryProperties {
00038 uint8_t priority;
00039 uint8_t deliveryMode;
00040 uint64_t ttl;
00041 uint64_t timestamp;
00042 uint64_t expiration;
00043 string exchange;
00044 string routingKey;
00045 uint16_t flags;
00046 public:
00047 static const uint16_t TYPE = 0;
00048 DeliveryProperties(
00049 bool _discardUnroutable,
00050 bool _redelivered,
00051 uint8_t _priority,
00052 uint8_t _deliveryMode,
00053 uint64_t _ttl,
00054 uint64_t _timestamp,
00055 uint64_t _expiration,
00056 const string& _exchange,
00057 const string& _routingKey) :
00058 priority(_priority),
00059 deliveryMode(_deliveryMode),
00060 ttl(_ttl),
00061 timestamp(_timestamp),
00062 expiration(_expiration),
00063 exchange(_exchange),
00064 routingKey(_routingKey),
00065 flags(0){
00066 setDiscardUnroutable(_discardUnroutable);
00067 setRedelivered(_redelivered);
00068 flags |= (1 << 10);
00069 flags |= (1 << 11);
00070 flags |= (1 << 12);
00071 flags |= (1 << 13);
00072 flags |= (1 << 14);
00073 flags |= (1 << 15);
00074 flags |= (1 << 0);
00075 }
00076 DeliveryProperties() : priority(0), deliveryMode(0), ttl(0), timestamp(0), expiration(0), flags(0) {}
00077
00078 void setDiscardUnroutable(bool _discardUnroutable);
00079 bool getDiscardUnroutable() const;
00080 void setRedelivered(bool _redelivered);
00081 bool getRedelivered() const;
00082 void setPriority(uint8_t _priority);
00083 uint8_t getPriority() const;
00084 bool hasPriority() const;
00085 void clearPriorityFlag();
00086 void setDeliveryMode(uint8_t _deliveryMode);
00087 uint8_t getDeliveryMode() const;
00088 bool hasDeliveryMode() const;
00089 void clearDeliveryModeFlag();
00090 void setTtl(uint64_t _ttl);
00091 uint64_t getTtl() const;
00092 bool hasTtl() const;
00093 void clearTtlFlag();
00094 void setTimestamp(uint64_t _timestamp);
00095 uint64_t getTimestamp() const;
00096 bool hasTimestamp() const;
00097 void clearTimestampFlag();
00098 void setExpiration(uint64_t _expiration);
00099 uint64_t getExpiration() const;
00100 bool hasExpiration() const;
00101 void clearExpirationFlag();
00102 void setExchange(const string& _exchange);
00103 const string& getExchange() const;
00104 bool hasExchange() const;
00105 void clearExchangeFlag();
00106 void setRoutingKey(const string& _routingKey);
00107 const string& getRoutingKey() const;
00108 bool hasRoutingKey() const;
00109 void clearRoutingKeyFlag();
00110 friend std::ostream& operator<<(std::ostream&, const DeliveryProperties&);
00111 void encode(Buffer&) const;
00112 void decode(Buffer&, uint32_t=0);
00113 void encodeStructBody(Buffer&) const;
00114 void decodeStructBody(Buffer&, uint32_t=0);
00115 uint32_t size() const;
00116 uint32_t bodySize() const;
00117 void print(std::ostream& out) const;
00118 };
00119
00120 }}
00121 #endif