message_id.hpp
Go to the documentation of this file.
#ifndef PROTON_MESSAGE_ID_HPP
#define PROTON_MESSAGE_ID_HPP
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include "./binary.hpp"
#include "./scalar_base.hpp"
#include "./uuid.hpp"
#include <proton/type_compat.h>
#include <string>
namespace proton {
class message_id : public scalar_base {
public:
message_id() {}
template <class T> message_id(const T& x) { *this = x; }
message_id& operator=(uint64_t x) { put_(x); return *this; }
message_id& operator=(const uuid& x) { put_(x); return *this; }
message_id& operator=(const binary& x) { put_(x); return *this; }
message_id& operator=(const std::string& x) { put_(x); return *this; }
message_id& operator=(const char* x) { put_(x); return *this; }
private:
message_id(const pn_atom_t& a): scalar_base(a) {}
friend class message;
friend class codec::decoder;
};
template <class T> T get(const message_id& x);
template<> inline uint64_t get<uint64_t>(const message_id& x) { return internal::get<uint64_t>(x); }
template<> inline uuid get<uuid>(const message_id& x) { return internal::get<uuid>(x); }
template<> inline binary get<binary>(const message_id& x) { return internal::get<binary>(x); }
template<> inline std::string get<std::string>(const message_id& x) { return internal::get<std::string>(x); }
template<class T> T coerce(const message_id& x) { return internal::coerce<T>(x); }
} // proton
#endif // PROTON_MESSAGE_ID_HPP
proton::scalar_base
The base class for scalar types.
Definition: scalar_base.hpp:60
proton::message_id
An AMQP message ID.
Definition: message_id.hpp:47
uuid.hpp
proton::get< binary >
binary get< binary >(const message_id &x)
Get the binary value or throw conversion_error.
Definition: message_id.hpp:85
scalar_base.hpp
proton::message_id::message_id
message_id()
An empty message_id.
Definition: message_id.hpp:50
proton::coerce
T coerce(const annotation_key &x)
Get the binary value or throw conversion_error.
Definition: annotation_key.hpp:83
proton::get
T get(const scalar &s)
Get a contained value of type T.
Definition: scalar.hpp:58
proton::message_id::operator=
message_id & operator=(const char *x)
Treated as amqp::STRING.
Definition: message_id.hpp:63
proton::get< uint64_t >
uint64_t get< uint64_t >(const annotation_key &x)
Get the uint64_t value or throw conversion_error.
Definition: annotation_key.hpp:72
proton::get< uuid >
uuid get< uuid >(const message_id &x)
Get the uuid value or throw conversion_error.
Definition: message_id.hpp:83
proton::uuid
A 16-byte universally unique identifier.
Definition: uuid.hpp:37
proton
The main Proton namespace.
Definition: annotation_key.hpp:33
binary.hpp
proton::message_id::message_id
message_id(const T &x)
Construct from any type that can be assigned.
Definition: message_id.hpp:53
proton::get< uint64_t >
uint64_t get< uint64_t >(const message_id &x)
Get the uint64_t value or throw conversion_error.
Definition: message_id.hpp:81
proton::binary
Arbitrary binary data.
Definition: binary.hpp:40