proton/message.hpp

Go to the documentation of this file.
00001 #ifndef PROTON_MESSAGE_HPP
00002 #define PROTON_MESSAGE_HPP
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include "./fwd.hpp"
00026 #include "./internal/export.hpp"
00027 #include "./duration.hpp"
00028 #include "./timestamp.hpp"
00029 #include "./value.hpp"
00030 #include "./map.hpp"
00031 
00032 #include "./internal/pn_unique_ptr.hpp"
00033 
00034 #include <proton/type_compat.h>
00035 
00036 #include <string>
00037 #include <vector>
00038 
00041 
00042 struct pn_message_t;
00043 
00044 namespace proton {
00045 
00050 class message {
00051   public:
00053     typedef map<std::string, scalar> property_map;
00054 
00056     typedef map<annotation_key, value> annotation_map;
00057 
00059     PN_CPP_EXTERN message();
00060 
00062     PN_CPP_EXTERN message(const message&);
00063 
00065     PN_CPP_EXTERN message& operator=(const message&);
00066 
00067 #if PN_CPP_HAS_RVALUE_REFERENCES
00069     PN_CPP_EXTERN message(message&&);
00070 
00072     PN_CPP_EXTERN message& operator=(message&&);
00073 #endif
00074 
00077     PN_CPP_EXTERN message(const value& x);
00078 
00079     PN_CPP_EXTERN ~message();
00080 
00083 
00085     PN_CPP_EXTERN void clear();
00086 
00091     PN_CPP_EXTERN void id(const message_id&);
00092 
00094     PN_CPP_EXTERN message_id id() const;
00095 
00097     PN_CPP_EXTERN void user(const std::string&);
00098 
00100     PN_CPP_EXTERN std::string user() const;
00101 
00104     PN_CPP_EXTERN void encode(std::vector<char>&) const;
00105 
00107     PN_CPP_EXTERN std::vector<char> encode() const;
00108 
00110     PN_CPP_EXTERN void decode(const std::vector<char>&);
00111 
00113 
00116 
00118     PN_CPP_EXTERN void to(const std::string&);
00119 
00121     PN_CPP_EXTERN std::string to() const;
00122 
00125     PN_CPP_EXTERN void address(const std::string&);
00126     PN_CPP_EXTERN std::string address() const;
00128 
00130     PN_CPP_EXTERN void reply_to(const std::string&);
00131 
00133     PN_CPP_EXTERN std::string reply_to() const;
00134 
00136     PN_CPP_EXTERN void correlation_id(const message_id&);
00137 
00139     PN_CPP_EXTERN message_id correlation_id() const;
00140 
00142 
00145 
00147     PN_CPP_EXTERN void body(const value& x);
00148 
00150     PN_CPP_EXTERN const value& body() const;
00151 
00153     PN_CPP_EXTERN value& body();
00154 
00156     PN_CPP_EXTERN void subject(const std::string&);
00157 
00159     PN_CPP_EXTERN std::string subject() const;
00160 
00162     PN_CPP_EXTERN void content_type(const std::string&);
00163 
00165     PN_CPP_EXTERN std::string content_type() const;
00166 
00168     PN_CPP_EXTERN void content_encoding(const std::string&);
00169 
00171     PN_CPP_EXTERN std::string content_encoding() const;
00172 
00174     PN_CPP_EXTERN void expiry_time(timestamp);
00175 
00177     PN_CPP_EXTERN timestamp expiry_time() const;
00178 
00180     PN_CPP_EXTERN void creation_time(timestamp);
00181 
00183     PN_CPP_EXTERN timestamp creation_time() const;
00184 
00194     PN_CPP_EXTERN bool inferred() const;
00195 
00197     PN_CPP_EXTERN void inferred(bool);
00198 
00200 
00203 
00208     PN_CPP_EXTERN bool durable() const;
00209 
00211     PN_CPP_EXTERN void durable(bool);
00212 
00220     PN_CPP_EXTERN duration ttl() const;
00221 
00223     PN_CPP_EXTERN void ttl(duration);
00224 
00232     PN_CPP_EXTERN uint8_t priority() const;
00233 
00235     PN_CPP_EXTERN void priority(uint8_t);
00236 
00245 
00246     // XXX The triple-not in the last sentence above is confusing.
00247 
00248     PN_CPP_EXTERN bool first_acquirer() const;
00249 
00251     PN_CPP_EXTERN void first_acquirer(bool);
00252 
00257     PN_CPP_EXTERN uint32_t delivery_count() const;
00258 
00260     PN_CPP_EXTERN void delivery_count(uint32_t);
00261 
00263 
00266 
00268     PN_CPP_EXTERN void group_id(const std::string&);
00269 
00271     PN_CPP_EXTERN std::string group_id() const;
00272 
00274     PN_CPP_EXTERN void reply_to_group_id(const std::string&);
00275 
00277     PN_CPP_EXTERN std::string reply_to_group_id() const;
00278 
00284     PN_CPP_EXTERN int32_t group_sequence() const;
00285 
00287     PN_CPP_EXTERN void group_sequence(int32_t);
00288 
00290 
00293 
00296     PN_CPP_EXTERN property_map& properties();
00297 
00299     PN_CPP_EXTERN const property_map& properties() const;
00300 
00303     PN_CPP_EXTERN annotation_map& message_annotations();
00304 
00306     PN_CPP_EXTERN const annotation_map& message_annotations() const;
00307 
00310     PN_CPP_EXTERN annotation_map& delivery_annotations();
00311 
00313     PN_CPP_EXTERN const annotation_map& delivery_annotations() const;
00314 
00316 
00318     PN_CPP_EXTERN static const uint8_t default_priority;
00319 
00321   private:
00322     struct impl;
00323     pn_message_t* pn_msg() const;
00324     struct impl& impl() const;
00325 
00326     mutable pn_message_t* pn_msg_;
00327 
00328   PN_CPP_EXTERN friend void swap(message&, message&);
00330 };
00331 
00332 } // proton
00333 
00334 #endif // PROTON_MESSAGE_HPP

Generated on 29 Mar 2018 for Qpid Proton C++ by  doxygen 1.6.1