MongoDB C++ Driver 4.1.0
|
#include <bsoncxx/v_noabi/bsoncxx/vector/accessor.hpp>
Accessor for the contents of a valid BSON Binary Vector.
Format | One of the bsoncxx::v_noabi::vector::formats types, optionally with a const qualifier. |
This accessor operates on data formatted for the bsoncxx::v_noabi::binary_sub_type::k_vector BSON binary subtype. A mutable accessor may be constructed only using bsoncxx::v_noabi::builder::basic::sub_binary. A const accessor may be constructed by validating any bsoncxx::v_noabi::types::b_binary.
The specific iterator and element types vary for each supported format.
bsoncxx::v_noabi::vector::formats::f_float32 uses a custom element type to support packed storage with a fixed byte order.
bsoncxx::v_noabi::vector::formats::f_packed_bit uses a custom element and iterator type for single bits that unpacks them as bool. It also has custom element and iterator types for byte access, which serve to mask writes to reserved bits.
Public Types | |
using | byte_count_type |
Type for byte counts. | |
using | byte_difference_type |
Type for signed differences between byte iterators. | |
using | byte_iterator |
Byte iterator type. | |
using | byte_reference |
Type for referencing vector bytes in-place. | |
using | byte_type |
Type for the underlying byte data. | |
using | const_byte_iterator |
Iterator for const-qualified vector bytes. | |
using | const_byte_reference |
Type for referencing const-qualified vector bytes in-place. | |
using | const_iterator |
Iterator for const-qualified vector elements. | |
using | const_reference |
Type for referencing const-qualified vector elements in-place. | |
using | const_value_type |
Const qualified version of value_type. | |
using | element_count_type |
Type for element counts. | |
using | element_difference_type |
Type for signed differences between element iterators. | |
using | format = Format |
The type from bsoncxx::v_noabi::vector::formats representing this vector's layout and element type. | |
using | iterator |
Element iterator type. | |
using | reference |
Type for referencing vector elements in-place. | |
using | value_type |
A type suitable for holding element values. | |
Public Member Functions | |
accessor (types::b_binary const &binary) | |
Construct a const vector accessor by validating a bsoncxx::v_noabi::types::b_binary reference. | |
constexpr accessor< format const > | as_const () const noexcept |
Obtain a const version of this vector accessor, without re-validating the vector data. | |
reference | at (element_count_type index) |
Obtain a reference to a numbered element, with bounds checking. | |
const_reference | at (element_count_type index) const |
Obtain a const reference to a numbered element, with bounds checking. | |
constexpr const_reference | back () const noexcept |
Obtain a const reference to the last element. | |
reference | back () noexcept |
Obtain a reference to the last element. | |
constexpr iterator | begin () const noexcept |
Obtain a per-element iterator pointing to the beginning of the vector. | |
byte_reference | byte_at (byte_count_type index) |
Obtain a reference to a numbered byte, with bounds checking. | |
const_byte_reference | byte_at (byte_count_type index) const |
Obtain a const reference to a numbered byte, with bounds checking. | |
constexpr const_byte_reference | byte_back () const noexcept |
Obtain a const reference to the last byte. | |
byte_reference | byte_back () noexcept |
Obtain a reference to the last byte. | |
constexpr byte_iterator | byte_begin () const noexcept |
Obtain a per-byte iterator pointing to the beginning of the vector. | |
constexpr const_byte_iterator | byte_cbegin () const noexcept |
Obtain a const per-byte iterator pointing to the beginning of the vector. | |
constexpr const_byte_iterator | byte_cend () const noexcept |
Obtain a const per-byte end iterator. | |
constexpr byte_iterator | byte_end () const noexcept |
Obtain a per-byte end iterator. | |
constexpr const_byte_reference | byte_front () const noexcept |
Obtain a const reference to the first byte. | |
byte_reference | byte_front () noexcept |
Obtain a reference to the first byte. | |
constexpr byte_count_type | byte_size () const noexcept |
Count the bytes of element data, not including any headers. | |
constexpr const_iterator | cbegin () const noexcept |
Obtain a const per-element iterator pointing to the beginning of the vector. | |
constexpr const_iterator | cend () const noexcept |
Obtain a const per-element end iterator. | |
constexpr bool | empty () const noexcept |
Test whether the vector is empty. | |
constexpr iterator | end () const noexcept |
Obtain a per-element end iterator. | |
constexpr const_reference | front () const noexcept |
Obtain a const reference to the first element. | |
reference | front () noexcept |
Obtain a reference to the first element. | |
constexpr const_reference | operator[] (element_count_type index) const noexcept |
Obtain a const reference to a numbered element, without bounds checking. | |
reference | operator[] (element_count_type index) noexcept |
Obtain a reference to a numbered element, without bounds checking. | |
constexpr element_count_type | size () const noexcept |
Count the number of elements. | |
Friends | |
class | bsoncxx::v_noabi::builder::basic::sub_binary |
using bsoncxx::v_noabi::vector::accessor< Format >::byte_count_type |
Type for byte counts.
For example: std::uint32_t, due to BSON size limits.
using bsoncxx::v_noabi::vector::accessor< Format >::byte_difference_type |
Type for signed differences between byte iterators.
For example: std::ptrdiff_t
using bsoncxx::v_noabi::vector::accessor< Format >::byte_iterator |
Byte iterator type.
For example: std::uint8_t*, std::uint8_t const*, bsoncxx::v_noabi::vector::iterators::packed_bit_byte
using bsoncxx::v_noabi::vector::accessor< Format >::byte_reference |
Type for referencing vector bytes in-place.
For example: std::uint8_t&, std::uint8_t const&, bsoncxx::v_noabi::vector::elements::packed_bit_byte
using bsoncxx::v_noabi::vector::accessor< Format >::byte_type |
Type for the underlying byte data.
For example: std::uint8_t, std::uint8_t const
using bsoncxx::v_noabi::vector::accessor< Format >::const_byte_iterator |
Iterator for const-qualified vector bytes.
using bsoncxx::v_noabi::vector::accessor< Format >::const_byte_reference |
Type for referencing const-qualified vector bytes in-place.
using bsoncxx::v_noabi::vector::accessor< Format >::const_iterator |
Iterator for const-qualified vector elements.
using bsoncxx::v_noabi::vector::accessor< Format >::const_reference |
Type for referencing const-qualified vector elements in-place.
using bsoncxx::v_noabi::vector::accessor< Format >::const_value_type |
Const qualified version of value_type.
using bsoncxx::v_noabi::vector::accessor< Format >::element_count_type |
Type for element counts.
For example: std::size_t
using bsoncxx::v_noabi::vector::accessor< Format >::element_difference_type |
Type for signed differences between element iterators.
For example: std::ptrdiff_t
using bsoncxx::v_noabi::vector::accessor< Format >::format = Format |
The type from bsoncxx::v_noabi::vector::formats representing this vector's layout and element type.
using bsoncxx::v_noabi::vector::accessor< Format >::iterator |
Element iterator type.
For example: std::int8_t*, bsoncxx::v_noabi::vector::elements::float32*, bsoncxx::v_noabi::vector::iterators::packed_bit_element
using bsoncxx::v_noabi::vector::accessor< Format >::reference |
Type for referencing vector elements in-place.
For example: std::int8_t&, bsoncxx::v_noabi::vector::elements::float32&, bsoncxx::v_noabi::vector::elements::packed_bit_element
using bsoncxx::v_noabi::vector::accessor< Format >::value_type |
A type suitable for holding element values.
For example: std::int8_t, float, bool
|
inline |
Construct a const vector accessor by validating a bsoncxx::v_noabi::types::b_binary reference.
binary | Non-owning reference to BSON binary data |
bsoncxx::v_noabi::exception | with bsoncxx::v_noabi::error_code::k_invalid_vector, if validation fails. |
The Binary data is validated as a vector of the templated Format. On success, an accessor is created which references the same data as the bsoncxx::v_noabi::types::b_binary pointer.
|
inlineconstexprnoexcept |
Obtain a const version of this vector accessor, without re-validating the vector data.
|
inline |
Obtain a reference to a numbered element, with bounds checking.
index | Index in the range 0 to size()-1 inclusive. |
bsoncxx::v_noabi::exception | with bsoncxx::v_noabi::error_code::k_vector_out_of_range, if the index is outside the allowed range. |
|
inline |
Obtain a const reference to a numbered element, with bounds checking.
index | Index in the range 0 to size()-1 inclusive. |
bsoncxx::v_noabi::exception | with bsoncxx::v_noabi::error_code::k_vector_out_of_range, if the index is outside the allowed range. |
|
inlineconstexprnoexcept |
Obtain a const reference to the last element.
|
inlinenoexcept |
Obtain a reference to the last element.
|
inlineconstexprnoexcept |
Obtain a per-element iterator pointing to the beginning of the vector.
|
inline |
Obtain a reference to a numbered byte, with bounds checking.
index | Index in the range 0 to byte_size()-1 inclusive. |
bsoncxx::v_noabi::exception | with bsoncxx::v_noabi::error_code::k_vector_out_of_range, if the index is outside the allowed range. |
|
inline |
Obtain a const reference to a numbered byte, with bounds checking.
index | Index in the range 0 to byte_size()-1 inclusive. |
bsoncxx::v_noabi::exception | with bsoncxx::v_noabi::error_code::k_vector_out_of_range, if the index is outside the allowed range. |
|
inlineconstexprnoexcept |
Obtain a const reference to the last byte.
|
inlinenoexcept |
Obtain a reference to the last byte.
|
inlineconstexprnoexcept |
Obtain a per-byte iterator pointing to the beginning of the vector.
|
inlineconstexprnoexcept |
Obtain a const per-byte iterator pointing to the beginning of the vector.
|
inlineconstexprnoexcept |
Obtain a const per-byte end iterator.
|
inlineconstexprnoexcept |
Obtain a per-byte end iterator.
|
inlineconstexprnoexcept |
Obtain a const reference to the first byte.
|
inlinenoexcept |
Obtain a reference to the first byte.
|
inlineconstexprnoexcept |
Count the bytes of element data, not including any headers.
|
inlineconstexprnoexcept |
Obtain a const per-element iterator pointing to the beginning of the vector.
|
inlineconstexprnoexcept |
Obtain a const per-element end iterator.
|
inlineconstexprnoexcept |
Test whether the vector is empty.
|
inlineconstexprnoexcept |
Obtain a per-element end iterator.
|
inlineconstexprnoexcept |
Obtain a const reference to the first element.
|
inlinenoexcept |
Obtain a reference to the first element.
|
inlineconstexprnoexcept |
Obtain a const reference to a numbered element, without bounds checking.
index | Index in the range 0 to size()-1 inclusive. |
|
inlinenoexcept |
Obtain a reference to a numbered element, without bounds checking.
index | Index in the range 0 to size()-1 inclusive. |
|
inlineconstexprnoexcept |
Count the number of elements.