Awkward Array: src/awkward/_v2/cpp-headers/awkward/BuilderOptions.h Source File

Loading...
Searching...
No Matches
BuilderOptions.h
Go to the documentation of this file.
1// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
3#ifndef AWKWARD_BUILDEROPTIONS_H_
4#define AWKWARD_BUILDEROPTIONS_H_
5
6#include <cassert>
7#include <cstring>
8#include <tuple>
9#include <type_traits>
10#include <vector>
11#include <stdint.h>
12
13namespace awkward {
14
19 template <typename... OPTIONS>
20 struct Options {
21 static constexpr std::size_t value = sizeof...(OPTIONS);
22
23 using OptionsPack = typename std::tuple<OPTIONS...>;
24
25 // FIXME:
26 // std::tuple_element_t is missing on some of the CI node compilers
27 //
28 // template<std::size_t INDEX>
29 // using OptionType = std::tuple_element_t<INDEX, OptionsPack>;
30
31 template <std::size_t INDEX>
32 using OptionType =
33 typename std::tuple_element<INDEX, decltype(OptionsPack())>::type;
34
36 Options(OPTIONS... options) : pars(options...) {}
37
40 int64_t
41 initial() const noexcept {
42 return option<0>();
43 }
44
48 double
49 resize() const noexcept {
50 return option<1>();
51 }
52
54 template <std::size_t INDEX>
55 const OptionType<INDEX>&
56 option() const noexcept {
57 return std::get<INDEX>(pars);
58 }
59
60 OptionsPack pars;
61 };
62
63 using BuilderOptions = Options<int64_t, double>;
64} // namespace awkward
65
66#endif // AWKWARD_BUILDEROPTIONS_H_
awkward::OptionType
Describes the high level type of data with possible missing values, represented by None in python.
Definition: OptionType.h:18
awkward
Definition: BitMaskedArray.h:15
awkward::Options
Container for all configuration options needed by ArrayBuilder, GrowableBuffer, LayoutBuilder and the...
Definition: BuilderOptions.h:20
awkward::Options::initial
int64_t initial() const noexcept
The initial number of reserved entries for a GrowableBuffer.
Definition: BuilderOptions.h:41
awkward::Options::value
static constexpr std::size_t value
Definition: BuilderOptions.h:21
awkward::Options::Options
Options(OPTIONS... options)
Creates an Options tuple from a full set of parameters.
Definition: BuilderOptions.h:36
awkward::Options::resize
double resize() const noexcept
The factor with which a GrowableBuffer is resized when its length reaches its reserved.
Definition: BuilderOptions.h:49
awkward::Options::OptionType
typename std::tuple_element< INDEX, decltype(OptionsPack())>::type OptionType
Definition: BuilderOptions.h:33
awkward::Options::pars
OptionsPack pars
Definition: BuilderOptions.h:60
awkward::Options::OptionsPack
typename std::tuple< OPTIONS... > OptionsPack
Definition: BuilderOptions.h:23
awkward::Options::option
const OptionType< INDEX > & option() const noexcept
Access to all other options.
Definition: BuilderOptions.h:56