diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/lib/client/ClientMessage.cpp | 22 | ||||
-rw-r--r-- | cpp/lib/client/ClientMessage.h | 54 | ||||
-rw-r--r-- | cpp/lib/common/framing/BasicHeaderProperties.h | 58 |
3 files changed, 56 insertions, 78 deletions
diff --git a/cpp/lib/client/ClientMessage.cpp b/cpp/lib/client/ClientMessage.cpp index 3ad2d0b2f4..8edd0a474d 100644 --- a/cpp/lib/client/ClientMessage.cpp +++ b/cpp/lib/client/ClientMessage.cpp @@ -42,11 +42,11 @@ BasicHeaderProperties* Message::getHeaderProperties() const { return dynamic_cast<BasicHeaderProperties*>(header->getProperties()); } -const std::string& Message::getContentType() const { +std::string Message::getContentType() const { return getHeaderProperties()->getContentType(); } -const std::string& Message::getContentEncoding() const { +std::string Message::getContentEncoding() const { return getHeaderProperties()->getContentEncoding(); } @@ -62,19 +62,19 @@ uint8_t Message::getPriority() const { return getHeaderProperties()->getPriority(); } -const std::string& Message::getCorrelationId() const { +std::string Message::getCorrelationId() const { return getHeaderProperties()->getCorrelationId(); } -const std::string& Message::getReplyTo() const { +std::string Message::getReplyTo() const { return getHeaderProperties()->getReplyTo(); } -const std::string& Message::getExpiration() const { +std::string Message::getExpiration() const { return getHeaderProperties()->getExpiration(); } -const std::string& Message::getMessageId() const { +std::string Message::getMessageId() const { return getHeaderProperties()->getMessageId(); } @@ -82,19 +82,19 @@ uint64_t Message::getTimestamp() const { return getHeaderProperties()->getTimestamp(); } -const std::string& Message::getType() const { +std::string Message::getType() const { return getHeaderProperties()->getType(); } -const std::string& Message::getUserId() const { +std::string Message::getUserId() const { return getHeaderProperties()->getUserId(); } -const std::string& Message::getAppId() const { +std::string Message::getAppId() const { return getHeaderProperties()->getAppId(); } -const std::string& Message::getClusterId() const { +std::string Message::getClusterId() const { return getHeaderProperties()->getClusterId(); } @@ -110,7 +110,7 @@ void Message::setHeaders(const FieldTable& headers){ getHeaderProperties()->setHeaders(headers); } -void Message::setDeliveryMode(uint8_t mode){ +void Message::setDeliveryMode(DeliveryMode mode){ getHeaderProperties()->setDeliveryMode(mode); } diff --git a/cpp/lib/client/ClientMessage.h b/cpp/lib/client/ClientMessage.h index cb239ed4d6..c89eeb1a0d 100644 --- a/cpp/lib/client/ClientMessage.h +++ b/cpp/lib/client/ClientMessage.h @@ -46,56 +46,34 @@ class Message { Message(qpid::framing::AMQHeaderBody::shared_ptr& header); public: + enum DeliveryMode { DURABLE=1, NON_DURABLE=2 }; Message(const std::string& data=std::string()); ~Message(); - - /** - * Allows the application to access the content of messages - * received. - * - * @return a string representing the data of the message - */ - std::string getData() const { return data; } - - /** - * Allows the application to set the content of messages to be - * sent. - * - * @param data a string representing the data of the message - */ - void setData(const std::string& _data); - - /** - * @return true if this message was delivered previously (to - * any consumer) but was not acknowledged. - */ - bool isRedelivered(){ return redelivered; } - void setRedelivered(bool _redelivered){ redelivered = _redelivered; } + std::string getData() const { return data; } + bool isRedelivered() const { return redelivered; } uint64_t getDeliveryTag() const; - - const std::string& getContentType() const; - const std::string& getContentEncoding() const; + std::string getContentType() const; + std::string getContentEncoding() const; qpid::framing::FieldTable& getHeaders() const; uint8_t getDeliveryMode() const; uint8_t getPriority() const; - const std::string& getCorrelationId() const; - const std::string& getReplyTo() const; - const std::string& getExpiration() const; - const std::string& getMessageId() const; + std::string getCorrelationId() const; + std::string getReplyTo() const; + std::string getExpiration() const; + std::string getMessageId() const; uint64_t getTimestamp() const; - const std::string& getType() const; - const std::string& getUserId() const; - const std::string& getAppId() const; - const std::string& getClusterId() const; + std::string getType() const; + std::string getUserId() const; + std::string getAppId() const; + std::string getClusterId() const; + void setData(const std::string& _data); + void setRedelivered(bool _redelivered){ redelivered = _redelivered; } void setContentType(const std::string& type); void setContentEncoding(const std::string& encoding); void setHeaders(const qpid::framing::FieldTable& headers); - /** - * Sets the delivery mode. 1 = non-durable, 2 = durable. - */ - void setDeliveryMode(uint8_t mode); + void setDeliveryMode(DeliveryMode mode); void setPriority(uint8_t priority); void setCorrelationId(const std::string& correlationId); void setReplyTo(const std::string& replyTo); diff --git a/cpp/lib/common/framing/BasicHeaderProperties.h b/cpp/lib/common/framing/BasicHeaderProperties.h index 1f3fd31250..316e67b82c 100644 --- a/cpp/lib/common/framing/BasicHeaderProperties.h +++ b/cpp/lib/common/framing/BasicHeaderProperties.h @@ -57,37 +57,37 @@ namespace framing { virtual void encode(Buffer& buffer) const; virtual void decode(Buffer& buffer, uint32_t size); - inline virtual uint8_t classId() { return BASIC; } + virtual uint8_t classId() { return BASIC; } - inline const string& getContentType() const { return contentType; } - inline const string& getContentEncoding() const { return contentEncoding; } - inline FieldTable& getHeaders() { return headers; } - inline uint8_t getDeliveryMode() const { return deliveryMode; } - inline uint8_t getPriority() const { return priority; } - inline const string& getCorrelationId() const {return correlationId; } - inline const string& getReplyTo() const { return replyTo; } - inline const string& getExpiration() const { return expiration; } - inline const string& getMessageId() const {return messageId; } - inline uint64_t getTimestamp() const { return timestamp; } - inline const string& getType() const { return type; } - inline const string& getUserId() const { return userId; } - inline const string& getAppId() const { return appId; } - inline const string& getClusterId() const { return clusterId; } + 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; } - void inline setContentType(const string& _type){ contentType = _type; } - void inline setContentEncoding(const string& encoding){ contentEncoding = encoding; } - void inline setHeaders(const FieldTable& _headers){ headers = _headers; } - void inline setDeliveryMode(uint8_t mode){ deliveryMode = mode; } - void inline setPriority(uint8_t _priority){ priority = _priority; } - void inline setCorrelationId(const string& _correlationId){ correlationId = _correlationId; } - void inline setReplyTo(const string& _replyTo){ replyTo = _replyTo;} - void inline setExpiration(const string& _expiration){ expiration = _expiration; } - void inline setMessageId(const string& _messageId){ messageId = _messageId; } - void inline setTimestamp(uint64_t _timestamp){ timestamp = _timestamp; } - void inline setType(const string& _type){ type = _type; } - void inline setUserId(const string& _userId){ userId = _userId; } - void inline setAppId(const string& _appId){appId = _appId; } - void inline setClusterId(const string& _clusterId){ clusterId = _clusterId; } + 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; } }; } |