sparrow
2.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Toggle main menu visibility
Loading...
Searching...
No Matches
variable_size_binary_iterator.hpp
Go to the documentation of this file.
1
// Copyright 2024 Man Group Operations Limited
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or mplied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#pragma once
16
17
#include "
sparrow/layout/layout_iterator.hpp
"
18
#include "
sparrow/utils/iterator.hpp
"
19
#include "
sparrow/utils/mp_utils.hpp
"
20
21
namespace
sparrow
22
{
29
template
<
class
Layout, iterator_types Iterator_types>
30
class
variable_size_binary_value_iterator
31
:
public
pointer_index_iterator_base
<
32
variable_size_binary_value_iterator<Layout, Iterator_types>,
33
mpl::constify_t<Layout, true>,
34
typename Iterator_types::value_type,
35
typename Iterator_types::reference,
36
typename Iterator_types::iterator_tag,
37
std::ptrdiff_t>
38
{
39
public
:
40
41
using
self_type
=
variable_size_binary_value_iterator<Layout, Iterator_types>
;
42
using
base_type
=
pointer_index_iterator_base
<
43
self_type
,
44
mpl::constify_t<Layout, true>
,
45
typename
Iterator_types::value_type,
46
typename
Iterator_types::reference,
47
typename
Iterator_types::iterator_tag,
48
std::ptrdiff_t>;
49
using
reference
=
typename
base_type::reference;
50
using
difference_type
=
typename
base_type::difference_type
;
51
using
layout_type
=
mpl::constify_t<Layout, true>
;
52
using
size_type
= std::size_t;
53
using
value_type
=
typename
Iterator_types::value_type;
54
55
constexpr
variable_size_binary_value_iterator
() noexcept = default;
56
constexpr
variable_size_binary_value_iterator
(
layout_type
*
layout
,
size_type
index);
57
58
private:
59
60
[[nodiscard]] constexpr
reference
dereference() const;
61
62
friend class
iterator_access
;
63
};
64
65
/******************************************************
66
* variable_size_binary_value_iterator implementation *
67
******************************************************/
68
69
template <class Layout,
iterator_types
Iterator_types>
70
constexpr
variable_size_binary_value_iterator
<Layout, Iterator_types>::
variable_size_binary_value_iterator
(
71
layout_type
*
layout
,
72
size_type
index
73
)
74
:
base_type
(
layout
, static_cast<
std
::
ptrdiff_t
>(index))
75
{
76
}
77
78
template
<
class
Layout, iterator_types Iterator_types>
79
constexpr
auto
variable_size_binary_value_iterator<Layout, Iterator_types>::dereference() const ->
reference
80
{
81
if
constexpr
(std::same_as<reference, typename Layout::inner_const_reference>)
82
{
83
return
this->
p_object
->value(
static_cast<
size_type
>
(this->
m_index
));
84
}
85
else
86
{
87
return
reference
(
const_cast<
Layout*
>
(this->
p_object
),
static_cast<
size_type
>
(this->
m_index
));
88
}
89
}
90
}
sparrow::pointer_index_iterator_base< variable_size_binary_value_iterator< Layout, Iterator_types >, mpl::constify_t< Layout, true >, Iterator_types::value_type, Iterator_types::reference, Iterator_types::iterator_tag, std::ptrdiff_t >::m_index
std::ptrdiff_t m_index
Definition
iterator.hpp:547
sparrow::pointer_index_iterator_base< variable_size_binary_value_iterator< Layout, Iterator_types >, mpl::constify_t< Layout, true >, Iterator_types::value_type, Iterator_types::reference, Iterator_types::iterator_tag, std::ptrdiff_t >::pointer_index_iterator_base
constexpr pointer_index_iterator_base() noexcept=default
sparrow::pointer_index_iterator_base< self_type, mpl::constify_t< Layout, true >, typename Iterator_types::value_type, typename Iterator_types::reference, typename Iterator_types::iterator_tag, std::ptrdiff_t >::difference_type
std::ptrdiff_t difference_type
Definition
iterator.hpp:542
sparrow::pointer_index_iterator_base< variable_size_binary_value_iterator< Layout, Iterator_types >, mpl::constify_t< Layout, true >, Iterator_types::value_type, Iterator_types::reference, Iterator_types::iterator_tag, std::ptrdiff_t >::p_object
mpl::constify_t< Layout, true > * p_object
Definition
iterator.hpp:546
sparrow::variable_size_binary_value_iterator::layout_type
mpl::constify_t< Layout, true > layout_type
Definition
variable_size_binary_iterator.hpp:51
sparrow::variable_size_binary_value_iterator::difference_type
typename base_type::difference_type difference_type
Definition
variable_size_binary_iterator.hpp:50
sparrow::variable_size_binary_value_iterator::base_type
pointer_index_iterator_base< self_type, mpl::constify_t< Layout, true >, typename Iterator_types::value_type, typename Iterator_types::reference, typename Iterator_types::iterator_tag, std::ptrdiff_t > base_type
Definition
variable_size_binary_iterator.hpp:42
sparrow::variable_size_binary_value_iterator::self_type
variable_size_binary_value_iterator< Layout, Iterator_types > self_type
Definition
variable_size_binary_iterator.hpp:41
sparrow::variable_size_binary_value_iterator::reference
typename base_type::reference reference
Definition
variable_size_binary_iterator.hpp:49
sparrow::variable_size_binary_value_iterator::variable_size_binary_value_iterator
constexpr variable_size_binary_value_iterator() noexcept=default
sparrow::variable_size_binary_value_iterator::value_type
typename Iterator_types::value_type value_type
Definition
variable_size_binary_iterator.hpp:53
sparrow::variable_size_binary_value_iterator::size_type
std::size_t size_type
Definition
variable_size_binary_iterator.hpp:52
sparrow::variable_size_binary_value_iterator< array_type, iterator_types >::iterator_access
friend class iterator_access
Definition
variable_size_binary_iterator.hpp:62
ptrdiff_t
sparrow::iterator_types
Concept for iterator types.
Definition
layout_iterator.hpp:25
sparrow::layout
Concept for layouts.
Definition
layout_concept.hpp:41
iterator.hpp
layout_iterator.hpp
mp_utils.hpp
sparrow::mpl::constify_t
typename constify< T, is_const >::type constify_t
Convenience alias for constify.
Definition
mp_utils.hpp:807
sparrow
Definition
array.hpp:21
std
Extensions to the C++ standard library.
Definition
float16_t.hpp:1916
sparrow
layout
variable_size_binary_iterator.hpp
Generated by
1.17.0