00001 #ifndef PROTON_MESSAGE_ID_HPP
00002 #define PROTON_MESSAGE_ID_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "./binary.hpp"
00026 #include "./scalar_base.hpp"
00027 #include "./uuid.hpp"
00028
00029 #include <proton/type_compat.h>
00030
00031 #include <string>
00032
00035
00036 namespace proton {
00037
00047 class message_id : public scalar_base {
00048 public:
00050 message_id() {}
00051
00053 template <class T> message_id(const T& x) { *this = x; }
00054
00059 message_id& operator=(uint64_t x) { put_(x); return *this; }
00060 message_id& operator=(const uuid& x) { put_(x); return *this; }
00061 message_id& operator=(const binary& x) { put_(x); return *this; }
00062 message_id& operator=(const std::string& x) { put_(x); return *this; }
00063 message_id& operator=(const char* x) { put_(x); return *this; }
00064
00065
00066 private:
00067 message_id(const pn_atom_t& a): scalar_base(a) {}
00068
00070 friend class message;
00071 friend class codec::decoder;
00073 };
00074
00077 template <class T> T get(const message_id& x);
00079
00081 template<> inline uint64_t get<uint64_t>(const message_id& x) { return internal::get<uint64_t>(x); }
00083 template<> inline uuid get<uuid>(const message_id& x) { return internal::get<uuid>(x); }
00085 template<> inline binary get<binary>(const message_id& x) { return internal::get<binary>(x); }
00087 template<> inline std::string get<std::string>(const message_id& x) { return internal::get<std::string>(x); }
00088
00091 template<class T> T coerce(const message_id& x) { return internal::coerce<T>(x); }
00092
00093 }
00094
00095 #endif // PROTON_MESSAGE_ID_HPP