Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/framing/MessageProperties.h
Go to the documentation of this file.
00001 #ifndef QPID_FRAMING_MESSAGEPROPERTIES_H
00002 #define QPID_FRAMING_MESSAGEPROPERTIES_H
00003 /*
00004  *
00005  * Licensed to the Apache Software Foundation (ASF) under one
00006  * or more contributor license agreements.  See the NOTICE file
00007  * distributed with this work for additional information
00008  * regarding copyright ownership.  The ASF licenses this file
00009  * to you under the Apache License, Version 2.0 (the
00010  * "License"); you may not use this file except in compliance
00011  * with the License.  You may obtain a copy of the License at
00012  *
00013  *   http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing,
00016  * software distributed under the License is distributed on an
00017  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00018  * KIND, either express or implied.  See the License for the
00019  * specific language governing permissions and limitations
00020  * under the License.
00021  *
00022  */
00023 
00028 
00029 
00030 #include "qpid/framing/ReplyTo.h"
00031 
00032 #include <ostream>
00033 #include "qpid/framing/amqp_types_full.h"
00034 #include "qpid/framing/reply_exceptions.h"
00035 #include "qpid/CommonImportExport.h"
00036 
00037 namespace qpid {
00038 namespace framing {
00039 
00040 class QPID_COMMON_CLASS_EXTERN MessageProperties  {
00041     uint64_t contentLength;
00042     Uuid messageId;
00043     std::string correlationId;
00044     ReplyTo replyTo;
00045     std::string contentType;
00046     std::string contentEncoding;
00047     std::string userId;
00048     std::string appId;
00049     FieldTable applicationHeaders;
00050     uint16_t flags;
00051 public:
00052     static const uint16_t TYPE = 1027;
00053     MessageProperties(
00054         uint64_t _contentLength,
00055         const Uuid& _messageId,
00056         const std::string& _correlationId,
00057         const ReplyTo& _replyTo,
00058         const std::string& _contentType,
00059         const std::string& _contentEncoding,
00060         const std::string& _userId,
00061         const std::string& _appId,
00062         const FieldTable& _applicationHeaders) : 
00063         contentLength(_contentLength),
00064         messageId(_messageId),
00065         correlationId(_correlationId),
00066         replyTo(_replyTo),
00067         contentType(_contentType),
00068         contentEncoding(_contentEncoding),
00069         userId(_userId),
00070         appId(_appId),
00071         applicationHeaders(_applicationHeaders),
00072         flags(0){
00073         flags |= (1 << 8);
00074         flags |= (1 << 9);
00075         flags |= (1 << 10);
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         if (correlationId.size() >= 65536) throw IllegalArgumentException("Value for correlationId is too large");
00083         if (contentType.size() >= 256) throw IllegalArgumentException("Value for contentType is too large");
00084         if (contentEncoding.size() >= 256) throw IllegalArgumentException("Value for contentEncoding is too large");
00085         if (userId.size() >= 65536) throw IllegalArgumentException("Value for userId is too large");
00086         if (appId.size() >= 65536) throw IllegalArgumentException("Value for appId is too large");
00087     }
00088     MessageProperties()  : contentLength(0), flags(0) {}
00089     
00090     QPID_COMMON_EXTERN void setContentLength(uint64_t _contentLength);
00091     QPID_COMMON_EXTERN uint64_t getContentLength() const;
00092     QPID_COMMON_EXTERN bool hasContentLength() const;
00093     QPID_COMMON_EXTERN void clearContentLengthFlag();
00094     QPID_COMMON_EXTERN void setMessageId(const Uuid& _messageId);
00095     QPID_COMMON_EXTERN const Uuid& getMessageId() const;
00096     QPID_COMMON_EXTERN bool hasMessageId() const;
00097     QPID_COMMON_EXTERN void clearMessageIdFlag();
00098     QPID_COMMON_EXTERN void setCorrelationId(const std::string& _correlationId);
00099     QPID_COMMON_EXTERN const std::string& getCorrelationId() const;
00100     QPID_COMMON_EXTERN bool hasCorrelationId() const;
00101     QPID_COMMON_EXTERN void clearCorrelationIdFlag();
00102     QPID_COMMON_EXTERN void setReplyTo(const ReplyTo& _replyTo);
00103     QPID_COMMON_EXTERN const ReplyTo& getReplyTo() const;
00104     QPID_COMMON_EXTERN bool hasReplyTo() const;
00105     QPID_COMMON_EXTERN void clearReplyToFlag();
00106     QPID_COMMON_EXTERN void setContentType(const std::string& _contentType);
00107     QPID_COMMON_EXTERN const std::string& getContentType() const;
00108     QPID_COMMON_EXTERN bool hasContentType() const;
00109     QPID_COMMON_EXTERN void clearContentTypeFlag();
00110     QPID_COMMON_EXTERN void setContentEncoding(const std::string& _contentEncoding);
00111     QPID_COMMON_EXTERN const std::string& getContentEncoding() const;
00112     QPID_COMMON_EXTERN bool hasContentEncoding() const;
00113     QPID_COMMON_EXTERN void clearContentEncodingFlag();
00114     QPID_COMMON_EXTERN void setUserId(const std::string& _userId);
00115     QPID_COMMON_EXTERN const std::string& getUserId() const;
00116     QPID_COMMON_EXTERN bool hasUserId() const;
00117     QPID_COMMON_EXTERN void clearUserIdFlag();
00118     QPID_COMMON_EXTERN void setAppId(const std::string& _appId);
00119     QPID_COMMON_EXTERN const std::string& getAppId() const;
00120     QPID_COMMON_EXTERN bool hasAppId() const;
00121     QPID_COMMON_EXTERN void clearAppIdFlag();
00122     QPID_COMMON_EXTERN void setApplicationHeaders(const FieldTable& _applicationHeaders);
00123     QPID_COMMON_EXTERN const FieldTable& getApplicationHeaders() const;
00124     QPID_COMMON_EXTERN FieldTable& getApplicationHeaders();
00125     QPID_COMMON_EXTERN bool hasApplicationHeaders() const;
00126     QPID_COMMON_EXTERN void clearApplicationHeadersFlag();
00127     QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream&, const MessageProperties&);
00128     QPID_COMMON_EXTERN void encode(Buffer&) const;
00129     QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0);
00130     QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const;
00131     QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0);
00132     QPID_COMMON_EXTERN uint32_t encodedSize() const;
00133     QPID_COMMON_EXTERN uint32_t bodySize() const;
00134     QPID_COMMON_EXTERN void print(std::ostream& out) const;
00135 }; /* class MessageProperties */
00136 
00137 }}
00138 #endif  

Qpid C++ API Reference
Generated on Wed Dec 30 2015 for Qpid C++ Client API by doxygen 1.7.6.1