sparrow 2.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Loading...
Searching...
No Matches
sparrow::list_value Class Reference

#include <list_value.hpp>

Public Types

using value_type = array_traits::value_type
 
using const_reference = array_traits::const_reference
 
using size_type = std::size_t
 
using list_value_reverse_iterator = std::reverse_iterator<list_value_iterator>
 

Public Member Functions

 list_value ()=default
 Default constructor creating an empty list view.
 
 list_value (const array *flat_array, size_type index_begin, size_type index_end)
 Constructs list view over specified array range.
 
size_type size () const
 Gets the number of elements in the list.
 
bool empty () const
 Checks if the list is empty.
 
const_reference operator[] (size_type i) const
 Gets element at specified position without bounds checking.
 
const_reference front () const
 Gets reference to the first element.
 
const_reference back () const
 Gets reference to the last element.
 
list_value_iterator begin ()
 Gets iterator to the beginning of the list.
 
list_value_iterator begin () const
 Gets const iterator to the beginning of the list.
 
list_value_iterator cbegin () const
 Gets const iterator to the beginning of the list.
 
list_value_iterator end ()
 Gets iterator to the end of the list.
 
list_value_iterator end () const
 Gets const iterator to the end of the list.
 
list_value_iterator cend () const
 Gets const iterator to the end of the list.
 
list_value_reverse_iterator rbegin ()
 Gets reverse iterator to the beginning of reversed list.
 
list_value_reverse_iterator rbegin () const
 Gets const reverse iterator to the beginning of reversed list.
 
list_value_reverse_iterator crbegin () const
 Gets const reverse iterator to the beginning of reversed list.
 
list_value_reverse_iterator rend ()
 Gets reverse iterator to the end of reversed list.
 
list_value_reverse_iterator rend () const
 Gets const reverse iterator to the end of reversed list.
 
list_value_reverse_iterator crend () const
 Gets const reverse iterator to the end of reversed list.
 

Friends

template<bool BIG>
class list_array_impl
 
template<bool BIG>
class list_view_array_impl
 
class fixed_sized_list_array
 
template<class DERIVED>
class list_array_crtp_base
 

Detailed Description

Member Typedef Documentation

◆ const_reference

◆ list_value_reverse_iterator

Definition at line 145 of file list_value.hpp.

◆ size_type

◆ value_type

Constructor & Destructor Documentation

◆ list_value() [1/2]

sparrow::list_value::list_value ( )
default

Default constructor creating an empty list view.

Postcondition
size() returns 0
empty() returns true
All iterators are equal (begin() == end())

◆ list_value() [2/2]

sparrow::list_value::list_value ( const array * flat_array,
size_type index_begin,
size_type index_end )

Constructs list view over specified array range.

Parameters
flat_arrayPointer to the flattened array containing list data
index_beginStarting index of the list (inclusive)
index_endEnding index of the list (exclusive)
Precondition
flat_array must be a valid pointer to the flat child handle
index_begin must be <= index_end
index_end must be <= flat_array->size()
Postcondition
size() returns (index_end - index_begin)
List provides view over elements [index_begin, index_end)
Iterators are valid for traversing the specified range

Member Function Documentation

◆ back()

const_reference sparrow::list_value::back ( ) const
nodiscard

Gets reference to the last element.

Returns
Const reference to the last element
Precondition
List must not be empty (!empty())
Postcondition
Returns valid reference to last element
Equivalent to (*this)[size() - 1]
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/list_value.hpp.

◆ begin() [1/2]

list_value_iterator sparrow::list_value::begin ( )
nodiscard

Gets iterator to the beginning of the list.

Returns
Iterator pointing to the first element
Postcondition
Iterator is valid for list traversal
For empty list, equals end()
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/list_value.hpp.

◆ begin() [2/2]

list_value_iterator sparrow::list_value::begin ( ) const
nodiscard

Gets const iterator to the beginning of the list.

Returns
Const iterator pointing to the first element
Postcondition
Iterator is valid for list traversal
For empty list, equals end()

◆ cbegin()

list_value_iterator sparrow::list_value::cbegin ( ) const
nodiscard

Gets const iterator to the beginning of the list.

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

◆ cend()

list_value_iterator sparrow::list_value::cend ( ) const
nodiscard

Gets const iterator to the end of the list.

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

◆ crbegin()

list_value_reverse_iterator sparrow::list_value::crbegin ( ) const
nodiscard

Gets const reverse iterator to the beginning of reversed list.

Returns
Const reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
Guarantees const iterator even for non-const list

◆ crend()

list_value_reverse_iterator sparrow::list_value::crend ( ) const
nodiscard

Gets const reverse iterator to the end of reversed list.

Returns
Const reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Guarantees const iterator even for non-const list

◆ empty()

bool sparrow::list_value::empty ( ) const
nodiscard

Checks if the list is empty.

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

◆ end() [1/2]

list_value_iterator sparrow::list_value::end ( )
nodiscard

Gets iterator to the end of the list.

Returns
Iterator pointing past the last element
Postcondition
Iterator marks the end of the list range
Not dereferenceable
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/list_value.hpp.

◆ end() [2/2]

list_value_iterator sparrow::list_value::end ( ) const
nodiscard

Gets const iterator to the end of the list.

Returns
Const iterator pointing past the last element
Postcondition
Iterator marks the end of the list range
Not dereferenceable

◆ front()

const_reference sparrow::list_value::front ( ) const
nodiscard

Gets reference to the first element.

Returns
Const reference to the first element
Precondition
List must not be empty (!empty())
Postcondition
Returns valid reference to first element
Equivalent to (*this)[0]
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/list_value.hpp.

◆ operator[]()

const_reference sparrow::list_value::operator[] ( size_type i) const

Gets element at specified position without bounds checking.

Parameters
iIndex of element to access
Returns
Const reference to element at position i
Precondition
i must be < size()
Postcondition
Returns valid reference to element
Reference remains valid while underlying array exists

◆ rbegin() [1/2]

list_value_reverse_iterator sparrow::list_value::rbegin ( )
nodiscard

Gets reverse iterator to the beginning of reversed list.

Returns
Reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
For empty list, equals rend()

◆ rbegin() [2/2]

list_value_reverse_iterator sparrow::list_value::rbegin ( ) const
nodiscard

Gets const reverse iterator to the beginning of reversed list.

Returns
Const reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
For empty list, equals rend()

◆ rend() [1/2]

list_value_reverse_iterator sparrow::list_value::rend ( )
nodiscard

Gets reverse iterator to the end of reversed list.

Returns
Reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Not dereferenceable

◆ rend() [2/2]

list_value_reverse_iterator sparrow::list_value::rend ( ) const
nodiscard

Gets const reverse iterator to the end of reversed list.

Returns
Const reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Not dereferenceable

◆ size()

size_type sparrow::list_value::size ( ) const
nodiscard

Gets the number of elements in the list.

Returns
Number of elements in the list view
Postcondition
Returns non-negative count
Equals (index_end - index_begin)
Examples
/home/runner/work/sparrow/sparrow/include/sparrow/layout/list_value.hpp.

Friends And Related Symbol Documentation

◆ fixed_sized_list_array

friend class fixed_sized_list_array
friend

Definition at line 385 of file list_value.hpp.

◆ list_array_crtp_base

template<class DERIVED>
friend class list_array_crtp_base
friend

Definition at line 388 of file list_value.hpp.

◆ list_array_impl

template<bool BIG>
friend class list_array_impl
friend

Definition at line 380 of file list_value.hpp.

◆ list_view_array_impl

template<bool BIG>
friend class list_view_array_impl
friend

Definition at line 383 of file list_value.hpp.


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