Awkward Array: include/awkward/builder/OptionBuilder.h Source File

Loading...
Searching...
No Matches
OptionBuilder.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_OPTIONBUILDER_H_
4#define AWKWARD_OPTIONBUILDER_H_
5
6#include <vector>
7
8#include "awkward/common.h"
9#include "awkward/BuilderOptions.h"
10#include "awkward/GrowableBuffer.h"
11#include "awkward/builder/Builder.h"
12
13namespace awkward {
14
18 class LIBAWKWARD_EXPORT_SYMBOL OptionBuilder: public Builder {
19 public:
25 static const BuilderPtr
26 fromnulls(const BuilderOptions& options,
27 int64_t nullcount,
28 const BuilderPtr& content);
29
35 static const BuilderPtr
36 fromvalids(const BuilderOptions& options,
37 const BuilderPtr& content);
38
46 OptionBuilder(const BuilderOptions& options,
47 GrowableBuffer<int64_t> index,
48 const BuilderPtr content);
49
51 const std::string
52 classname() const override;
53
54 const std::string
55 to_buffers(BuffersContainer& container, int64_t& form_key_id) const override;
56
57 int64_t
58 length() const override;
59
60 void
61 clear() override;
62
66 bool
67 active() const override;
68
69 const BuilderPtr
70 null() override;
71
72 const BuilderPtr
73 boolean(bool x) override;
74
75 const BuilderPtr
76 integer(int64_t x) override;
77
78 const BuilderPtr
79 real(double x) override;
80
81 const BuilderPtr
82 complex(std::complex<double> x) override;
83
84 const BuilderPtr
85 datetime(int64_t x, const std::string& unit) override;
86
87 const BuilderPtr
88 timedelta(int64_t x, const std::string& unit) override;
89
90 const BuilderPtr
91 string(const char* x, int64_t length, const char* encoding) override;
92
93 const BuilderPtr
94 beginlist() override;
95
96 const BuilderPtr
97 endlist() override;
98
99 const BuilderPtr
100 begintuple(int64_t numfields) override;
101
102 const BuilderPtr
103 index(int64_t index) override;
104
105 const BuilderPtr
106 endtuple() override;
107
108 const BuilderPtr
109 beginrecord(const char* name, bool check) override;
110
111 void
112 field(const char* key, bool check) override;
113
114 const BuilderPtr
115 endrecord() override;
116
117 const GrowableBuffer<int64_t>& buffer() const { return index_; }
118
119 const GrowableBuffer<int64_t>& index() { return index_; }
120
121 const BuilderPtr builder() const { return content_; }
122
123 void
124 maybeupdate(const BuilderPtr builder);
125
126 private:
127 GrowableBuffer<int64_t> index_;
128 BuilderPtr content_;
129 };
130
131}
132
133#endif // AWKWARD_OPTIONBUILDER_H_
BuilderOptions.h
Builder.h
GrowableBuffer.h
awkward::BuffersContainer
Abstract class to represent the output of ak.to_buffers. In Python, this would be a dict of NumPy arr...
Definition: Builder.h:20
awkward::Builder
Abstract base class for nodes within an ArrayBuilder that cumulatively discover an array's type and f...
Definition: Builder.h:41
awkward::GrowableBuffer
Discontiguous, one-dimensional buffer (which consists of multiple contiguous, one-dimensional panels)...
Definition: GrowableBuffer.h:174
awkward::OptionBuilder
Builder node that accumulates data with missing values (None).
Definition: OptionBuilder.h:18
awkward::OptionBuilder::fromnulls
static const BuilderPtr fromnulls(const BuilderOptions &options, int64_t nullcount, const BuilderPtr &content)
Create an OptionBuilder from a number of nulls (all missing).
awkward::OptionBuilder::real
const BuilderPtr real(double x) override
Adds a real value x to the accumulated data.
awkward::OptionBuilder::buffer
const GrowableBuffer< int64_t > & buffer() const
Definition: OptionBuilder.h:117
awkward::OptionBuilder::endlist
const BuilderPtr endlist() override
Ends a nested list.
awkward::OptionBuilder::timedelta
const BuilderPtr timedelta(int64_t x, const std::string &unit) override
Adds a timedelta value x to the accumulated data.
awkward::OptionBuilder::field
void field(const char *key, bool check) override
Sets the pointer to a given record field key; the next command will fill that slot.
awkward::OptionBuilder::complex
const BuilderPtr complex(std::complex< double > x) override
Adds a complex value x to the accumulated data.
awkward::OptionBuilder::index
const BuilderPtr index(int64_t index) override
Sets the pointer to a given tuple field index; the next command will fill that slot.
awkward::OptionBuilder::OptionBuilder
OptionBuilder(const BuilderOptions &options, GrowableBuffer< int64_t > index, const BuilderPtr content)
Create a OptionBuilder from a full set of parameters.
awkward::OptionBuilder::length
int64_t length() const override
Current length of the accumulated array.
awkward::OptionBuilder::endrecord
const BuilderPtr endrecord() override
Ends a record.
awkward::OptionBuilder::active
bool active() const override
If true, this node has started but has not finished a multi-step command (e.g. beginX ....
awkward::OptionBuilder::string
const BuilderPtr string(const char *x, int64_t length, const char *encoding) override
Adds a string value x with a given length and encoding to the accumulated data.
awkward::OptionBuilder::integer
const BuilderPtr integer(int64_t x) override
Adds an integer value x to the accumulated data.
awkward::OptionBuilder::datetime
const BuilderPtr datetime(int64_t x, const std::string &unit) override
Adds a datetime value x to the accumulated data.
awkward::OptionBuilder::maybeupdate
void maybeupdate(const BuilderPtr builder)
awkward::OptionBuilder::beginrecord
const BuilderPtr beginrecord(const char *name, bool check) override
Begins building a record with an optional name.
awkward::OptionBuilder::null
const BuilderPtr null() override
Adds a null value to the accumulated data.
awkward::OptionBuilder::builder
const BuilderPtr builder() const
Definition: OptionBuilder.h:121
awkward::OptionBuilder::index
const GrowableBuffer< int64_t > & index()
Definition: OptionBuilder.h:119
awkward::OptionBuilder::to_buffers
const std::string to_buffers(BuffersContainer &container, int64_t &form_key_id) const override
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON).
awkward::OptionBuilder::beginlist
const BuilderPtr beginlist() override
Begins building a nested list.
awkward::OptionBuilder::boolean
const BuilderPtr boolean(bool x) override
Adds a boolean value x to the accumulated data.
awkward::OptionBuilder::begintuple
const BuilderPtr begintuple(int64_t numfields) override
Begins building a tuple with a fixed number of fields.
awkward::OptionBuilder::endtuple
const BuilderPtr endtuple() override
Ends a tuple.
awkward::OptionBuilder::classname
const std::string classname() const override
User-friendly name of this class: "OptionBuilder".
awkward::OptionBuilder::clear
void clear() override
Removes all accumulated data without resetting the type knowledge.
awkward::OptionBuilder::fromvalids
static const BuilderPtr fromvalids(const BuilderOptions &options, const BuilderPtr &content)
Create an OptionBuilder from an existing builder (all non-missing).
common.h
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward
Definition: BitMaskedArray.h:15
awkward::BuilderPtr
std::shared_ptr< Builder > BuilderPtr
Definition: ArrayBuilder.h:16
awkward::Options
Container for all configuration options needed by ArrayBuilder, GrowableBuffer, LayoutBuilder and the...
Definition: BuilderOptions.h:20