diff options
author | Alan Conway <aconway@apache.org> | 2007-03-27 15:36:39 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-03-27 15:36:39 +0000 |
commit | 847ee577e23fbdd2175709a08a7160e8b2c1f464 (patch) | |
tree | e4962c5246c91a08ef635f2c68e06b82cfb100ee /cpp/lib/common/framing/BasicHeaderProperties.h | |
parent | fb14a2042dd5bdae5a5c79b8cd4f1ad87e59bee1 (diff) | |
download | qpid-python-847ee577e23fbdd2175709a08a7160e8b2c1f464.tar.gz |
Refactored client::Message to be independent of all Basic class concepts
and client::IncomingMessage to handle 0-9 style references and appends.
* cpp/lib/client/ClientMessage.cpp: Made independent of Basic class.
* cpp/lib/client/IncomingMessage.cpp: Refactored to handle references/appends.
* cpp/lib/client/BasicMessageChannel.cpp: Refactored to use new IncomingMessage
Thread safety fixes:
* cpp/lib/client/ResponseHandler.h: Remove stateful functions.
* cpp/lib/client/ClientChannel.cpp: use new ResponseHandler interface.
Minor cleanup:
* cpp/lib/common/framing/BasicHeaderProperties.cpp: use DeliveryMode enum.
* cpp/tests/HeaderTest.cpp: use DeliveryMode enum.
* cpp/tests/MessageTest.cpp: use DeliveryMode enum.
* cpp/lib/common/shared_ptr.h: #include <boost/cast.hpp> for convenience.
* cpp/lib/common/sys/ThreadSafeQueue.h: Changed "stop" "shutdown"
* cpp/lib/common/sys/ProducerConsumer.h: Changed "stop" "shutdown"
* cpp/tests/ClientChannelTest.cpp (TestCase): Removed debug couts.
* cpp/tests/setup: valgrind --demangle=yes by default.
* cpp/tests/topictest: sleep to hack around startup race.
* cpp/lib/broker/BrokerQueue.cpp (configure): Fixed memory leak.
Removed/updated FIXME comments in:
* cpp/lib/broker/BrokerMessage.cpp:
* cpp/lib/broker/BrokerMessageBase.h:
* cpp/lib/broker/InMemoryContent.cpp:
* cpp/lib/common/framing/MethodContext.h:
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@522956 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/common/framing/BasicHeaderProperties.h')
-rw-r--r-- | cpp/lib/common/framing/BasicHeaderProperties.h | 136 |
1 files changed, 77 insertions, 59 deletions
diff --git a/cpp/lib/common/framing/BasicHeaderProperties.h b/cpp/lib/common/framing/BasicHeaderProperties.h index 316e67b82c..248014aefb 100644 --- a/cpp/lib/common/framing/BasicHeaderProperties.h +++ b/cpp/lib/common/framing/BasicHeaderProperties.h @@ -28,70 +28,88 @@ namespace qpid { namespace framing { - enum delivery_mode {TRANSIENT = 1, PERSISTENT = 2}; - //TODO: This could be easily generated from the spec - class BasicHeaderProperties : public HeaderProperties - { - string contentType; - string contentEncoding; - FieldTable headers; - uint8_t deliveryMode; - uint8_t priority; - string correlationId; - string replyTo; - string expiration; - string messageId; - uint64_t timestamp; - string type; - string userId; - string appId; - string clusterId; - - uint16_t getFlags() const; - - public: - BasicHeaderProperties(); - virtual ~BasicHeaderProperties(); - virtual uint32_t size() const; - virtual void encode(Buffer& buffer) const; - virtual void decode(Buffer& buffer, uint32_t size); +enum DeliveryMode { TRANSIENT = 1, PERSISTENT = 2}; - virtual uint8_t classId() { return BASIC; } +class BasicHeaderProperties : public HeaderProperties +{ + string contentType; + string contentEncoding; + FieldTable headers; + DeliveryMode deliveryMode; + uint8_t priority; + string correlationId; + string replyTo; + string expiration; + string messageId; + uint64_t timestamp; + string type; + string userId; + string appId; + string clusterId; + + uint16_t getFlags() const; - string getContentType() const { return contentType; } - string getContentEncoding() const { return contentEncoding; } - FieldTable& getHeaders() { return headers; } - uint8_t getDeliveryMode() const { return deliveryMode; } - uint8_t getPriority() const { return priority; } - string getCorrelationId() const {return correlationId; } - string getReplyTo() const { return replyTo; } - string getExpiration() const { return expiration; } - string getMessageId() const {return messageId; } - uint64_t getTimestamp() const { return timestamp; } - string getType() const { return type; } - string getUserId() const { return userId; } - string getAppId() const { return appId; } - string getClusterId() const { return clusterId; } + public: + BasicHeaderProperties(); + virtual ~BasicHeaderProperties(); + virtual uint32_t size() const; + virtual void encode(Buffer& buffer) const; + virtual void decode(Buffer& buffer, uint32_t size); - void setContentType(const string& _type){ contentType = _type; } - void setContentEncoding(const string& encoding){ contentEncoding = encoding; } - void setHeaders(const FieldTable& _headers){ headers = _headers; } - void setDeliveryMode(uint8_t mode){ deliveryMode = mode; } - void setPriority(uint8_t _priority){ priority = _priority; } - void setCorrelationId(const string& _correlationId){ correlationId = _correlationId; } - void setReplyTo(const string& _replyTo){ replyTo = _replyTo;} - void setExpiration(const string& _expiration){ expiration = _expiration; } - void setMessageId(const string& _messageId){ messageId = _messageId; } - void setTimestamp(uint64_t _timestamp){ timestamp = _timestamp; } - void setType(const string& _type){ type = _type; } - void setUserId(const string& _userId){ userId = _userId; } - void setAppId(const string& _appId){appId = _appId; } - void setClusterId(const string& _clusterId){ clusterId = _clusterId; } - }; + virtual uint8_t classId() { return BASIC; } -} -} + string getContentType() const { return contentType; } + string getContentEncoding() const { return contentEncoding; } + FieldTable& getHeaders() { return headers; } + const FieldTable& getHeaders() const { return headers; } + DeliveryMode getDeliveryMode() const { return deliveryMode; } + uint8_t getPriority() const { return priority; } + string getCorrelationId() const {return correlationId; } + string getReplyTo() const { return replyTo; } + string getExpiration() const { return expiration; } + string getMessageId() const {return messageId; } + uint64_t getTimestamp() const { return timestamp; } + string getType() const { return type; } + string getUserId() const { return userId; } + string getAppId() const { return appId; } + string getClusterId() const { return clusterId; } + void setContentType(const string& _type){ contentType = _type; } + void setContentEncoding(const string& encoding){ contentEncoding = encoding; } + void setHeaders(const FieldTable& _headers){ headers = _headers; } + void setDeliveryMode(DeliveryMode mode){ deliveryMode = mode; } + void setPriority(uint8_t _priority){ priority = _priority; } + void setCorrelationId(const string& _correlationId){ correlationId = _correlationId; } + void setReplyTo(const string& _replyTo){ replyTo = _replyTo;} + void setExpiration(const string& _expiration){ expiration = _expiration; } + void setMessageId(const string& _messageId){ messageId = _messageId; } + void setTimestamp(uint64_t _timestamp){ timestamp = _timestamp; } + void setType(const string& _type){ type = _type; } + void setUserId(const string& _userId){ userId = _userId; } + void setAppId(const string& _appId){appId = _appId; } + void setClusterId(const string& _clusterId){ clusterId = _clusterId; } + /** \internal + * Template to copy between types like BasicHeaderProperties. + */ + template <class T, class U> + static void copy(T& to, const U& from) { + to.setContentType(from.getContentType()); + to.setContentEncoding(from.getContentEncoding()); + to.setHeaders(from.getHeaders()); + to.setDeliveryMode(from.getDeliveryMode()); + to.setPriority(from.getPriority()); + to.setCorrelationId(from.getCorrelationId()); + to.setReplyTo(from.getReplyTo()); + to.setExpiration(from.getExpiration()); + to.setMessageId(from.getMessageId()); + to.setTimestamp(from.getTimestamp()); + to.setType(from.getType()); + to.setUserId(from.getUserId()); + to.setAppId(from.getAppId()); + to.setClusterId(from.getClusterId()); + } +}; +}} #endif |