proton/message_id.hpp

Go to the documentation of this file.
00001 #ifndef PROTON_MESSAGE_ID_HPP
00002 #define PROTON_MESSAGE_ID_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 "./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 } // proton
00094 
00095 #endif // PROTON_MESSAGE_ID_HPP

Generated on 28 Nov 2017 for Qpid Proton C++ by  doxygen 1.6.1