sparrow 0.9.0
Loading...
Searching...
No Matches
sparrow::fixed_width_binary_reference< L > Class Template Reference

#include <fixed_width_binary_reference.hpp>

Public Types

using self_type = fixed_width_binary_reference<L>
 
using value_type = typename L::inner_value_type
 
using reference = typename L::inner_reference
 
using const_reference = typename L::inner_const_reference
 
using size_type = typename L::size_type
 
using difference_type = std::ptrdiff_t
 
using iterator = typename L::data_iterator
 
using const_iterator = typename L::const_data_iterator
 

Public Member Functions

constexpr fixed_width_binary_reference (L *layout, size_type index)
 Constructs a binary reference for the given layout and index.
 
constexpr fixed_width_binary_reference (const fixed_width_binary_reference &) noexcept=default
 
constexpr fixed_width_binary_reference (fixed_width_binary_reference &&) noexcept=default
 
template<std::ranges::sized_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
constexpr self_typeoperator= (T &&rhs)
 Assignment from a sized range of binary data.
 
constexpr size_type size () const
 Gets the size of the binary element in bytes.
 
constexpr iterator begin ()
 Gets mutable iterator to the beginning of binary data.
 
constexpr iterator end ()
 Gets mutable iterator to the end of binary data.
 
constexpr const_iterator begin () const
 Gets const iterator to the beginning of binary data.
 
constexpr const_iterator end () const
 Gets const iterator to the end of binary data.
 
constexpr const_iterator cbegin () const
 Gets const iterator to the beginning of binary data.
 
constexpr const_iterator cend () const
 Gets const iterator to the end of binary data.
 
template<std::ranges::input_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
constexpr bool operator== (const T &rhs) const
 Equality comparison with another range of binary data.
 
template<std::ranges::input_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
constexpr auto operator<=> (const T &rhs) const
 Three-way comparison with another range of binary data.
 
template<std::ranges::sized_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
constexpr auto operator= (T &&rhs) -> self_type &
 

Detailed Description

template<class L>
class sparrow::fixed_width_binary_reference< L >
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 81 of file fixed_width_binary_reference.hpp.

Member Typedef Documentation

◆ const_iterator

template<class L>
using sparrow::fixed_width_binary_reference< L >::const_iterator = typename L::const_data_iterator

◆ const_reference

template<class L>
using sparrow::fixed_width_binary_reference< L >::const_reference = typename L::inner_const_reference

◆ difference_type

template<class L>
using sparrow::fixed_width_binary_reference< L >::difference_type = std::ptrdiff_t

Definition at line 90 of file fixed_width_binary_reference.hpp.

◆ iterator

template<class L>
using sparrow::fixed_width_binary_reference< L >::iterator = typename L::data_iterator

◆ reference

template<class L>
using sparrow::fixed_width_binary_reference< L >::reference = typename L::inner_reference

◆ self_type

◆ size_type

◆ value_type

template<class L>
using sparrow::fixed_width_binary_reference< L >::value_type = typename L::inner_value_type

Constructor & Destructor Documentation

◆ fixed_width_binary_reference() [1/3]

template<class L>
sparrow::fixed_width_binary_reference< L >::fixed_width_binary_reference ( L * layout,
size_type index )
constexpr

Constructs a binary reference for the given layout and index.

Parameters
layoutPointer to the layout containing the binary data
indexIndex of the binary element in the layout
Precondition
layout must not be nullptr
index must be valid within the layout bounds
Postcondition
Reference is bound to the specified element
Layout pointer and index are stored for future operations
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 277 of file fixed_width_binary_reference.hpp.

◆ fixed_width_binary_reference() [2/3]

template<class L>
sparrow::fixed_width_binary_reference< L >::fixed_width_binary_reference ( const fixed_width_binary_reference< L > & )
constexprdefaultnoexcept

◆ fixed_width_binary_reference() [3/3]

template<class L>
sparrow::fixed_width_binary_reference< L >::fixed_width_binary_reference ( fixed_width_binary_reference< L > && )
constexprdefaultnoexcept

Member Function Documentation

◆ begin() [1/2]

template<class L>
auto sparrow::fixed_width_binary_reference< L >::begin ( )
nodiscardconstexpr

Gets mutable iterator to the beginning of binary data.

Returns
Iterator pointing to the first byte of the element
Postcondition
Iterator is valid for reading and writing binary data
Iterator range spans exactly size() bytes
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 301 of file fixed_width_binary_reference.hpp.

◆ begin() [2/2]

template<class L>
auto sparrow::fixed_width_binary_reference< L >::begin ( ) const
nodiscardconstexpr

Gets const iterator to the beginning of binary data.

