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/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 template<std::size_t INDEX>
26 using OptionType = std::tuple_element_t<INDEX, OptionsPack>;
27
29 Options(OPTIONS... options) : pars(options...) {}
30
33 int64_t
34 initial() const noexcept {
35 return option<0>();
36 }
37
41 double
43 return option<1>();
44 }
45
47 template <std::size_t INDEX>
50 return std::get<INDEX>(pars);
51 }
52
54 };
55
57} // namespace awkward
58
59#endif // AWKWARD_BUILDEROPTIONS_H_
Definition ArrayBuilder.h:14
Container for all configuration options needed by ArrayBuilder, GrowableBuffer, LayoutBuilder and the...
Definition BuilderOptions.h:20
int64_t initial() const noexcept
The initial number of reserved entries for a GrowableBuffer.
Definition BuilderOptions.h:34
static constexpr std::size_t value
Definition BuilderOptions.h:21
Options(OPTIONS... options)
Creates an Options tuple from a full set of parameters.
Definition BuilderOptions.h:29
double resize() const noexcept
The factor with which a GrowableBuffer is resized when its length reaches its reserved.
Definition BuilderOptions.h:42
OptionsPack pars
Definition BuilderOptions.h:53
typename std::tuple< OPTIONS... > OptionsPack
Definition BuilderOptions.h:23
std::tuple_element_t< INDEX, OptionsPack > OptionType
Definition BuilderOptions.h:26
const OptionType< INDEX > & option() const noexcept
Access to all other options.
Definition BuilderOptions.h:49