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 string resumeId;
00046 uint64_t resumeTtl;
00047 uint16_t flags;
00048 public:
00049 static const uint16_t TYPE = 1025;
00050 DeliveryProperties(
00051 bool _discardUnroutable,
00052 bool _immediate,
00053 bool _redelivered,
00054 uint8_t _priority,
00055 uint8_t _deliveryMode,
00056 uint64_t _ttl,
00057 uint64_t _timestamp,
00058 uint64_t _expiration,
00059 const string& _exchange,
00060 const string& _routingKey,
00061 const string& _resumeId,
00062 uint64_t _resumeTtl) :
00063 priority(_priority),
00064 deliveryMode(_deliveryMode),
00065 ttl(_ttl),
00066 timestamp(_timestamp),
00067 expiration(_expiration),
00068 exchange(_exchange),
00069 routingKey(_routingKey),
00070 resumeId(_resumeId),
00071 resumeTtl(_resumeTtl),
00072 flags(0){
00073 setDiscardUnroutable(_discardUnroutable);
00074 setImmediate(_immediate);
00075 setRedelivered(_redelivered);
00076 flags |= (1 << 11);
00077 flags |= (1 << 12);
00078 flags |= (1 << 13);
00079 flags |= (1 << 14);
00080 flags |= (1 << 15);
00081 flags |= (1 << 0);
00082 flags |= (1 << 1);
00083 flags |= (1 << 2);
00084 flags |= (1 << 3);
00085 }
00086 DeliveryProperties() : priority(0), deliveryMode(0), ttl(0), timestamp(0), expiration(0), resumeTtl(0), flags(0) {}
00087
00088 void setDiscardUnroutable(bool _discardUnroutable);
00089 bool getDiscardUnroutable() const;
00090 void setImmediate(bool _immediate);
00091 bool getImmediate() const;
00092 void setRedelivered(bool _redelivered);
00093 bool getRedelivered() const;
00094 void setPriority(uint8_t _priority);
00095 uint8_t getPriority() const;
00096 bool hasPriority() const;
00097 void clearPriorityFlag();
00098 void setDeliveryMode(uint8_t _deliveryMode);
00099 uint8_t getDeliveryMode() const;
00100 bool hasDeliveryMode() const;
00101 void clearDeliveryModeFlag();
00102 void setTtl(uint64_t _ttl);
00103 uint64_t getTtl() const;
00104 bool hasTtl() const;
00105 void clearTtlFlag();
00106 void setTimestamp(uint64_t _timestamp);
00107 uint64_t getTimestamp() const;
00108 bool hasTimestamp() const;
00109 void clearTimestampFlag();
00110 void setExpiration(uint64_t _expiration);
00111 uint64_t getExpiration() const;
00112 bool hasExpiration() const;
00113 void clearExpirationFlag();
00114 void setExchange(const string& _exchange);
00115 const string& getExchange() const;
00116 bool hasExchange() const;
00117 void clearExchangeFlag();
00118 void setRoutingKey(const string& _routingKey);
00119 const string& getRoutingKey() const;
00120 bool hasRoutingKey() const;
00121 void clearRoutingKeyFlag();
00122 void setResumeId(const string& _resumeId);
00123 const string& getResumeId() const;
00124 bool hasResumeId() const;
00125 void clearResumeIdFlag();
00126 void setResumeTtl(uint64_t _resumeTtl);
00127 uint64_t getResumeTtl() const;
00128 bool hasResumeTtl() const;
00129 void clearResumeTtlFlag();
00130 friend std::ostream& operator<<(std::ostream&, const DeliveryProperties&);
00131 void encode(Buffer&) const;
00132 void decode(Buffer&, uint32_t=0);
00133 void encodeStructBody(Buffer&) const;
00134 void decodeStructBody(Buffer&, uint32_t=0);
00135 uint32_t size() const;
00136 uint32_t bodySize() const;
00137 void print(std::ostream& out) const;
00138 };
00139
00140 }}
00141 #endif