Returns
Const iterator pointing to the first byte of the element
Postcondition
Iterator is valid for reading binary data
Equivalent to cbegin()

Definition at line 313 of file fixed_width_binary_reference.hpp.

Here is the call graph for this function:

◆ cbegin()

template<class L>
auto sparrow::fixed_width_binary_reference< L >::cbegin ( ) const
nodiscardconstexpr

Gets const iterator to the beginning of binary data.

Returns
Const iterator pointing to the first byte of the element
Postcondition
Iterator is valid for reading binary data
Guarantees const access even for mutable reference
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 325 of file fixed_width_binary_reference.hpp.

Here is the caller graph for this function:

◆ cend()

template<class L>
auto sparrow::fixed_width_binary_reference< L >::cend ( ) const
nodiscardconstexpr

Gets const iterator to the end of binary data.

Returns
Const iterator pointing past the last byte of the element
Postcondition
Iterator marks the end of the binary data range
Guarantees const access even for mutable reference
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 331 of file fixed_width_binary_reference.hpp.

Here is the caller graph for this function:

◆ end() [1/2]

template<class L>
auto sparrow::fixed_width_binary_reference< L >::end ( )
nodiscardconstexpr

Gets mutable iterator to the end of binary data.

Returns
Iterator pointing past the last byte of the element
Postcondition
Iterator marks the end of the binary data range
Distance from begin() to end() equals size()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 307 of file fixed_width_binary_reference.hpp.

◆ end() [2/2]

template<class L>
auto sparrow::fixed_width_binary_reference< L >::end ( ) const
nodiscardconstexpr

Gets const iterator to the end of binary data.

Returns
Const iterator pointing past the last byte of the element
Postcondition
Iterator marks the end of the binary data range
Equivalent to cend()

Definition at line 319 of file fixed_width_binary_reference.hpp.

Here is the call graph for this function:

◆ operator<=>()

template<class L>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
template<std::ranges::input_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
auto sparrow::fixed_width_binary_reference< L >::operator<=> ( const T & rhs) const
constexpr

Three-way comparison with another range of binary data.

Performs lexicographical comparison of this binary element with another range.

Template Parameters
TType of the range to compare with
Parameters
rhsRange to compare with
Returns
Ordering result of lexicographical comparison
Precondition
T must be an input range convertible to L::inner_value_type
Postcondition
Comparison is performed lexicographically
Returns ordering consistent with lexicographical_compare_three_way
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 347 of file fixed_width_binary_reference.hpp.

◆ operator=() [1/2]

template<class L>
template<std::ranges::sized_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
self_type & sparrow::fixed_width_binary_reference< L >::operator= ( T && rhs)
constexpr

Assignment from a sized range of binary data.

Assigns new binary data to the referenced element. The source range must have exactly the same size as the fixed width of this binary type.

Template Parameters
TType of the source range
Parameters
rhsSource range to assign from
Returns
Reference to this object
Precondition
T must be a sized range convertible to L::inner_value_type
rhs.size() must equal the fixed element size
Layout must remain valid during assignment
Index must be within layout bounds
Postcondition
Underlying layout element is assigned the data from rhs
Layout buffers are updated to reflect changes
Note
Internal assertion: SPARROW_ASSERT_TRUE(p_layout->m_element_size == std::ranges::size(rhs))
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

◆ operator=() [2/2]

template<class L>
template<std::ranges::sized_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
auto sparrow::fixed_width_binary_reference< L >::operator= ( T && rhs) -> self_type&
constexpr

Definition at line 286 of file fixed_width_binary_reference.hpp.

◆ operator==()

template<class L>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
template<std::ranges::input_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
bool sparrow::fixed_width_binary_reference< L >::operator== ( const T & rhs) const
constexpr

Equality comparison with another range of binary data.

Compares this binary element with another range byte-by-byte.

Template Parameters
TType of the range to compare with
Parameters
rhsRange to compare with
Returns
true if all bytes are equal, false otherwise
Precondition
T must be an input range convertible to L::inner_value_type
Postcondition
Comparison is performed element-wise using std::equal
Returns true iff ranges have same content
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 339 of file fixed_width_binary_reference.hpp.

Here is the call graph for this function:

◆ size()

template<class L>
auto sparrow::fixed_width_binary_reference< L >::size ( ) const
nodiscardconstexpr

Gets the size of the binary element in bytes.

Returns
Number of bytes in the fixed-width binary element
Postcondition
Returns the fixed element size for this binary type
Value is consistent across all elements in the layout
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/fixed_width_binary_reference.hpp.

Definition at line 295 of file fixed_width_binary_reference.hpp.


The documentation for this class was generated from the following file: