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

Base class definining common interface for arrays with a bitmap. More...

#include <mutable_array_base.hpp>

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

Classes

struct  iterator_types
 

Public Types

using self_type = mutable_array_base<D>
 
using base_type = array_crtp_base<D>
 
using derived_type = D
 
using inner_types = array_inner_types<derived_type>
 
using size_type = base_type::size_type
 
using difference_type = base_type::difference_type
 
using bitmap_type = typename inner_types::bitmap_type
 
using bitmap_reference = bitmap_type::reference
 
using bitmap_const_reference = bitmap_type::const_reference
 
using bitmap_iterator = bitmap_type::iterator
 
using bitmap_range = std::ranges::subrange<bitmap_iterator>
 
using const_bitmap_range = base_type::const_bitmap_range
 
using inner_value_type = typename base_type::inner_value_type
 
using value_type = typename base_type::value_type
 
using inner_reference = typename inner_types::inner_reference
 
using inner_const_reference = typename base_type::inner_const_reference
 
using reference = nullable<inner_reference, bitmap_reference>
 
using const_reference = base_type::const_reference
 
using value_iterator = typename inner_types::value_iterator
 
using iterator_tag = base_type::iterator_tag
 
using iterator = layout_iterator<iterator_types>
 
using const_iterator = base_type::const_iterator
 
- Public Types inherited from sparrow::array_crtp_base< D >
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 reference operator[] (size_type i)
 Returns a reference to the element at the specified position in the array.
 
constexpr iterator begin ()
 Returns an iterator to the first element of the array.
 
constexpr iterator end ()
 Returns a iterator to the element following the last element of the array.
 
template<typename T>
constexpr void resize (size_type new_size, const nullable< T > &value)
 Resizes the array to contain new_length elements, does nothing if new_length == size().
 
template<typename T>
constexpr iterator insert (const_iterator pos, const nullable< T > &value)
 
template<typename T>
constexpr iterator insert (const_iterator pos, const nullable< T > &value, size_type count)
 
template<typename T>
constexpr iterator insert (const_iterator pos, std::initializer_list< nullable< T > > values)
 
template<typename InputIt>
requires std::input_iterator<InputIt> && mpl::is_type_instance_of_v<typename std::iterator_traits<InputIt>::value_type, nullable>
constexpr iterator insert (const_iterator pos, InputIt first, InputIt last)
 Inserts elements from range [first , last ) before pos in the array.
 
template<std::ranges::input_range R>
requires mpl::is_type_instance_of_v<std::ranges::range_value_t<R>, nullable>
constexpr iterator insert (const_iterator pos, const R &range)
 Inserts elements from range range before pos in the array.
 
constexpr iterator erase (const_iterator pos)
 Removes the element at pos from the array.
 
constexpr iterator erase (const_iterator first, const_iterator last)
 Removes the elements in the range [ first , last ) from the array.
 
template<typename T>
constexpr void push_back (const nullable< T > &value)
 Appends a copy of value to the end of the array.
 
constexpr void pop_back ()
 Removes the last element of the array.
 
constexpr void zero_null_values (const inner_value_type &value=inner_value_type())
 Sets all null values in the array to zero.
 
template<typename T>
constexpr auto insert (const_iterator pos, const nullable< T > &value) -> iterator
 Inserts a copy of value before pos in the array.
 
template<typename T>
constexpr auto insert (const_iterator pos, const nullable< T > &value, size_type count) -> iterator
 Inserts count copies of value before pos in the array.
 
template<typename T>
constexpr auto insert (const_iterator pos, std::initializer_list< nullable< T > > values) -> iterator
 Inserts elements from initializer list values before pos in the array.
 
constexpr const_reference operator[] (size_type i) const
 Gets element at specified position without bounds checking.
 
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.
 
- Public Member Functions inherited from sparrow::array_crtp_base< D >
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

 mutable_array_base (arrow_proxy)
 
constexpr mutable_array_base (const mutable_array_base &) noexcept=default
 
constexpr mutable_array_baseoperator= (const mutable_array_base &) noexcept=default
 
constexpr mutable_array_base (mutable_array_base &&) noexcept=default
 
constexpr mutable_array_baseoperator= (mutable_array_base &&) noexcept=default
 
constexpr bitmap_reference has_value (size_type i)
 
constexpr bitmap_iterator bitmap_begin ()
 
constexpr bitmap_iterator bitmap_end ()
 
constexpr bitmap_const_reference has_value (size_type i) const
 Checks if element at index i has a valid value.
 
- Protected Member Functions inherited from sparrow::array_crtp_base< D >
 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 >
 

Additional Inherited Members

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

Detailed Description

template<class D>
class sparrow::mutable_array_base< D >

Base class definining common interface for arrays with a bitmap.

This class is a CRTP base class that defines and implements common interface for arrays with a bitmap. The immutable interface is inherited from array_crtp_base.

Template Parameters
DThe derived type, i.e. the inheriting class for which mutable_array_base provides the interface.

Definition at line 35 of file mutable_array_base.hpp.

Member Typedef Documentation

◆ base_type

template<class D>
using sparrow::mutable_array_base< D >::base_type = array_crtp_base<D>

Definition at line 40 of file mutable_array_base.hpp.

◆ bitmap_const_reference

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

Definition at line 49 of file mutable_array_base.hpp.

◆ bitmap_iterator

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

Definition at line 50 of file mutable_array_base.hpp.

◆ bitmap_range

template<class D>
using sparrow::mutable_array_base< D >::bitmap_range = std::ranges::subrange<bitmap_iterator>

Definition at line 51 of file mutable_array_base.hpp.

◆ bitmap_reference

template<class D>
using sparrow::mutable_array_base< D >::bitmap_reference = bitmap_type::reference

Definition at line 48 of file mutable_array_base.hpp.

◆ bitmap_type

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

Definition at line 47 of file mutable_array_base.hpp.

◆ const_bitmap_range

template<class D>
using sparrow::mutable_array_base< D >::const_bitmap_range = base_type::const_bitmap_range

Definition at line 52 of file mutable_array_base.hpp.

◆ const_iterator

template<class D>
using sparrow::mutable_array_base< D >::const_iterator = base_type::const_iterator

Definition at line 77 of file mutable_array_base.hpp.

◆ const_reference

template<class D>
using sparrow::mutable_array_base< D >::const_reference = base_type::const_reference

Definition at line 61 of file mutable_array_base.hpp.

◆ derived_type

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

Definition at line 41 of file mutable_array_base.hpp.

◆ difference_type

template<class D>
using sparrow::mutable_array_base< D >::difference_type = base_type::difference_type

Definition at line 45 of file mutable_array_base.hpp.

◆ inner_const_reference

template<class D>
using sparrow::mutable_array_base< D >::inner_const_reference = typename base_type::inner_const_reference

Definition at line 58 of file mutable_array_base.hpp.

◆ inner_reference

template<class D>
using sparrow::mutable_array_base< D >::inner_reference = typename inner_types::inner_reference

Definition at line 57 of file mutable_array_base.hpp.

◆ inner_types

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

Definition at line 42 of file mutable_array_base.hpp.

◆ inner_value_type

template<class D>
using sparrow::mutable_array_base< D >::inner_value_type = typename base_type::inner_value_type

Definition at line 54 of file mutable_array_base.hpp.

◆ iterator

template<class D>
using sparrow::mutable_array_base< D >::iterator = layout_iterator<iterator_types>

Definition at line 76 of file mutable_array_base.hpp.

◆ iterator_tag

template<class D>
using sparrow::mutable_array_base< D >::iterator_tag = base_type::iterator_tag

Definition at line 65 of file mutable_array_base.hpp.

◆ reference

template<class D>
using sparrow::mutable_array_base< D >::reference = nullable<inner_reference, bitmap_reference>

Definition at line 60 of file mutable_array_base.hpp.

◆ self_type

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

Definition at line 39 of file mutable_array_base.hpp.

◆ size_type

template<class D>
using sparrow::mutable_array_base< D >::size_type = base_type::size_type

Definition at line 44 of file mutable_array_base.hpp.

◆ value_iterator

template<class D>
using sparrow::mutable_array_base< D >::value_iterator = typename inner_types::value_iterator

Definition at line 63 of file mutable_array_base.hpp.

◆ value_type

template<class D>
using sparrow::mutable_array_base< D >::value_type = typename base_type::value_type

Definition at line 55 of file mutable_array_base.hpp.

Constructor & Destructor Documentation

◆ mutable_array_base() [1/3]

template<class D>
sparrow::mutable_array_base< D >::mutable_array_base ( arrow_proxy proxy)
protected

Definition at line 198 of file mutable_array_base.hpp.

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

◆ mutable_array_base() [2/3]

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

◆ mutable_array_base() [3/3]

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

Member Function Documentation

◆ begin() [1/2]

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

Returns an iterator to the first element of the array.

Definition at line 207 of file mutable_array_base.hpp.

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

◆ begin() [2/2]

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()

Definition at line 251 of file array_base.hpp.

◆ bitmap_begin()

template<class D>
auto sparrow::mutable_array_base< D >::bitmap_begin ( )
nodiscardconstexprprotected

Definition at line 245 of file mutable_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::mutable_array_base< D >::bitmap_end ( )
nodiscardconstexprprotected

Definition at line 251 of file mutable_array_base.hpp.

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

◆ end() [1/2]

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

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

Definition at line 218 of file mutable_array_base.hpp.

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

◆ end() [2/2]

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()

Definition at line 261 of file array_base.hpp.

Here is the call graph for this function:

◆ erase() [1/2]

template<class D>
auto sparrow::mutable_array_base< D >::erase ( const_iterator first,
const_iterator last )
constexpr

Removes the elements in the range [ first , last ) from the array.

Parameters
firstThe iterator to the first element to remove.
lastThe iterator to the element following the last element to remove.
Returns
The iterator following the last element removed.

Definition at line 351 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ erase() [2/2]

template<class D>
auto sparrow::mutable_array_base< D >::erase ( const_iterator pos)
constexpr

Removes the element at pos from the array.

Parameters
posThe iterator to the element to remove.
Returns
The iterator following the last element removed.

Definition at line 336 of file mutable_array_base.hpp.

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

◆ has_value() [1/2]

template<class D>
auto sparrow::mutable_array_base< D >::has_value ( size_type i)
nodiscardconstexprprotected

Definition at line 238 of file mutable_array_base.hpp.

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

◆ has_value() [2/2]

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())

Definition at line 437 of file array_base.hpp.

Here is the call graph for this function:

◆ insert() [1/8]

template<class D>
template<typename T>
iterator sparrow::mutable_array_base< D >::insert ( const_iterator pos,
const nullable< T > & value )
constexpr
Here is the caller graph for this function:

◆ insert() [2/8]

template<class D>
template<typename T>
auto sparrow::mutable_array_base< D >::insert ( const_iterator pos,
const nullable< T > & value ) -> iterator
constexpr

Inserts a copy of value before pos in the array.

Parameters
posThe iterator before which the element will be inserted (pos may be the end() iterator).
valueThe element to insert.
Returns
An iterator pointing to the inserted value.

Definition at line 284 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ insert() [3/8]

template<class D>
template<typename T>
iterator sparrow::mutable_array_base< D >::insert ( const_iterator pos,
const nullable< T > & value,
size_type count )
constexpr

◆ insert() [4/8]

template<class D>
template<typename T>
auto sparrow::mutable_array_base< D >::insert ( const_iterator pos,
const nullable< T > & value,
size_type count ) -> iterator
constexpr

