sparrow 1.0.0
Loading...
Searching...
No Matches
sparrow::variable_size_binary_reference< L > Class Template Reference

#include <variable_size_binary_reference.hpp>

Public Types

using self_type = variable_size_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
 
using offset_type = typename L::offset_type
 

Public Member Functions

constexpr variable_size_binary_reference (L *layout, size_type index)
 Constructs a variable-size binary reference for the given layout and index.
 
constexpr variable_size_binary_reference (const variable_size_binary_reference &)=default
 
constexpr variable_size_binary_reference (variable_size_binary_reference &&)=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.
 
template<class U = typename L::inner_value_type>
requires std::assignable_from<U&, const char*>
constexpr self_typeoperator= (const char *rhs)
 Assignment from a C-string.
 
constexpr size_type size () const
 Gets the size of the binary element in bytes/characters.
 
constexpr bool empty () const
 Checks if the binary element is empty.
 
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<class U = typename L::inner_value_type>
requires std::assignable_from<U&, const char*>
constexpr bool operator== (const char *rhs) const
 Equality comparison with a C-string.
 
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<class U = typename L::inner_value_type>
requires std::assignable_from<U&, const char*>
constexpr auto operator<=> (const char *rhs) const
 Three-way comparison with a C-string.
 
template<std::ranges::sized_range T>
requires mpl::convertible_ranges<T, typename L::inner_value_type>
constexpr auto operator= (T &&rhs) -> self_type &
 
template<class U>
requires std::assignable_from<U&, const char*>
constexpr auto operator= (const char *rhs) -> self_type &
 

Detailed Description

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

Definition at line 89 of file variable_size_binary_reference.hpp.

Member Typedef Documentation

◆ const_iterator

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

◆ const_reference

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

◆ difference_type

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

Definition at line 98 of file variable_size_binary_reference.hpp.

◆ iterator

◆ offset_type

◆ reference

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

◆ self_type

◆ size_type

◆ value_type

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

Constructor & Destructor Documentation

◆ variable_size_binary_reference() [1/3]

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

Constructs a variable-size 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/variable_size_binary_reference.hpp.

Definition at line 380 of file variable_size_binary_reference.hpp.

◆ variable_size_binary_reference() [2/3]

template<class L>
sparrow::variable_size_binary_reference< L >::variable_size_binary_reference ( const variable_size_binary_reference< L > & )
constexprdefault

◆ variable_size_binary_reference() [3/3]

template<class L>
sparrow::variable_size_binary_reference< L >::variable_size_binary_reference ( variable_size_binary_reference< L > && )
constexprdefault

Member Function Documentation

◆ begin() [1/2]

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

Gets mutable iterator to the beginning of binary data.

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

Definition at line 417 of file variable_size_binary_reference.hpp.

◆ begin() [2/2]

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

Gets const iterator to the beginning of binary data.

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

Definition at line 429 of file variable_size_binary_reference.hpp.

Here is the call graph for this function:

◆ cbegin()

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

Gets const iterator to the beginning of binary data.

Returns
Const iterator pointing to the first byte/character 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/variable_size_binary_reference.hpp.

Definition at line 441 of file variable_size_binary_reference.hpp.

Here is the caller graph for this function:

◆ cend()

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

Gets const iterator to the end of binary data.

Returns
Const iterator pointing past the last byte/character 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/variable_size_binary_reference.hpp.

Definition at line 447 of file variable_size_binary_reference.hpp.

Here is the caller graph for this function:

◆ empty()

template<class L>
auto sparrow::variable_size_binary_reference< L >::empty ( ) const
nodiscardconstexpr

Checks if the binary element is empty.

Returns
true if element contains no data, false otherwise
Postcondition
Return value equals (size() == 0)
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/variable_size_binary_reference.hpp.

Definition at line 411 of file variable_size_binary_reference.hpp.

Here is the call graph for this function:

◆ end() [1/2]

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

Gets mutable iterator to the end of binary data.

Returns
Iterator pointing past the last byte/character 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/variable_size_binary_reference.hpp.

Definition at line 423 of file variable_size_binary_reference.hpp.

◆ end() [2/2]

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

Gets const iterator to the end of binary data.

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

Definition at line 435 of file variable_size_binary_reference.hpp.

Here is the call graph for this function:

