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

Loading...
Searching...
No Matches
UnknownBuilder.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_UNKNOWNBUILDER_H_
4#define AWKWARD_UNKNOWNBUILDER_H_
5
6#include <vector>
7
8#include "awkward/common.h"
9#include "awkward/BuilderOptions.h"
10#include "awkward/builder/Builder.h"
11
12namespace awkward {
13
17 class LIBAWKWARD_EXPORT_SYMBOL UnknownBuilder: public Builder {
18 public:
22 static const BuilderPtr
23 fromempty(const BuilderOptions& options);
24
30 UnknownBuilder(const BuilderOptions& options, int64_t nullcount);
31
33 const std::string
34 classname() const override;
35
36 const std::string
37 to_buffers(BuffersContainer& container, int64_t& form_key_id) const override;
38
39 int64_t
40 length() const override;
41
42 void
43 clear() override;
44
48 bool
49 active() const override;
50
51 const BuilderPtr
52 null() override;
53
54 const BuilderPtr
55 boolean(bool x) override;
56
57 const BuilderPtr
58 integer(int64_t x) override;
59
60 const BuilderPtr
61 real(double x) override;
62
63 const BuilderPtr
64 complex(std::complex<double> x) override;
65
66 const BuilderPtr
67 datetime(int64_t x, const std::string& unit) override;
68
69 const BuilderPtr
70 timedelta(int64_t x, const std::string& unit) override;
71
72 const BuilderPtr
73 string(const char* x, int64_t length, const char* encoding) override;
74
75 const BuilderPtr
76 beginlist() override;
77
78 const BuilderPtr
79 endlist() override;
80
81 const BuilderPtr
82 begintuple(int64_t numfields) override;
83
84 const BuilderPtr
85 index(int64_t index) override;
86
87 const BuilderPtr
88 endtuple() override;
89
90 const BuilderPtr
91 beginrecord(const char* name, bool check) override;
92
93 void
94 field(const char* key, bool check) override;
95
96 const BuilderPtr
97 endrecord() override;
98
99 const BuilderOptions&
100 options() const { return options_; }
101
102 const int64_t nullcount() const { return nullcount_; }
103
104 private:
105 const BuilderOptions options_;
106 int64_t nullcount_;
107 };
108}
109
110#endif // AWKWARD_UNKNOWNBUILDER_H_
BuilderOptions.h
Builder.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::UnknownBuilder
Builder node for accumulated data whose type is not yet known.
Definition: UnknownBuilder.h:17
awkward::UnknownBuilder::real
const BuilderPtr real(double x) override
Adds a real value x to the accumulated data.
awkward::UnknownBuilder::endlist
const BuilderPtr endlist() override
Ends a nested list.
awkward::UnknownBuilder::fromempty
static const BuilderPtr fromempty(const BuilderOptions &options)
Create an empty UnknownBuilder.
awkward::UnknownBuilder::timedelta
const BuilderPtr timedelta(int64_t x, const std::string &unit) override
Adds a timedelta value x to the accumulated data.
awkward::UnknownBuilder::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::UnknownBuilder::complex
const BuilderPtr complex(std::complex< double > x) override
Adds a complex value x to the accumulated data.
awkward::UnknownBuilder::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::UnknownBuilder::length
int64_t length() const override
Current length of the accumulated array.
awkward::UnknownBuilder::endrecord
const BuilderPtr endrecord() override
Ends a record.
awkward::UnknownBuilder::active
bool active() const override
If true, this node has started but has not finished a multi-step command (e.g. beginX ....
awkward::UnknownBuilder::nullcount
const int64_t nullcount() const
Definition: UnknownBuilder.h:102
awkward::UnknownBuilder::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::UnknownBuilder::options
const BuilderOptions & options() const
Definition: UnknownBuilder.h:100
awkward::UnknownBuilder::integer
const BuilderPtr integer(int64_t x) override
Adds an integer value x to the accumulated data.
awkward::UnknownBuilder::datetime
const BuilderPtr datetime(int64_t x, const std::string &unit) override
Adds a datetime value x to the accumulated data.
awkward::UnknownBuilder::beginrecord
const BuilderPtr beginrecord(const char *name, bool check) override
Begins building a record with an optional name.
awkward::UnknownBuilder::null
const BuilderPtr null() override
Adds a null value to the accumulated data.
awkward::UnknownBuilder::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::UnknownBuilder::UnknownBuilder
UnknownBuilder(const BuilderOptions &options, int64_t nullcount)
Create a ListBuilder from a full set of parameters.
awkward::UnknownBuilder::beginlist
const BuilderPtr beginlist() override
Begins building a nested list.
awkward::UnknownBuilder::boolean
const BuilderPtr boolean(bool x) override
Adds a boolean value x to the accumulated data.
awkward::UnknownBuilder::begintuple
const BuilderPtr begintuple(int64_t numfields) override
Begins building a tuple with a fixed number of fields.
awkward::UnknownBuilder::endtuple
const BuilderPtr endtuple() override
Ends a tuple.
awkward::UnknownBuilder::classname
const std::string classname() const override
User-friendly name of this class: "UnknownBuilder".
awkward::UnknownBuilder::clear
void clear() override
Removes all accumulated data without resetting the type knowledge.
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