Inserts count copies of value before pos in the array.

Parameters
posThe iterator before which the elements will be inserted (pos may be the end() iterator).
valueThe element to insert.
countThe number of elements to insert.
Returns
An iterator pointing to the first element inserted, or pos if count == 0.

Definition at line 300 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ insert() [5/8]

template<class D>
template<std::ranges::input_range R>
requires mpl::is_type_instance_of_v<std::ranges::range_value_t<R>, nullable>
iterator sparrow::mutable_array_base< D >::insert ( const_iterator pos,
const R & range )
inlineconstexpr

Inserts elements from range range before pos in the array.

Template Parameters
Rthe type of range to insert.
Parameters
posThe iterator before which the elements will be inserted (pos may be the end() iterator).
rangeThe range of values to insert.
Returns
An iterator pointing to the first element inserted, or pos if range is empty.

Definition at line 161 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ insert() [6/8]

template<class D>
template<typename InputIt>
requires std::input_iterator<InputIt> && mpl::is_type_instance_of_v<typename std::iterator_traits<InputIt>::value_type, nullable>
iterator sparrow::mutable_array_base< D >::insert ( const_iterator pos,
InputIt first,
InputIt last )
inlineconstexpr

Inserts elements from range [first , last ) before pos in the array.

Parameters
posThe iterator before which the elements will be inserted (pos may be the end() iterator).
firstThe iterator to the first element to insert.
lastThe iterator to the element following the last element to insert.
Returns
An iterator pointing to the first element inserted, or pos if first == last.

Definition at line 110 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ insert() [7/8]

template<class D>
template<typename T>
iterator sparrow::mutable_array_base< D >::insert ( const_iterator pos,
std::initializer_list< nullable< T > > values )
constexpr
Here is the call graph for this function:

◆ insert() [8/8]

template<class D>
template<typename T>
auto sparrow::mutable_array_base< D >::insert ( const_iterator pos,
std::initializer_list< nullable< T > > values ) -> iterator
constexpr

Inserts elements from initializer list values before pos in the array.

Parameters
posThe iterator before which the elements will be inserted (pos may be the end() iterator).
valuesThe std::initializer_list to insert the values from.
Returns
An iterator pointing to the first element inserted, or pos if values is empty.

Definition at line 324 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator[]() [1/2]

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

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

Parameters
ithe index of the element in the array.

Definition at line 230 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ operator[]() [2/2]

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())

Definition at line 213 of file array_base.hpp.

◆ pop_back()

template<class D>
void sparrow::mutable_array_base< D >::pop_back ( )
constexpr

Removes the last element of the array.

Definition at line 387 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ push_back()

template<class D>
template<typename T>
void sparrow::mutable_array_base< D >::push_back ( const nullable< T > & value)
constexpr

Appends a copy of value to the end of the array.

Parameters
valueThe value o the element to append.

Definition at line 378 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ resize()

template<class D>
template<typename T>
void sparrow::mutable_array_base< D >::resize ( size_type new_length,
const nullable< T > & value )
constexpr

Resizes the array to contain new_length elements, does nothing if new_length == size().

If the current size is greater than new_length, the array is reduced to its first new_length elements. If the current size is less than new_length, additional copies of values are appended.

Parameters
new_lengthThe new size of the array.
valueThe value to initialize the new elements with.

Definition at line 266 of file mutable_array_base.hpp.

Here is the call graph for this function:

◆ zero_null_values()

template<class D>
void sparrow::mutable_array_base< D >::zero_null_values ( const inner_value_type & value = inner_value_type())
constexpr

Sets all null values in the array to zero.

This function is a no-op if the array does not have a bitmap.

Definition at line 398 of file mutable_array_base.hpp.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ layout_iterator< iterator_types >

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

Definition at line 188 of file mutable_array_base.hpp.


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