sparrow
2.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Toggle main menu visibility
Loading...
Searching...
No Matches
primitive_array.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/primitive_array_impl.hpp
"
18
#include "
sparrow/types/data_type.hpp
"
19
20
namespace
sparrow
21
{
22
template
<
typename
T>
23
concept
primitive_type
= std::is_arithmetic_v<T> || std::is_same_v<T, float16_t> || std::is_same_v<T, bool>;
24
25
namespace
detail
26
{
27
template
<primitive_type T>
28
struct
primitive_data_traits
<T>
29
{
30
// Using data_type_from_size instead of specializing primitive_data_traits
31
// for all integers and floating point types nicely handles platforms
32
// where std::size_t or unsigned long are not the same as fixed width
33
// integer types.
34
static
constexpr
sparrow::data_type
type_id
=
sparrow::data_type_from_size<T>
();
35
};
36
37
template
<>
38
struct
primitive_data_traits
<bool>
39
{
40
static
constexpr
sparrow::data_type
type_id
=
sparrow::data_type::BOOL
;
41
};
42
}
43
60
template
<primitive_type T,
typename
Ext = empty_extension, trivial_copyable_type T2 = T>
61
using
primitive_array
=
primitive_array_impl<T, Ext, T2>
;
62
63
template
<
class
T>
64
struct
is_primitive_array
: std::false_type
65
{
66
};
67
68
template
<
class
T,
typename
Ext, trivial_copyable_type T2>
69
struct
is_primitive_array
<
primitive_array
<T, Ext, T2>> : std::true_type
70
{
71
};
72
76
template
<
class
T>
77
constexpr
bool
is_primitive_array_v
=
is_primitive_array<T>::value
;
78
}
sparrow::primitive_array_impl
Definition
primitive_array_impl.hpp:125
sparrow::primitive_type
Definition
primitive_array.hpp:23
data_type.hpp
sparrow::detail
Definition
dynamic_bitset.hpp:391
sparrow
Definition
array.hpp:21
sparrow::is_primitive_array_v
constexpr bool is_primitive_array_v
Checkes whether T is a primitive_array type.
Definition
primitive_array.hpp:77
sparrow::primitive_array
primitive_array_impl< T, Ext, T2 > primitive_array
Array of values of whose type has fixed binary size.
Definition
primitive_array.hpp:61
sparrow::data_type_from_size
constexpr data_type data_type_from_size(T={}) noexcept
Definition
data_type.hpp:446
sparrow::data_type
data_type
Runtime identifier of arrow data types, usually associated with raw bytes with the associated value.
Definition
data_type.hpp:177
sparrow::data_type::BOOL
@ BOOL
Definition
data_type.hpp:179
primitive_array_impl.hpp
sparrow::detail::primitive_data_traits< T >::type_id
static constexpr sparrow::data_type type_id
Definition
primitive_array.hpp:34
sparrow::detail::primitive_data_traits< bool >::type_id
static constexpr sparrow::data_type type_id
Definition
primitive_array.hpp:40
sparrow::detail::primitive_data_traits
Definition
primitive_array_impl.hpp:69
sparrow::is_primitive_array
Definition
primitive_array.hpp:65
sparrow
primitive_array.hpp
Generated by
1.17.0