sparrow 0.3.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

reference operator[] (size_type i)
 Returns a reference to the element at the specified position in the array.
 
iterator begin ()
 Returns an iterator to the first element of the array.
 
iterator end ()
 Returns a iterator to the element following the last element of the array.
 
template<typename T>
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>
iterator insert (const_iterator pos, const nullable< T > &value)
 
template<typename T>
iterator insert (const_iterator pos, const nullable< T > &value, size_type count)
 
template<typename T>
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>
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>
iterator insert (const_iterator pos, const R &range)
 Inserts elements from range range before pos in the array.
 
iterator erase (const_iterator pos)
 Removes the element at pos from the array.
 
iterator erase (const_iterator first, const_iterator last)
 Removes the elemens in the range [\cfirst , \clast ) from the array.
 
template<typename T>
void push_back (const nullable< T > &value)
 Appends a copy of value to the end of the array.
 
void pop_back ()
 Removes the last element of the array.
 
template<typename T>
auto insert (const_iterator pos, const nullable< T > &value) -> iterator
 Inserts a copy of value before pos in the array.
 
template<typename T>
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>
auto insert (const_iterator pos, std::initializer_list< nullable< T > > values) -> iterator
 Inserts elements from initializer list values before pos in the array.
 
const_reference operator[] (size_type i) const
 Returns a constant reference to the element at the specified position in the array.
 
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.
 
- Public Member Functions inherited from sparrow::array_crtp_base< D >
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

 mutable_array_base (arrow_proxy)
 
 mutable_array_base (const mutable_array_base &)=default
 
mutable_array_baseoperator= (const mutable_array_base &)=default
 
 mutable_array_base (mutable_array_base &&)=default
 
mutable_array_baseoperator= (mutable_array_base &&)=default
 
bitmap_reference has_value (size_type i)
 
bitmap_iterator bitmap_begin ()
 
bitmap_iterator bitmap_end ()
 
bitmap_const_reference has_value (size_type i) const
 
- Protected Member Functions inherited from sparrow::array_crtp_base< D >
 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 >
 

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 34 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 39 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 48 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 49 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 50 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 47 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 46 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 51 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 76 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 60 of file mutable_array_base.hpp.

◆ derived_type

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

Definition at line 40 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 44 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 57 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 56 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 41 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 53 of file mutable_array_base.hpp.

◆ iterator

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

Definition at line 75 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 64 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 59 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 38 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 43 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 62 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 54 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 195 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 > & )
protecteddefault
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 > && )
protecteddefault
Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

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

Returns an iterator to the first element of the array.

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

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

Definition at line 118 of file array_base.hpp.

◆ bitmap_begin()

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

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

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:

◆ end() [1/2]

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

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

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

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

Definition at line 119 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 )

Removes the elemens in the range [\cfirst , \clast ) 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 345 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)

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 330 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)
nodiscardprotected

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

Definition at line 168 of file array_base.hpp.

◆ insert() [1/8]

template<class D>
template<typename T>
iterator sparrow::mutable_array_base< D >::insert ( const_iterator pos,
const nullable< T > & value )
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

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

◆ 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

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 293 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 )
inline

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 160 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 )
inline

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

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

◆ operator[]() [1/2]

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

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 225 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
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 114 of file array_base.hpp.

◆ pop_back()

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

Removes the last element of the array.

Definition at line 381 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)

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

Parameters
valueThe value o the element to append.

Definition at line 372 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 )

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 260 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 185 of file mutable_array_base.hpp.


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