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 "./internal/scalar_base.hpp"
00027 #include "./uuid.hpp"
00028
00029 #include <string>
00030
00031 namespace proton {
00032
00042 class message_id : public internal::scalar_base {
00043 public:
00045 message_id() { put_(uint64_t(0)); }
00046
00048 template <class T> message_id(const T& x) { *this = x; }
00049
00054 message_id& operator=(uint64_t x) { put_(x); return *this; }
00055 message_id& operator=(const uuid& x) { put_(x); return *this; }
00056 message_id& operator=(const binary& x) { put_(x); return *this; }
00057 message_id& operator=(const std::string& x) { put_(x); return *this; }
00058 message_id& operator=(const char* x) { put_(x); return *this; }
00059
00060
00061 private:
00062 message_id(const pn_atom_t& a): internal::scalar_base(a) {}
00063
00065 friend class message;
00066 friend class codec::decoder;
00068 };
00069
00072 template <class T> T get(const message_id& x);
00074
00076 template<> inline uint64_t get<uint64_t>(const message_id& x) { return internal::get<uint64_t>(x); }
00078 template<> inline uuid get<uuid>(const message_id& x) { return internal::get<uuid>(x); }
00080 template<> inline binary get<binary>(const message_id& x) { return internal::get<binary>(x); }
00082 template<> inline std::string get<std::string>(const message_id& x) { return internal::get<std::string>(x); }
00083
00086 template<class T> T coerce(const message_id& x) { return internal::coerce<T>(x); }
00087
00088 }
00089
00090 #endif // PROTON_MESSAGE_ID_HPP