sparrow 0.9.0
Loading...
Searching...
No Matches
sparrow::array_crtp_base< D > Class Template Reference

#include <array_base.hpp>

Inheritance diagram for sparrow::array_crtp_base< D >:
[legend]
Collaboration diagram for sparrow::array_crtp_base< D >:
[legend]

Classes

struct  iterator_types
 

Public Types

using self_type = array_crtp_base<D>
 
using derived_type = D
 
using inner_types = array_inner_types<derived_type>
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using bitmap_type = typename inner_types::bitmap_type
 
using bitmap_const_reference = bitmap_type::const_reference
 
using bitmap_iterator = bitmap_type::iterator
 
using const_bitmap_iterator = bitmap_type::const_iterator
 
using const_bitmap_range = std::ranges::subrange<const_bitmap_iterator>
 
using inner_value_type = typename inner_types::inner_value_type
 
using value_type = nullable<inner_value_type>
 
using inner_const_reference = typename inner_types::inner_const_reference
 
using const_reference = nullable<inner_const_reference, bitmap_const_reference>
 
using const_value_iterator = typename inner_types::const_value_iterator
 
using const_value_range = std::ranges::subrange<const_value_iterator>
 
using iterator_tag = typename inner_types::iterator_tag
 
using const_iterator = layout_iterator<iterator_types>
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 

Public Member Functions

constexpr std::optional< std::string_view > name () const
 Gets the optional name of the array.
 
std::optional< key_value_viewmetadata () const
 Gets the metadata associated with the array.
 
constexpr bool empty () const
 Checks if the array is empty.
 
constexpr size_type size () const
 Gets the number of elements in the array.
 
constexpr const_reference at (size_type i) const
 Gets element at specified position with bounds checking.
 
constexpr const_reference operator[] (size_type i) const
 Gets element at specified position without bounds checking.
 
constexpr const_reference front () const
 Gets reference to the first element.
 
constexpr const_reference back () const
 Gets reference to the last element.
 
constexpr const_iterator begin () const
 Gets iterator to the beginning of the array.
 
constexpr const_iterator end () const
 Gets iterator to the end of the array.
 
constexpr const_iterator cbegin () const
 Gets const iterator to the beginning of the array.
 
constexpr const_iterator cend () const
 Gets const iterator to the end of the array.
 
constexpr const_reverse_iterator rbegin () const
 Gets reverse iterator to the beginning of reversed array.
 
constexpr const_reverse_iterator rend () const
 Gets reverse iterator to the end of reversed array.
 
constexpr const_reverse_iterator crbegin () const
 Gets const reverse iterator to the beginning of reversed array.
 
constexpr const_reverse_iterator crend () const
 Gets const reverse iterator to the end of reversed array.
 
constexpr const_bitmap_range bitmap () const
 Gets the validity bitmap as a range.
 
constexpr const_value_range values () const
 Gets the raw values as a range.
 
constexpr D slice (size_type start, size_type end) const
 Creates a sliced copy of the array.
 
constexpr D slice_view (size_type start, size_type end) const
 Creates a sliced view of the array.
 

Protected Member Functions

 array_crtp_base (arrow_proxy)
 Protected constructor from Arrow proxy.
 
constexpr array_crtp_base (const array_crtp_base &)=default
 
constexpr array_crtp_baseoperator= (const array_crtp_base &)=default
 
constexpr array_crtp_base (array_crtp_base &&) noexcept=default
 
constexpr array_crtp_baseoperator= (array_crtp_base &&) noexcept=default
 
constexpr arrow_proxyget_arrow_proxy () noexcept
 Gets mutable reference to the Arrow proxy.
 
constexpr const arrow_proxyget_arrow_proxy () const noexcept
 Gets const reference to the Arrow proxy.
 
constexpr bitmap_const_reference has_value (size_type i) const
 Checks if element at index i has a valid value.
 
constexpr const_bitmap_iterator bitmap_begin () const
 Gets bitmap iterator to the beginning.
 
constexpr const_bitmap_iterator bitmap_end () const
 Gets bitmap iterator to the end.
 
constexpr const_bitmap_iterator bitmap_cbegin () const
 Gets const bitmap iterator to the beginning.
 
constexpr const_bitmap_iterator bitmap_cend () const
 Gets const bitmap iterator to the end.
 
- Protected Member Functions inherited from sparrow::crtp_base< D >
constexpr derived_typederived_cast ()
 
constexpr const derived_typederived_cast () const
 

Friends

class layout_iterator< iterator_types >
 
class detail::array_access
 

Additional Inherited Members

- Protected Types inherited from sparrow::crtp_base< D >
using derived_type = D
 

Detailed Description

template<class D>
class sparrow::array_crtp_base< D >

Definition at line 106 of file array_base.hpp.

Member Typedef Documentation

◆ bitmap_const_reference

