annotation_key.hpp
#ifndef PROTON_ANNOTATION_KEY_HPP
#define PROTON_ANNOTATION_KEY_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 "./internal/scalar_base.hpp"
#include "./symbol.hpp"
namespace proton {
class annotation_key : public internal::scalar_base {
public:
using internal::scalar_base::type;
annotation_key() { put_(uint64_t(0)); }
template <class T> annotation_key(const T& x) { *this = x; }
annotation_key& operator=(uint64_t x) { put_(x); return *this; }
annotation_key& operator=(const symbol& x) { put_(x); return *this; }
annotation_key& operator=(const std::string& x) { put_(symbol(x)); return *this; }
annotation_key& operator=(const char *x) { put_(symbol(x)); return *this; }
friend class message;
friend class codec::decoder;
};
template <class T> T get(const annotation_key& x);
template<> inline uint64_t get<uint64_t>(const annotation_key& x) { return internal::get<uint64_t>(x); }
template<> inline symbol get<symbol>(const annotation_key& x) { return internal::get<symbol>(x); }
template<class T> T coerce(const annotation_key& x) { return internal::coerce<T>(x); }
} // proton
#endif // PROTON_ANNOTATION_KEY_HPP
proton::message
An AMQP message.
Definition: message.hpp:51
proton::annotation_key
A key for use with AMQP annotation maps.
Definition: annotation_key.hpp:33
proton::annotation_key::annotation_key
annotation_key(const T &x)
Construct from any type that can be assigned.
Definition: annotation_key.hpp:41
proton::symbol
A std::string that represents the AMQP symbol type.
Definition: symbol.hpp:30
proton::annotation_key::coerce
T coerce(const annotation_key &x)
Get the binary value or throw conversion_error.
Definition: annotation_key.hpp:80
proton::annotation_key::annotation_key
annotation_key()
An empty annotation key has a uint64_t == 0 value.
Definition: annotation_key.hpp:38
proton
Type traits for mapping between AMQP and C++ types.
Definition: annotation_key.hpp:28
proton::codec::decoder
Experimental - Stream-like decoder from AMQP bytes to C++ values.
Definition: decoder.hpp:51