00001 #ifndef QPID_FRAMING_STREAMPROPERTIES_H
00002 #define QPID_FRAMING_STREAMPROPERTIES_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 StreamProperties {
00038 string contentType;
00039 string contentEncoding;
00040 FieldTable headers;
00041 uint8_t priority;
00042 uint64_t timestamp;
00043 uint16_t flags;
00044 public:
00045 static const uint16_t TYPE = 2561;
00046 StreamProperties(
00047 const string& _contentType,
00048 const string& _contentEncoding,
00049 const FieldTable& _headers,
00050 uint8_t _priority,
00051 uint64_t _timestamp) :
00052 contentType(_contentType),
00053 contentEncoding(_contentEncoding),
00054 headers(_headers),
00055 priority(_priority),
00056 timestamp(_timestamp),
00057 flags(0){
00058 flags |= (1 << 8);
00059 flags |= (1 << 9);
00060 flags |= (1 << 10);
00061 flags |= (1 << 11);
00062 flags |= (1 << 12);
00063 }
00064 StreamProperties() : priority(0), timestamp(0), flags(0) {}
00065
00066 void setContentType(const string& _contentType);
00067 const string& getContentType() const;
00068 bool hasContentType() const;
00069 void clearContentTypeFlag();
00070 void setContentEncoding(const string& _contentEncoding);
00071 const string& getContentEncoding() const;
00072 bool hasContentEncoding() const;
00073 void clearContentEncodingFlag();
00074 void setHeaders(const FieldTable& _headers);
00075 const FieldTable& getHeaders() const;
00076 FieldTable& getHeaders();
00077 bool hasHeaders() const;
00078 void clearHeadersFlag();
00079 void setPriority(uint8_t _priority);
00080 uint8_t getPriority() const;
00081 bool hasPriority() const;
00082 void clearPriorityFlag();
00083 void setTimestamp(uint64_t _timestamp);
00084 uint64_t getTimestamp() const;
00085 bool hasTimestamp() const;
00086 void clearTimestampFlag();
00087 friend std::ostream& operator<<(std::ostream&, const StreamProperties&);
00088 void encode(Buffer&) const;
00089 void decode(Buffer&, uint32_t=0);
00090 void encodeStructBody(Buffer&) const;
00091 void decodeStructBody(Buffer&, uint32_t=0);
00092 uint32_t size() const;
00093 uint32_t bodySize() const;
00094 void print(std::ostream& out) const;
00095 };
00096
00097 }}
00098 #endif