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

Loading...
Searching...
No Matches
UnmaskedArrayBuilder.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_UNMASKEDARRAYBUILDER_H_
4#define AWKWARD_UNMASKEDARRAYBUILDER_H_
5
6#include "awkward/layoutbuilder/FormBuilder.h"
7
8namespace awkward {
9
13 template <typename T, typename I>
14 class LIBAWKWARD_EXPORT_SYMBOL UnmaskedArrayBuilder : public FormBuilder<T, I> {
15 public:
17 UnmaskedArrayBuilder(FormBuilderPtr<T, I> content,
18 const util::Parameters& parameters,
19 const std::string& form_key,
20 const std::string attribute = "mask",
21 const std::string partition = "0");
22
24 const std::string
25 classname() const override;
26
27 const std::string
28 to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override;
29
31 const std::string
32 vm_output() const override;
33
35 const std::string
36 vm_output_data() const override;
37
39 const std::string
40 vm_func() const override;
41
43 const std::string
44 vm_func_name() const override;
45
47 const std::string
48 vm_func_type() const override;
49
52 const std::string
53 vm_from_stack() const override;
54
56 const std::string
57 vm_error() const override;
58
60 void
61 boolean(bool x, LayoutBuilderPtr<T, I> builder) override;
62
64 void
65 int64(int64_t x, LayoutBuilderPtr<T, I> builder) override;
66
68 void
69 float64(double x, LayoutBuilderPtr<T, I> builder) override;
70
72 void
73 complex(std::complex<double> x, LayoutBuilderPtr<T, I> builder) override;
74
77 void
78 bytestring(const std::string& x, LayoutBuilderPtr<T, I> builder) override;
79
82 void
83 string(const std::string& x, LayoutBuilderPtr<T, I> builder) override;
84
86 void
87 begin_list(LayoutBuilderPtr<T, I> builder) override;
88
90 void
91 end_list(LayoutBuilderPtr<T, I> builder) override;
92
94 const
95 FormBuilderPtr<T, I> content() const { return content_; }
96
103 const util::Parameters&
104 form_parameters() const { return parameters_; }
105
106 ssize_t
107 len(const ForthOutputBufferMap& outputs) const override {
108 auto search = outputs.find(content().get()->vm_output_data());
109 if (search != outputs.end()) {
110 return (ssize_t)search->second.get()->len();
111 }
112 return 0;
113 }
114
115 private:
117 FormBuilderPtr<T, I> content_;
118
120 const util::Parameters& parameters_;
121
124 std::string vm_output_data_;
125 std::string vm_output_;
126 std::string vm_func_name_;
127 std::string vm_func_;
128 std::string vm_func_type_;
129 std::string vm_data_from_stack_;
130 std::string vm_error_;
131 };
132
133}
134
135#endif // AWKWARD_UNMASKEDARRAYBUILDER_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::UnmaskedArrayBuilder
Definition: UnmaskedArrayBuilder.h:14
awkward::UnmaskedArrayBuilder::UnmaskedArrayBuilder
UnmaskedArrayBuilder(FormBuilderPtr< T, I > content, const util::Parameters &parameters, const std::string &form_key, const std::string attribute="mask", const std::string partition="0")
Creates an UnmaskedArrayBuilder from a full set of parameters.
awkward::UnmaskedArrayBuilder::vm_output
const std::string vm_output() const override
AwkwardForth virtual machine instructions of the data outputs.
awkward::UnmaskedArrayBuilder::begin_list
void begin_list(LayoutBuilderPtr< T, I > builder) override
Begins building a nested list.
awkward::UnmaskedArrayBuilder::len
ssize_t len(const ForthOutputBufferMap &outputs) const override
The builder's output buffer length.
Definition: UnmaskedArrayBuilder.h:107
awkward::UnmaskedArrayBuilder::float64
void float64(double x, LayoutBuilderPtr< T, I > builder) override
Adds a real value x to the accumulated data.
awkward::UnmaskedArrayBuilder::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::UnmaskedArrayBuilder::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::UnmaskedArrayBuilder::int64
void int64(int64_t x, LayoutBuilderPtr< T, I > builder) override
Adds an integer value x to the accumulated data.
awkward::UnmaskedArrayBuilder::form_parameters
const util::Parameters & form_parameters() const
String-to-JSON map that augments the meaning of this builder Form.
Definition: UnmaskedArrayBuilder.h:104
awkward::UnmaskedArrayBuilder::vm_func_name
const std::string vm_func_name() const override
The array builder VM function name.
awkward::UnmaskedArrayBuilder::vm_output_data
const std::string vm_output_data() const override
AwkwardForth virtual machine data output key.
awkward::UnmaskedArrayBuilder::vm_func
const std::string vm_func() const override
AwkwardForth virtual machine instructions of the array builder function.
awkward::UnmaskedArrayBuilder::content
const FormBuilderPtr< T, I > content() const
Returns this Form content builder.
Definition: UnmaskedArrayBuilder.h:95
awkward::UnmaskedArrayBuilder::vm_func_type
const std::string vm_func_type() const override
The array builder VM function type.
awkward::UnmaskedArrayBuilder::boolean
void boolean(bool x, LayoutBuilderPtr< T, I > builder) override
Adds a boolean value x to the accumulated data.
awkward::UnmaskedArrayBuilder::vm_error
const std::string vm_error() const override
Error messages in the AwkwardForth virtual machine instructions.
awkward::UnmaskedArrayBuilder::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::UnmaskedArrayBuilder::complex
void complex(std::complex< double > x, LayoutBuilderPtr< T, I > builder) override
Adds a complex value x to the accumulated data.
awkward::UnmaskedArrayBuilder::vm_from_stack
const std::string vm_from_stack() const override
AwkwardForth virtual machine instructions to retrieve the data from the VM stack.
awkward::UnmaskedArrayBuilder::end_list
void end_list(LayoutBuilderPtr< T, I > builder) override
Ends a nested list.
awkward::UnmaskedArrayBuilder::classname
const std::string classname() const override
User-friendly name of this class.
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
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