template<class D>
using sparrow::array_crtp_base< D >::bitmap_const_reference = bitmap_type::const_reference

◆ bitmap_iterator

template<class D>
using sparrow::array_crtp_base< D >::bitmap_iterator = bitmap_type::iterator

Definition at line 120 of file array_base.hpp.

◆ bitmap_type

template<class D>
using sparrow::array_crtp_base< D >::bitmap_type = typename inner_types::bitmap_type

Definition at line 118 of file array_base.hpp.

◆ const_bitmap_iterator

template<class D>
using sparrow::array_crtp_base< D >::const_bitmap_iterator = bitmap_type::const_iterator

◆ const_bitmap_range

template<class D>
using sparrow::array_crtp_base< D >::const_bitmap_range = std::ranges::subrange<const_bitmap_iterator>

◆ const_iterator

◆ const_reference

◆ const_reverse_iterator

template<class D>
using sparrow::array_crtp_base< D >::const_reverse_iterator = std::reverse_iterator<const_iterator>

◆ const_value_iterator

template<class D>
using sparrow::array_crtp_base< D >::const_value_iterator = typename inner_types::const_value_iterator

◆ const_value_range

template<class D>
using sparrow::array_crtp_base< D >::const_value_range = std::ranges::subrange<const_value_iterator>

◆ derived_type

template<class D>
using sparrow::array_crtp_base< D >::derived_type = D

◆ difference_type

template<class D>
using sparrow::array_crtp_base< D >::difference_type = std::ptrdiff_t

Definition at line 116 of file array_base.hpp.

◆ inner_const_reference

template<class D>
using sparrow::array_crtp_base< D >::inner_const_reference = typename inner_types::inner_const_reference

◆ inner_types

◆ inner_value_type

template<class D>
using sparrow::array_crtp_base< D >::inner_value_type = typename inner_types::inner_value_type

◆ iterator_tag

template<class D>
using sparrow::array_crtp_base< D >::iterator_tag = typename inner_types::iterator_tag

◆ self_type

template<class D>
using sparrow::array_crtp_base< D >::self_type = array_crtp_base<D>

◆ size_type

template<class D>
using sparrow::array_crtp_base< D >::size_type = std::size_t

Definition at line 115 of file array_base.hpp.

◆ value_type

Constructor & Destructor Documentation

◆ array_crtp_base() [1/3]

template<class D>
sparrow::array_crtp_base< D >::array_crtp_base ( arrow_proxy proxy)
explicitprotected

Protected constructor from Arrow proxy.

Parameters
proxyArrow proxy containing array data and schema
Precondition
proxy must contain valid Arrow array and schema
Postcondition
Array is initialized with data from proxy
Arrow proxy is moved and stored internally
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 617 of file array_base.hpp.

Here is the caller graph for this function:

◆ array_crtp_base() [2/3]

template<class D>
sparrow::array_crtp_base< D >::array_crtp_base ( const array_crtp_base< D > & )
constexprprotecteddefault
Here is the call graph for this function:

◆ array_crtp_base() [3/3]

template<class D>
sparrow::array_crtp_base< D >::array_crtp_base ( array_crtp_base< D > && )
constexprprotecteddefaultnoexcept
Here is the call graph for this function:

Member Function Documentation

◆ at()

template<class D>
auto sparrow::array_crtp_base< D >::at ( size_type i) const
nodiscardconstexpr

Gets element at specified position with bounds checking.

Parameters
iIndex of the element to access
Returns
Const reference to nullable element at position i
Precondition
i must be < size()
Postcondition
Returns valid const_reference to element
Element includes both value and validity information
Exceptions
std::out_of_rangeif i >= size()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 522 of file array_base.hpp.

Here is the call graph for this function:

◆ back()

template<class D>
auto sparrow::array_crtp_base< D >::back ( ) const
nodiscardconstexpr

Gets reference to the last element.

Returns
Const reference to the last element
Precondition
Array must not be empty (!empty())
Postcondition
Returns valid reference to last element
Equivalent to (*this)[size() - 1]
Note
Internal assertion: SPARROW_ASSERT_TRUE(!empty())
Calling back() on empty array causes undefined behavior
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 550 of file array_base.hpp.

Here is the call graph for this function:

◆ begin()

template<class D>
auto sparrow::array_crtp_base< D >::begin ( ) const
nodiscardconstexpr

Gets iterator to the beginning of the array.

Returns
Const iterator pointing to the first element
Postcondition
Iterator is valid for array traversal
Equivalent to cbegin()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 557 of file array_base.hpp.

Here is the call graph for this function:

◆ bitmap()

template<class D>
auto sparrow::array_crtp_base< D >::bitmap ( ) const
nodiscardconstexpr

Gets the validity bitmap as a range.

