Awkward Array: include/awkward/layoutbuilder/RecordArrayBuilder.h Source File

Loading...
Searching...
No Matches
RecordArrayBuilder.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_RECORDARRAYBUILDER_H_
4#define AWKWARD_RECORDARRAYBUILDER_H_
5
6#include "awkward/layoutbuilder/FormBuilder.h"
7
8namespace awkward {
9
13 template <typename T, typename I>
14 class LIBAWKWARD_EXPORT_SYMBOL RecordArrayBuilder : public FormBuilder<T, I> {
15 public:
17 RecordArrayBuilder(const std::vector<FormBuilderPtr<T, I>>& contents,
18 const util::RecordLookupPtr recordlookup,
19 const util::Parameters& parameters,
20 const std::string& form_key,
21 const std::string attribute = "record",
22 const std::string partition = "0");
23
25 const std::string
26 classname() const override;
27
28 const std::string
29 to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override;
30
32 const std::string
33 vm_output() const override;
34
36 const std::string
37 vm_output_data() const override;
38
40 const std::string
41 vm_func() const override;
42
44 const std::string
45 vm_func_name() const override;
46
48 const std::string
49 vm_func_type() const override;
50
53 const std::string
54 vm_from_stack() const override;
55
57 const std::string
58 vm_error() const override;
59
61 void
62 boolean(bool x, LayoutBuilderPtr<T, I> builder) override;
63
65 void
66 int64(int64_t x, LayoutBuilderPtr<T, I> builder) override;
67
69 void
70 float64(double x, LayoutBuilderPtr<T, I> builder) override;
71
73 void
74 complex(std::complex<double> x, LayoutBuilderPtr<T, I> builder) override;
75
78 void
79 bytestring(const std::string& x, LayoutBuilderPtr<T, I> builder) override;
80
83 void
84 string(const std::string& x, LayoutBuilderPtr<T, I> builder) override;
85
87 void
88 begin_list(LayoutBuilderPtr<T, I> builder) override;
89
91 void
92 end_list(LayoutBuilderPtr<T, I> builder) override;
93
96 bool
97 active() override;
98
99 const std::vector<FormBuilderPtr<T, I>>& contents() const { return contents_; }
100
101 const util::RecordLookupPtr& form_recordlookup() const { return form_recordlookup_; }
102
103 const util::Parameters&
104 form_parameters() const { return parameters_; }
105
106 const std::string&
107 form_key() const {return form_key_; }
108
109 ssize_t
110 len(const ForthOutputBufferMap& outputs) const override;
111
112 private:
114 int64_t field_index();
115
117 std::vector<FormBuilderPtr<T, I>> contents_;
118 std::vector<std::string> fields_;
119 const util::RecordLookupPtr form_recordlookup_;
120
122 const util::Parameters parameters_;
123
125 const std::string form_;
126 const std::string form_key_;
127 int64_t field_index_;
128 int64_t contents_size_;
129 std::vector<int64_t> list_field_index_;
130
133 std::string vm_output_data_;
134 std::string vm_output_;
135 std::string vm_func_name_;
136 std::string vm_func_;
137 std::string vm_func_type_;
138 std::string vm_data_from_stack_;
139 std::string vm_error_;
140 };
141
142}
143
144#endif // AWKWARD_RECORDARRAYBUILDER_H_
FormBuilder.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::FormBuilder
Abstract base class for nodes within a LayoutBuilder Every builder will have an output buffer based o...
Definition: FormBuilder.h:30
awkward::LayoutBuilder
User interface to the FormBuilder system: the LayoutBuilder is a fixed reference while the FormBuilde...
Definition: LayoutBuilder.h:62
awkward::RecordArrayBuilder
Definition: RecordArrayBuilder.h:14
awkward::RecordArrayBuilder::contents
const std::vector< FormBuilderPtr< T, I > > & contents() const
Definition: RecordArrayBuilder.h:99
awkward::RecordArrayBuilder::vm_output
const std::string vm_output() const override
AwkwardForth virtual machine instructions of the data outputs.
awkward::RecordArrayBuilder::form_recordlookup
const util::RecordLookupPtr & form_recordlookup() const
Definition: RecordArrayBuilder.h:101
awkward::RecordArrayBuilder::begin_list
void begin_list(LayoutBuilderPtr< T, I > builder) override
Begins building a nested list.
awkward::RecordArrayBuilder::len
ssize_t len(const ForthOutputBufferMap &outputs) const override
The builder's output buffer length.
awkward::RecordArrayBuilder::float64
void float64(double x, LayoutBuilderPtr< T, I > builder) override
Adds a real value x to the accumulated data.
awkward::RecordArrayBuilder::to_buffers
const std::string to_buffers(BuffersContainer &container, const ForthOutputBufferMap &outputs) const override
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON).
awkward::RecordArrayBuilder::form_key
const std::string & form_key() const
Definition: RecordArrayBuilder.h:107
awkward::RecordArrayBuilder::string
void string(const std::string &x, LayoutBuilderPtr< T, I > builder) override
Adds a UTF-8 encoded bytestring x in STL format to the accumulated data.
awkward::RecordArrayBuilder::int64
void int64(int64_t x, LayoutBuilderPtr< T, I > builder) override
Adds an integer value x to the accumulated data.
awkward::RecordArrayBuilder::form_parameters
const util::Parameters & form_parameters() const
Definition: RecordArrayBuilder.h:104
awkward::RecordArrayBuilder::vm_func_name
const std::string vm_func_name() const override
The array builder VM function name.
awkward::RecordArrayBuilder::vm_output_data
const std::string vm_output_data() const override
AwkwardForth virtual machine data output key.
awkward::RecordArrayBuilder::vm_func
const std::string vm_func() const override
AwkwardForth virtual machine instructions of the array builder function.
awkward::RecordArrayBuilder::vm_func_type
const std::string vm_func_type() const override
The array builder VM function type.
awkward::RecordArrayBuilder::boolean
void boolean(bool x, LayoutBuilderPtr< T, I > builder) override
Adds a boolean value x to the accumulated data.
awkward::RecordArrayBuilder::vm_error
const std::string vm_error() const override
Error messages in the AwkwardForth virtual machine instructions.
awkward::RecordArrayBuilder::bytestring
void bytestring(const std::string &x, LayoutBuilderPtr< T, I > builder) override
Adds an unencoded bytestring x in STL format to the accumulated data.
awkward::RecordArrayBuilder::complex
void complex(std::complex< double > x, LayoutBuilderPtr< T, I > builder) override
Adds a complex value x to the accumulated data.
awkward::RecordArrayBuilder::active
bool active() override
If true, this node's content has started but has not finished a multi-step command (e....
awkward::RecordArrayBuilder::vm_from_stack
const std::string vm_from_stack() const override
AwkwardForth virtual machine instructions to retrieve the data from the VM stack.
awkward::RecordArrayBuilder::end_list
void end_list(LayoutBuilderPtr< T, I > builder) override
Ends a nested list.
awkward::RecordArrayBuilder::classname
const std::string classname() const override
User-friendly name of this class.
awkward::RecordArrayBuilder::RecordArrayBuilder
RecordArrayBuilder(const std::vector< FormBuilderPtr< T, I > > &contents, const util::RecordLookupPtr recordlookup, const util::Parameters &parameters, const std::string &form_key, const std::string attribute="record", const std::string partition="0")
Creates a RecordArrayBuilder from a full set of parameters.
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward::util::Parameters
std::map< std::string, std::string > Parameters
Definition: util.h:165
awkward::util::RecordLookupPtr
std::shared_ptr< RecordLookup > RecordLookupPtr
Definition: util.h:130
awkward
Definition: BitMaskedArray.h:15
awkward::ForthOutputBufferMap
std::map< std::string, std::shared_ptr< ForthOutputBuffer > > ForthOutputBufferMap
Definition: FormBuilder.h:16
awkward::FormBuilderPtr
std::shared_ptr< FormBuilder< T, I > > FormBuilderPtr
Definition: FormBuilder.h:177