A key for use with AMQP annotation maps. More...
#include <annotation_key.hpp>
Public Member Functions | |
annotation_key () | |
An empty annotation key. | |
template<class T > | |
annotation_key (const T &x) | |
Construct from any type that can be assigned. | |
type_id | type () const |
AMQP type of data stored in the scalar. | |
bool | empty () const |
True if there is no value, i.e. type() == NULL_TYPE. | |
Assign from a uint64_t or symbol. | |
annotation_key & | operator= (uint64_t x) |
annotation_key & | operator= (const symbol &x) |
Extra conversions for strings, treated as codec::SYMBOL. | |
annotation_key & | operator= (const std::string &x) |
annotation_key & | operator= (const char *x) |
Friends | |
bool | operator< (const scalar_base &x, const scalar_base &y) |
Compare. | |
bool | operator== (const scalar_base &x, const scalar_base &y) |
Compare. | |
std::ostream & | operator<< (std::ostream &o, const scalar_base &x) |
Print the contained value. | |
Related Functions | |
(Note that these are not member functions.) | |
template<> | |
uint64_t | get (const annotation_key &x) |
Get the uint64_t value or throw conversion_error. | |
template<> | |
symbol | get (const annotation_key &x) |
Get the symbol value or throw conversion_error. | |
template<class T > | |
T | coerce (const annotation_key &x) |
Get the binary value or throw conversion_error. |
A key for use with AMQP annotation maps.
An annotation_key can contain either a uint64_t or a proton::symbol.
T coerce | ( | const annotation_key & | x | ) | [related] |
Get the binary value or throw conversion_error.
Coerce the contained value to type T. For example:uint64_t i = coerce<uint64_t>(x)This will succeed if x contains any numeric value, but may lose precision if it contains a float or double value.
conversion_error | if the value cannot be converted to T according to `stdis_convertible` |