User interface to the Builder system: the ArrayBuilder is a fixed reference while the Builder subclass instances change in response to accumulating data. More...
#include <ArrayBuilder.h>
Public Member Functions | |
ArrayBuilder (const BuilderOptions &options) | |
Creates an ArrayBuilder from a full set of parameters. | |
const std::string | to_buffers (BuffersContainer &container, int64_t &form_key_id) const |
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON). | |
int64_t | length () const |
Current length of the accumulated array. | |
void | clear () |
Removes all accumulated data without resetting the type knowledge. | |
void | null () |
Adds a null value to the accumulated data. | |
void | boolean (bool x) |
Adds a boolean value x to the accumulated data. | |
void | integer (int64_t x) |
Adds an integer value x to the accumulated data. | |
void | real (double x) |
Adds a real value x to the accumulated data. | |
void | complex (std::complex< double > x) |
Adds a complex value x to the accumulated data. | |
void | datetime (int64_t x, const std::string &unit) |
Adds a datetime value x to the accumulated data. | |
void | timedelta (int64_t x, const std::string &unit) |
Adds a timedelta value x to the accumulated data. | |
void | bytestring (const char *x) |
Adds an unencoded, null-terminated bytestring value x to the accumulated data. | |
void | bytestring (const char *x, int64_t length) |
Adds an unencoded bytestring value x with a given length to the accumulated data. | |
void | bytestring (const std::string &x) |
Adds an unencoded bytestring x in STL format to the accumulated data. | |
void | string (const char *x) |
Adds a UTF-8 encoded, null-terminated bytestring value x to the accumulated data. | |
void | string (const char *x, int64_t length) |
Adds a UTF-8 encoded bytestring value x with a given length to the accumulated data. | |
void | string (const std::string &x) |
Adds a UTF-8 encoded bytestring x in STL format to the accumulated data. | |
void | beginlist () |
Begins building a nested list. | |
void | endlist () |
Ends a nested list. | |
void | begintuple (int64_t numfields) |
Begins building a tuple with a fixed number of fields. | |
void | index (int64_t index) |
Sets the pointer to a given tuple field index; the next command will fill that slot. | |
void | endtuple () |
Ends a tuple. | |
void | beginrecord () |
Begins building a record without a name. | |
void | beginrecord_fast (const char *name) |
Begins building a record with a name. | |
void | beginrecord_check (const char *name) |
Begins building a record with a name. | |
void | beginrecord_check (const std::string &name) |
Begins building a record with a name. | |
void | field_fast (const char *key) |
Sets the pointer to a given record field key ; the next command will fill that slot. | |
void | field_check (const char *key) |
Sets the pointer to a given record field key ; the next command will fill that slot. | |
void | field_check (const std::string &key) |
Sets the pointer to a given record field key ; the next command will fill that slot. | |
void | endrecord () |
Ends a record. | |
const BuilderPtr | builder () const |
void | builder_update (BuilderPtr builder) |
void | maybeupdate (const BuilderPtr builder) |
Internal function to replace the root node of the ArrayBuilder's Builder tree with a new root. | |
User interface to the Builder system: the ArrayBuilder is a fixed reference while the Builder subclass instances change in response to accumulating data.
ArrayBuilder | ( | const BuilderOptions & | options | ) |
Creates an ArrayBuilder from a full set of parameters.
options | Configuration options for building an array; these are passed to every Builder's constructor. |
void beginlist | ( | ) |
Begins building a nested list.
void beginrecord | ( | ) |
Begins building a record without a name.
See beginrecord_fast and beginrecord_check.
void beginrecord_check | ( | const char * | name | ) |
Begins building a record with a name.
name | 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. |
In the _check
version of this method, a string comparison is performed every time it is called to verify that the name
matches a stored name
.
See beginrecord and beginrecord_fast.
void beginrecord_check | ( | const std::string & | name | ) |
Begins building a record with a name.
name | 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. |
In the _check
version of this method, a string comparison is performed every time it is called to verify that the name
matches a stored name
.
See beginrecord and beginrecord_fast.
void beginrecord_fast | ( | const char * | name | ) |
Begins building a record with a name.
name | 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. |
In the _fast
version of this method, a string comparison is not performed: the same pointer is assumed to have the same value each time (safe for string literals).
See beginrecord and beginrecord_check.
void begintuple | ( | int64_t | numfields | ) |
Begins building a tuple with a fixed number of fields.
void boolean | ( | bool | x | ) |
Adds a boolean value x
to the accumulated data.
|
inline |
|
inline |
void bytestring | ( | const char * | x | ) |
Adds an unencoded, null-terminated bytestring value x
to the accumulated data.
void bytestring | ( | const char * | x, |
int64_t | length ) |
Adds an unencoded bytestring value x
with a given length
to the accumulated data.
The string does not need to be null-terminated.
void bytestring | ( | const std::string & | x | ) |
Adds an unencoded bytestring x
in STL format to the accumulated data.
void clear | ( | ) |
Removes all accumulated data without resetting the type knowledge.
void complex | ( | std::complex< double > | x | ) |
Adds a complex value x
to the accumulated data.
void datetime | ( | int64_t | x, |
const std::string & | unit ) |
Adds a datetime value x
to the accumulated data.
void endlist | ( | ) |
Ends a nested list.
void endrecord | ( | ) |
Ends a record.
void endtuple | ( | ) |
Ends a tuple.
void field_check | ( | const char * | key | ) |
Sets the pointer to a given record field key
; the next command will fill that slot.
In the _check
version of this method, a string comparison is performed every time it is called to verify that the key
matches a stored key
. See field_fast.
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.
void field_check | ( | const std::string & | key | ) |
Sets the pointer to a given record field key
; the next command will fill that slot.
In the _check
version of this method, a string comparison is performed every time it is called to verify that the key
matches a stored key
. See field_fast.
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.
void field_fast | ( | const char * | key | ) |
Sets the pointer to a given record field key
; the next command will fill that slot.
In the _fast
version of this method, a string comparison is not performed: the same pointer is assumed to have the same value each time (safe for string literals). See field_check.
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.
void index | ( | int64_t | index | ) |
Sets the pointer to a given tuple field index; the next command will fill that slot.
void integer | ( | int64_t | x | ) |
Adds an integer value x
to the accumulated data.
int64_t length | ( | ) | const |
Current length of the accumulated array.
void maybeupdate | ( | const BuilderPtr | builder | ) |
Internal function to replace the root node of the ArrayBuilder's Builder tree with a new root.
void null | ( | ) |
Adds a null
value to the accumulated data.
void real | ( | double | x | ) |
Adds a real value x
to the accumulated data.
void string | ( | const char * | x | ) |
Adds a UTF-8 encoded, null-terminated bytestring value x
to the accumulated data.
void string | ( | const char * | x, |
int64_t | length ) |
Adds a UTF-8 encoded bytestring value x
with a given length
to the accumulated data.
The string does not need to be null-terminated.
void string | ( | const std::string & | x | ) |
Adds a UTF-8 encoded bytestring x
in STL format to the accumulated data.
void timedelta | ( | int64_t | x, |
const std::string & | unit ) |
Adds a timedelta value x
to the accumulated data.
const std::string to_buffers | ( | BuffersContainer & | container, |
int64_t & | form_key_id ) const |
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON).