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

Base class defining common immutable interface for arrays with a bitmap. More...

#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

std::optional< std::string_view > name () const
 
std::optional< std::string_view > metadata () const
 
bool empty () const
 Checks if the array has no element, i.e.
 
size_type size () const
 Returns the number of elements in the array.
 
const_reference at (size_type i) const
 Returns a constant reference to the element at the specified position in the array with bounds checking.
 
const_reference operator[] (size_type i) const
 Returns a constant reference to the element at the specified position in the array.
 
const_reference front () const
 Returns a constant reference to the first element in the container.
 
const_reference back () const
 Returns a constant reference to the last element in the container.
 
const_iterator begin () const
 Returns a constant iterator to the first element of the array.
 
const_iterator end () const
 Returns a constant iterator to the element following the last element of the array.
 
const_iterator cbegin () const
 Returns a constant iterator to the first element of the array.
 
const_iterator cend () const
 Returns a constant iterator to the element following the last element of the array.
 
const_reverse_iterator rbegin () const
 Returns a constant reverse iterator to the first element of the reversed array.
 
const_reverse_iterator rend () const
 Returns a reverse iterator to the element following the last element of the reversed array.
 
const_reverse_iterator crbegin () const
 Returns a constant reverse iterator to the first element of the reversed array.
 
const_reverse_iterator crend () const
 Returns a reverse iterator to the element following the last element of the reversed array.
 
const_bitmap_range bitmap () const
 Returns the validity bitmap of the array (i.e.
 
const_value_range values () const
 Returns the raw values of the array (i.e.
 
slice (size_type start, size_type end) const
 Slices the array to keep only the elements between the given start and end.
 
slice_view (size_type start, size_type end) const
 Slices the array to keep only the elements between the given start and end.
 

Protected Member Functions

 array_crtp_base (arrow_proxy)
 
 array_crtp_base (const array_crtp_base &)=default
 
array_crtp_baseoperator= (const array_crtp_base &)=default
 
 array_crtp_base (array_crtp_base &&)=default
 
array_crtp_baseoperator= (array_crtp_base &&)=default
 
arrow_proxyget_arrow_proxy ()
 
const arrow_proxyget_arrow_proxy () const
 
bitmap_const_reference has_value (size_type i) const
 
const_bitmap_iterator bitmap_begin () const
 
const_bitmap_iterator bitmap_end () const
 
const_bitmap_iterator bitmap_cbegin () const
 
const_bitmap_iterator bitmap_cend () const
 
- Protected Member Functions inherited from sparrow::crtp_base< D >
derived_typederived_cast ()
 
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 >

Base class defining common immutable interface for arrays with a bitmap.

This class is a CRTP base class that defines and implements common immutable interface for arrays with a bitmap. These arrays hold nullable elements.

Template Parameters
DThe derived type, i.e. the inheriting class for which array_crtp_base provides the interface.
See also
nullable

Definition at line 66 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

Definition at line 79 of file array_base.hpp.

◆ bitmap_iterator

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

Definition at line 80 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 78 of file array_base.hpp.

◆ const_bitmap_iterator

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

Definition at line 81 of file array_base.hpp.

◆ const_bitmap_range

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

Definition at line 82 of file array_base.hpp.

◆ const_iterator

template<class D>
using sparrow::array_crtp_base< D >::const_iterator = layout_iterator<iterator_types>

Definition at line 104 of file array_base.hpp.

◆ const_reference

template<class D>
using sparrow::array_crtp_base< D >::const_reference = nullable<inner_const_reference, bitmap_const_reference>

Definition at line 88 of file array_base.hpp.

◆ const_reverse_iterator

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

Definition at line 105 of file array_base.hpp.

◆ const_value_iterator

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

Definition at line 90 of file array_base.hpp.

◆ const_value_range

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

Definition at line 91 of file array_base.hpp.

◆ derived_type

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

Definition at line 71 of file array_base.hpp.

◆ difference_type

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

Definition at line 76 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

Definition at line 87 of file array_base.hpp.

◆ inner_types

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

Definition at line 73 of file array_base.hpp.

◆ inner_value_type

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

Definition at line 84 of file array_base.hpp.

◆ iterator_tag

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

Definition at line 93 of file array_base.hpp.

◆ self_type

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

Definition at line 70 of file array_base.hpp.

◆ size_type

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

Definition at line 75 of file array_base.hpp.

◆ value_type

template<class D>
using sparrow::array_crtp_base< D >::value_type = nullable<inner_value_type>

Definition at line 85 of file array_base.hpp.

Constructor & Destructor Documentation

◆ array_crtp_base() [1/3]

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

Definition at line 389 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 > & )
protecteddefault
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 > && )
protecteddefault
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
nodiscard