◆ operator<=>() [1/2]

template<class L>
requires std::assignable_from<U&, const char*>
template<class U>
requires std::assignable_from<U&, const char*>
auto sparrow::variable_size_binary_reference< L >::operator<=> ( const char * rhs) const
constexpr

Three-way comparison with a C-string.

Special overload for comparing with C-strings, converting the C-string to a string_view for proper lexicographical comparison.

Template Parameters
UValue type (deduced, must be assignable from const char*)
Parameters
rhsC-string to compare with
Returns
Ordering result of lexicographical comparison
Precondition
U must be assignable from const char*
rhs must be a valid null-terminated C-string
Postcondition
Comparison excludes the null terminator
Equivalent to comparing with std::string_view(rhs)

Definition at line 479 of file variable_size_binary_reference.hpp.

Here is the call graph for this function:

◆ operator<=>() [2/2]

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::variable_size_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/variable_size_binary_reference.hpp.

Definition at line 471 of file variable_size_binary_reference.hpp.

◆ operator=() [1/4]

template<class L>
template<class U = typename L::inner_value_type>
requires std::assignable_from<U&, const char*>
self_type & sparrow::variable_size_binary_reference< L >::operator= ( const char * rhs)
constexpr

Assignment from a C-string.

Special overload to handle C-string assignments correctly, avoiding issues with the null terminator being included in the binary data. The C-string is converted to a string_view before assignment.

Template Parameters
UValue type (deduced, must be assignable from const char*)
Parameters
rhsC-string to assign from
Returns
Reference to this object
Precondition
U must be assignable from const char*
rhs must be a valid null-terminated C-string
Layout must remain valid during assignment
Postcondition
Underlying element is assigned the string content (without null terminator)
Layout buffers are updated appropriately
Note
This overload prevents const char* from being treated as a range which would include the null terminator

◆ operator=() [2/4]

template<class L>
template<class U>
requires std::assignable_from<U&, const char*>
auto sparrow::variable_size_binary_reference< L >::operator= ( const char * rhs) -> self_type&
constexpr

Definition at line 399 of file variable_size_binary_reference.hpp.

◆ operator=() [3/4]

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

Assignment from a sized range of binary data.

Assigns new binary data to the referenced element. The operation may resize the underlying storage and update offset tables to accommodate the new data size.

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
Layout must remain valid during assignment
Index must be within layout bounds
Postcondition
Underlying layout element is assigned the data from rhs
Layout buffers and offsets are updated to reflect changes
Element size may change to match rhs.size()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/variable_size_binary_reference.hpp.

◆ operator=() [4/4]

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

Definition at line 389 of file variable_size_binary_reference.hpp.

◆ operator==() [1/2]

template<class L>
requires std::assignable_from<U&, const char*>
template<class U>
requires std::assignable_from<U&, const char*>
bool sparrow::variable_size_binary_reference< L >::operator== ( const char * rhs) const
constexpr

Equality comparison with a C-string.

Special overload for comparing with C-strings, converting the C-string to a string_view for proper comparison without null terminator issues.

Template Parameters
UValue type (deduced, must be assignable from const char*)
Parameters
rhsC-string to compare with
Returns
true if content matches the C-string, false otherwise
Precondition
U must be assignable from const char*
rhs must be a valid null-terminated C-string
Postcondition
Comparison excludes the null terminator
Equivalent to comparing with std::string_view(rhs)

Definition at line 463 of file variable_size_binary_reference.hpp.

Here is the call graph for this function:

◆ operator==() [2/2]

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::variable_size_binary_reference< L >::operator== ( const T & rhs) const
constexpr

Equality comparison with another range of binary data.

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

Template Parameters
TType of the range to compare with
Parameters
rhsRange to compare with
Returns
true if all elements 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/variable_size_binary_reference.hpp.

Definition at line 455 of file variable_size_binary_reference.hpp.

Here is the call graph for this function:

◆ size()

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

Gets the size of the binary element in bytes/characters.

Returns
Number of bytes/characters in the variable-size element
Postcondition
Returns non-negative size
Size is calculated from offset differences
May be 0 for empty elements
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/variable_size_binary_reference.hpp.

Definition at line 405 of file variable_size_binary_reference.hpp.

Here is the caller graph for this function:

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