00001 #ifndef PROTON_ANNOTATION_KEY_HPP
00002 #define PROTON_ANNOTATION_KEY_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 "./internal/scalar_base.hpp"
00026 #include "./symbol.hpp"
00027
00028 namespace proton {
00029
00033 class annotation_key : public internal::scalar_base {
00034 public:
00035 using internal::scalar_base::type;
00036
00038 annotation_key() { put_(uint64_t(0)); }
00039
00041 template <class T> annotation_key(const T& x) { *this = x; }
00042
00045 annotation_key& operator=(uint64_t x) { put_(x); return *this; }
00046 annotation_key& operator=(const symbol& x) { put_(x); return *this; }
00048
00051 annotation_key& operator=(const std::string& x) { put_(symbol(x)); return *this; }
00052 annotation_key& operator=(const char *x) { put_(symbol(x)); return *this; }
00054
00056 friend class message;
00057 friend class codec::decoder;
00059 };
00060
00063 template <class T> T get(const annotation_key& x);
00065
00069 template<> inline uint64_t get<uint64_t>(const annotation_key& x) { return internal::get<uint64_t>(x); }
00070
00074 template<> inline symbol get<symbol>(const annotation_key& x) { return internal::get<symbol>(x); }
00075
00080 template<class T> T coerce(const annotation_key& x) { return internal::coerce<T>(x); }
00081
00082 }
00083
00084 #endif // PROTON_ANNOTATION_KEY_HPP