Returns a constant reference to the element at the specified position in the array with bounds checking.

Parameters
ithe index of the element in the array.
Exceptions
std::out_of_rangeif i is not within the range of the container.

Definition at line 232 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
nodiscard

Returns a constant reference to the last element in the container.

Calling back on an empty container causes undefined behavior.

Definition at line 274 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
nodiscard

Returns a constant iterator to the first element of the array.

Definition at line 284 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
nodiscard

Returns the validity bitmap of the array (i.e.

the "has_value" part of the nullable elements) as a constant range.

Definition at line 373 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
protected

Definition at line 414 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
protected

Definition at line 426 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
protected

Definition at line 432 of file array_base.hpp.

Here is the call graph for this function:

◆ bitmap_end()

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

Definition at line 420 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
nodiscard

Returns a constant iterator to the first element of the array.

This method ensures that a constant iterator is returned, even when called on a non-const array.

Definition at line 305 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
nodiscard

Returns a constant iterator to the element following the last element of the array.

This method ensures that a constant iterator is returned, even when called on a non-const array.

Definition at line 316 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
nodiscard

Returns a constant reverse iterator to the first element of the reversed array.

It corresponds to the last element of the non- reversed array. This method ensures that a constant reverse iterator is returned, even when called on a non-const array.

Definition at line 350 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
nodiscard

Returns a reverse iterator to the element following the last element of the reversed array.

It corresponds to the element preceding the first element of the non-reversed array. This method ensures that a constant reverse iterator is returned, even when called on a non-const array.

Definition at line 363 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
nodiscard

Checks if the array has no element, i.e.

whether begin() == end().

Definition at line 211 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
nodiscard

Returns a constant iterator to the element following the last element of the array.

Definition at line 294 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
nodiscard

Returns a constant reference to the first element in the container.

Calling front on an empty container causes undefined behavior.

Definition at line 263 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 ( )
nodiscardprotected

Definition at line 395 of file array_base.hpp.

Here is the caller graph for this function:

◆ get_arrow_proxy() [2/2]

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

Definition at line 401 of file array_base.hpp.

◆ has_value()

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

Definition at line 407 of file array_base.hpp.

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

◆ metadata()

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

Definition at line 202 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
nodiscard

Definition at line 196 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 > && )
protecteddefault
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 > & )
protecteddefault
Here is the call graph for this function:

◆ operator[]()

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

Returns a constant reference to the element at the specified position in the array.

Parameters
ithe index of the element in the array.

Definition at line 249 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
nodiscard

Returns a constant reverse iterator to the first element of the reversed array.

It corresponds to the last element of the non- reversed array.

Definition at line 327 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
nodiscard

Returns a reverse iterator to the element following the last element of the reversed array.

It corresponds to the element preceding the first element of the non-reversed array.

Definition at line 338 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
nodiscard

Returns the number of elements in the array.

Definition at line 220 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
nodiscard

Slices the array to keep only the elements between the given start and end.

A copy of the Array is modified. The data is not modified, only the ArrowArray.offset and ArrowArray.length are updated. If end is greater than the size of the buffers, the following elements will be invalid.

Parameters
startThe index of the first element to keep. Must be less than end.
endThe index of the first element to discard. Must be less than the size of the buffers.

Definition at line 438 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
nodiscard

Slices the array to keep only the elements between the given start and end.

A view of the Array is returned. The data is not modified, only the ArrowArray.offset and ArrowArray.length are updated. If end is greater than the size of the buffers, the following elements will be invalid.

Parameters
startThe index of the first element to keep. Must be less than end.
endThe index of the first element to discard. Must be less than the size of the buffers.

Definition at line 445 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
nodiscard

Returns the raw values of the array (i.e.

the "value" part og the nullable elements) as a constant range.

Definition at line 383 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 182 of file array_base.hpp.

◆ layout_iterator< iterator_types >

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

Definition at line 178 of file array_base.hpp.


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