Returns
Range over the validity bitmap
Postcondition
Range size equals array size
Range provides access to validity flags for each element
true indicates valid element, false indicates null
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 605 of file array_base.hpp.

Here is the call graph for this function:

◆ bitmap_begin()

template<class D>
auto sparrow::array_crtp_base< D >::bitmap_begin ( ) const
constexprprotected

Gets bitmap iterator to the beginning.

Returns
Iterator to first validity bit
Postcondition
Iterator accounts for array offset
Iterator is valid for bitmap traversal
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 642 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitmap_cbegin()

template<class D>
auto sparrow::array_crtp_base< D >::bitmap_cbegin ( ) const
constexprprotected

Gets const bitmap iterator to the beginning.

Returns
Const iterator to first validity bit
Postcondition
Iterator accounts for array offset
Guarantees const iterator
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 654 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitmap_cend()

template<class D>
auto sparrow::array_crtp_base< D >::bitmap_cend ( ) const
constexprprotected

Gets const bitmap iterator to the end.

Returns
Const iterator past last validity bit
Postcondition
Iterator marks end of bitmap range
Guarantees const iterator
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 660 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bitmap_end()

template<class D>
auto sparrow::array_crtp_base< D >::bitmap_end ( ) const
constexprprotected

Gets bitmap iterator to the end.

Returns
Iterator past last validity bit
Postcondition
Iterator marks end of bitmap range
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 648 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbegin()

template<class D>
auto sparrow::array_crtp_base< D >::cbegin ( ) const
nodiscardconstexpr

Gets const iterator to the beginning of the array.

Returns
Const iterator pointing to the first element
Postcondition
Iterator is valid for array traversal
Guarantees const iterator even for non-const arrays
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 569 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cend()

template<class D>
auto sparrow::array_crtp_base< D >::cend ( ) const
nodiscardconstexpr

Gets const iterator to the end of the array.

Returns
Const iterator pointing past the last element
Postcondition
Iterator marks the end of the array range
Guarantees const iterator even for non-const arrays
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 575 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crbegin()

template<class D>
auto sparrow::array_crtp_base< D >::crbegin ( ) const
nodiscardconstexpr

Gets const reverse iterator to the beginning of reversed array.

Returns
Const reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
Guarantees const iterator even for non-const arrays
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 593 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crend()

template<class D>
auto sparrow::array_crtp_base< D >::crend ( ) const
nodiscardconstexpr

Gets const reverse iterator to the end of reversed array.

Returns
Const reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Guarantees const iterator even for non-const arrays
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 599 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

template<class D>
bool sparrow::array_crtp_base< D >::empty ( ) const
nodiscardconstexpr

Checks if the array is empty.

Returns
true if the array has no elements, false otherwise
Postcondition
Return value equals (size() == 0)
Equivalent to begin() == end()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 510 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end()

template<class D>
auto sparrow::array_crtp_base< D >::end ( ) const
nodiscardconstexpr

Gets iterator to the end of the array.

Returns
Const iterator pointing past the last element
Postcondition
Iterator marks the end of the array range
Equivalent to cend()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 563 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ front()

template<class D>
auto sparrow::array_crtp_base< D >::front ( ) const
nodiscardconstexpr

Gets reference to the first element.

Returns
Const reference to the first element
Precondition
Array must not be empty (!empty())
Postcondition
Returns valid reference to first element
Equivalent to (*this)[0]
Note
Internal assertion: SPARROW_ASSERT_TRUE(!empty())
Calling front() on empty array causes undefined behavior
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 543 of file array_base.hpp.

Here is the call graph for this function:

◆ get_arrow_proxy() [1/2]

template<class D>
auto sparrow::array_crtp_base< D >::get_arrow_proxy ( ) const
nodiscardconstexprprotectednoexcept

Gets const reference to the Arrow proxy.

Returns
Const reference to internal Arrow proxy
Postcondition
Returns valid const reference to Arrow proxy

Definition at line 629 of file array_base.hpp.

◆ get_arrow_proxy() [2/2]

template<class D>
auto sparrow::array_crtp_base< D >::get_arrow_proxy ( )
nodiscardconstexprprotectednoexcept

Gets mutable reference to the Arrow proxy.

Returns
Mutable reference to internal Arrow proxy
Postcondition
Returns valid reference to Arrow proxy
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 623 of file array_base.hpp.

Here is the caller graph for this function:

◆ has_value()

template<class D>
auto sparrow::array_crtp_base< D >::has_value ( size_type i) const
constexprprotected

Checks if element at index i has a valid value.

Parameters
iIndex of element to check
Returns
Reference to validity flag for element i
Precondition
i must be < size()
Postcondition
Returns reference to validity bit for element i
true indicates valid element, false indicates null
Note
Internal assertion: SPARROW_ASSERT_TRUE(i < size())
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 635 of file array_base.hpp.

