Builder node that accumulates data with missing values (None
).
More...
#include <OptionBuilder.h>
Public Member Functions | |
OptionBuilder (const BuilderOptions &options, GrowableBuffer< int64_t > index, const BuilderPtr content) | |
Create a OptionBuilder from a full set of parameters. | |
const std::string | classname () const override |
User-friendly name of this class: "OptionBuilder" . | |
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). | |
int64_t | length () const override |
Current length of the accumulated array. | |
void | clear () override |
Removes all accumulated data without resetting the type knowledge. | |
bool | active () const override |
If true , this node has started but has not finished a multi-step command (e.g. beginX ... endX ). | |
const BuilderPtr | null () override |
Adds a null value to the accumulated data. | |
const BuilderPtr | boolean (bool x) override |
Adds a boolean value x to the accumulated data. | |
const BuilderPtr | integer (int64_t x) override |
Adds an integer value x to the accumulated data. | |
const BuilderPtr | real (double x) override |
Adds a real value x to the accumulated data. | |
const BuilderPtr | complex (std::complex< double > x) override |
Adds a complex value x to the accumulated data. | |
const BuilderPtr | datetime (int64_t x, const std::string &unit) override |
Adds a datetime value x to the accumulated data. | |
const BuilderPtr | timedelta (int64_t x, const std::string &unit) override |
Adds a timedelta value x to the accumulated data. | |
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. | |
const BuilderPtr | beginlist () override |
Begins building a nested list. | |
const BuilderPtr | endlist () override |
Ends a nested list. | |
const BuilderPtr | begintuple (int64_t numfields) override |
Begins building a tuple with a fixed number of fields. | |
const BuilderPtr | index (int64_t index) override |
Sets the pointer to a given tuple field index; the next command will fill that slot. | |
const BuilderPtr | endtuple () override |
Ends a tuple. | |
const BuilderPtr | beginrecord (const char *name, bool check) override |
Begins building a record with an optional name. | |
void | field (const char *key, bool check) override |
Sets the pointer to a given record field key ; the next command will fill that slot. | |
const BuilderPtr | endrecord () override |
Ends a record. | |
const GrowableBuffer< int64_t > & | buffer () const |
const GrowableBuffer< int64_t > & | index () |
const BuilderPtr | builder () const |
void | maybeupdate (const BuilderPtr builder) |
Public Member Functions inherited from Builder | |
virtual | ~Builder () |
Virtual destructor acts as a first non-inline virtual function that determines a specific translation unit in which vtable shall be emitted. | |
Static Public Member Functions | |
static const BuilderPtr | fromnulls (const BuilderOptions &options, int64_t nullcount, const BuilderPtr &content) |
Create an OptionBuilder from a number of nulls (all missing). | |
static const BuilderPtr | fromvalids (const BuilderOptions &options, const BuilderPtr &content) |
Create an OptionBuilder from an existing builder (all non-missing). | |
Builder node that accumulates data with missing values (None
).
OptionBuilder | ( | const BuilderOptions & | options, |
GrowableBuffer< int64_t > | index, | ||
const BuilderPtr | content ) |
Create a OptionBuilder from a full set of parameters.
options | Configuration options for building an array; these are passed to every Builder's constructor. |
index | Contains the accumulated index (like IndexedOptionArray::index ). |
content | Builder for the non-missing data. |
|
overridevirtual |
If true
, this node has started but has not finished a multi-step command (e.g. beginX ... endX
).
An OptionBuilder is active if and only if its content
is active.
Implements Builder.
|
overridevirtual |
Begins building a nested list.
Implements Builder.
|
overridevirtual |
Begins building a record with an optional name.
name | If specified, this name is used to distinguish records of different types in heterogeneous data (to build a union of record arrays, rather than a record array with union fields and optional values) and it also sets the "__record__" parameter to later add custom behaviors in Python. |
check | If true , actually do a string comparison to see if the provided name matches the previous name ; if false , assume that the same pointer means the same string (safe for string literals). |
Implements Builder.
|
overridevirtual |
Begins building a tuple with a fixed number of fields.
Implements Builder.
|
overridevirtual |
Adds a boolean value x
to the accumulated data.
Implements Builder.
|
inline |
|
inline |
|
overridevirtual |
User-friendly name of this class: "OptionBuilder"
.
Implements Builder.
|
overridevirtual |
Removes all accumulated data without resetting the type knowledge.
Implements Builder.
|
overridevirtual |
Adds a complex value x
to the accumulated data.
Implements Builder.
|
overridevirtual |
Adds a datetime value x
to the accumulated data.
Implements Builder.
|
overridevirtual |
Ends a nested list.
Implements Builder.
|
overridevirtual |
Ends a record.
Implements Builder.
|
overridevirtual |
Ends a tuple.
Implements Builder.
|
overridevirtual |
Sets the pointer to a given record field key
; the next command will fill that slot.
key | Indicates the field to fill. |
check | If true , actually do a string comparison to see if key matches the previous key ; if false , assume that the same pointer means the same string (safe for string literals). |
Record keys are checked in round-robin order. The best performance will be achieved by filling them in the same order for each record. Lookup time for random order scales with the number of fields.
Implements Builder.
|
static |
Create an OptionBuilder from a number of nulls (all missing).
|
static |
Create an OptionBuilder from an existing builder (all non-missing).
|
inline |
|
overridevirtual |
Sets the pointer to a given tuple field index; the next command will fill that slot.
Implements Builder.
|
overridevirtual |
Adds an integer value x
to the accumulated data.
Implements Builder.
|
overridevirtual |
Current length of the accumulated array.
Implements Builder.
void maybeupdate | ( | const BuilderPtr | builder | ) |
|
overridevirtual |
Adds a null
value to the accumulated data.
Implements Builder.
|
overridevirtual |
Adds a real value x
to the accumulated data.
Implements Builder.
|
overridevirtual |
Adds a string value x
with a given length
and encoding
to the accumulated data.
encoding =
nullptr
(no encoding; a bytestring)"utf-8"
(variable-length Unicode 8-bit encoding)are supported.
Implements Builder.
|
overridevirtual |
Adds a timedelta value x
to the accumulated data.
Implements Builder.
|
overridevirtual |
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON).
Implements Builder.