1#ifndef PROTON_BYTE_ARRAY_HPP
2#define PROTON_BYTE_ARRAY_HPP
23#include "./internal/export.hpp"
24#include "./internal/comparable.hpp"
27#include <proton/type_compat.h>
38PN_CPP_EXTERN
void print_hex(std::ostream& o,
const uint8_t* p,
size_t n);
45template <
size_t N>
class byte_array :
private internal::comparable<byte_array<N> > {
49 typedef uint8_t value_type;
50 typedef value_type* pointer;
51 typedef const value_type* const_pointer;
52 typedef value_type& reference;
53 typedef const value_type& const_reference;
54 typedef value_type* iterator;
55 typedef const value_type* const_iterator;
56 typedef std::size_t size_type;
57 typedef std::ptrdiff_t difference_type;
58 typedef std::reverse_iterator<iterator> reverse_iterator;
59 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
66 static size_t size() {
return N; }
70 value_type* begin() {
return bytes_; }
71 value_type* end() {
return bytes_+N; }
72 value_type& operator[](
size_t i) {
return bytes_[i]; }
74 const value_type* begin()
const {
return bytes_; }
75 const value_type* end()
const {
return bytes_+N; }
76 const value_type& operator[](
size_t i)
const {
return bytes_[i]; }
82 return std::equal(x.begin(), x.end(), y.begin());
86 return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
92 internal::print_hex(o, b.begin(), b.
size());
Arbitrary fixed-size data.
Definition: byte_array.hpp:45
byte_array()
Zero-initialized byte array.
Definition: byte_array.hpp:63
static size_t size()
Size of the array.
Definition: byte_array.hpp:66
friend std::ostream & operator<<(std::ostream &o, const byte_array &b)
Print byte array in hex.
Definition: byte_array.hpp:91
The main Proton namespace.
Definition: annotation_key.hpp:33
Forward declarations for Proton types used to represent AMQP types.