Here is the call graph for this function:

◆ metadata()

template<class D>
std::optional< key_value_view > sparrow::array_crtp_base< D >::metadata ( ) const
nodiscard

Gets the metadata associated with the array.

Returns
Optional view of key-value metadata pairs from Arrow schema
Postcondition
Returns nullopt if no metadata is set
Returned view remains valid while array exists
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 504 of file array_base.hpp.

Here is the call graph for this function:

◆ name()

template<class D>
std::optional< std::string_view > sparrow::array_crtp_base< D >::name ( ) const
nodiscardconstexpr

Gets the optional name of the array.

Returns
Optional string view of the array name from Arrow schema
Postcondition
Returns nullopt if no name is set
Returned string view remains valid while array exists
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 498 of file array_base.hpp.

Here is the call graph for this function:

◆ operator=() [1/2]

template<class D>
array_crtp_base & sparrow::array_crtp_base< D >::operator= ( array_crtp_base< D > && )
constexprprotecteddefaultnoexcept
Here is the call graph for this function:

◆ operator=() [2/2]

template<class D>
array_crtp_base & sparrow::array_crtp_base< D >::operator= ( const array_crtp_base< D > & )
constexprprotecteddefault
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.
Here is the call graph for this function:

◆ operator[]()

template<class D>
auto sparrow::array_crtp_base< D >::operator[] ( size_type i) const
nodiscardconstexpr

Gets element at specified position without bounds checking.

Parameters
iIndex of the element to access
Returns
Const reference to nullable element at position i
Precondition
i must be < size()
Postcondition
Returns valid const_reference to element
Element includes both value and validity information
Note
Internal assertion: SPARROW_ASSERT_TRUE(i < derived_cast.size())
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 535 of file array_base.hpp.

Here is the call graph for this function:

◆ rbegin()

template<class D>
auto sparrow::array_crtp_base< D >::rbegin ( ) const
nodiscardconstexpr

Gets reverse iterator to the beginning of reversed array.

Returns
Const reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
Equivalent to crbegin()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 581 of file array_base.hpp.

Here is the call graph for this function:

◆ rend()

template<class D>
auto sparrow::array_crtp_base< D >::rend ( ) const
nodiscardconstexpr

Gets reverse iterator to the end of reversed array.

Returns
Const reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Equivalent to crend()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 587 of file array_base.hpp.

Here is the call graph for this function:

◆ size()

template<class D>
auto sparrow::array_crtp_base< D >::size ( ) const
nodiscardconstexpr

Gets the number of elements in the array.

Returns
Number of elements in the array
Postcondition
Returns non-negative value
Value corresponds to Arrow array length
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 516 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ slice()

template<class D>
D sparrow::array_crtp_base< D >::slice ( size_type start,
size_type end ) const
nodiscardconstexpr

Creates a sliced copy of the array.

Creates a new array containing only elements between start and end indices. The underlying data is not copied; only the Arrow offset and length are modified.

Parameters
startIndex of the first element to keep (inclusive)
endIndex of the first element to exclude (exclusive)
Returns
New array containing the sliced range
Precondition
start must be <= end
start must be <= size()
end should be <= size() for valid elements
Postcondition
Returned array has length (end - start)
Elements maintain their original validity and values
If end > buffer size, trailing elements may be invalid
Note
Internal assertion: SPARROW_ASSERT_TRUE(start <= end)
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 666 of file array_base.hpp.

Here is the call graph for this function:

◆ slice_view()

template<class D>
D sparrow::array_crtp_base< D >::slice_view ( size_type start,
size_type end ) const
nodiscardconstexpr

Creates a sliced view of the array.

Creates a view over elements between start and end indices without copying. The underlying data buffers are shared with the original array.

Parameters
startIndex of the first element to keep (inclusive)
endIndex of the first element to exclude (exclusive)
Returns
Array view containing the sliced range
Precondition
start must be <= end
start must be <= size()
end should be <= size() for valid elements
Original array must remain valid while view is used
Postcondition
Returned view has length (end - start)
View shares data with original array
Changes to original array may affect the view
Note
Internal assertion: SPARROW_ASSERT_TRUE(start <= end)
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 673 of file array_base.hpp.

Here is the call graph for this function:

◆ values()

template<class D>
auto sparrow::array_crtp_base< D >::values ( ) const
nodiscardconstexpr

Gets the raw values as a range.

Returns
Range over the raw values (without validity information)
Postcondition
Range size equals array size
Range provides access to stored values regardless of validity
Values at null positions are still accessible but semantically invalid
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/array_base.hpp.

Definition at line 611 of file array_base.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ detail::array_access

template<class D>
friend class detail::array_access
friend

Definition at line 484 of file array_base.hpp.

◆ layout_iterator< iterator_types >

template<class D>
friend class layout_iterator< iterator_types >
friend

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