Awkward Array: ByteMasked< VALID_WHEN, BUILDER > Class Template Reference

Loading...
Searching...
No Matches
Public Member Functions | List of all members
ByteMasked< VALID_WHEN, BUILDER > Class Template Reference

Builds a ByteMaskedArray using a mask which is an array of booleans that determines whether the corresponding value in the contents array is valid or not. More...

`#include <LayoutBuilder.h>`

## Public Member Functions
| ByteMasked ()
| Creates a new ByteMasked layout builder by allocating a new `mask` buffer, using `default_options` for initializing the buffer.
| ByteMasked (const awkward::BuilderOptions &options)
| Creates a new ByteMasked layout builder by allocating a new `mask` buffer, taking `options` from `BuilderOptions` for initializing the buffer.
BUILDER & | content () noexcept
| Returns the reference to the builder content.
bool | valid_when () const noexcept
| Determines when the builder content are valid.
BUILDER & | append_valid () noexcept
| Inserts valid_when in the mask.
BUILDER & | extend_valid (size_t size) noexcept
| Inserts `size` number of valid_when in the mask.
BUILDER & | append_null () noexcept
| Inserts !valid_when in the mask.
BUILDER & | extend_null (size_t size) noexcept
| Inserts `size` number of !valid_when in the mask.
const std::string & | parameters () const noexcept
| Parameters for the builder form.
void | set_parameters (std::string parameter) noexcept
| Sets the form parameters.
void | set_id (size_t &id) noexcept
| Assigns a unique ID to each node.
void | clear () noexcept
| Discards the accumulated mask and clears the content of the builder.
size_t | length () const noexcept
| Current length of the `mask` buffer.
bool | is_valid (std::string &error) const noexcept
| Checks for validity and consistency.
void | buffer_nbytes (std::map< std::string, size_t > &names_nbytes) const noexcept
| Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
void | to_buffers (std::map< std::string, void * > &buffers) const noexcept
| Copies and concatenates all the accumulated data in each of the buffers of the builder and its contents to user-defined pointers.
void | to_char_buffers (std::map< std::string, uint8_t * > &buffers) const noexcept
| Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
std::string | form () const noexcept
| Generates a unique description of the builder and its contents in the form of a JSON-like string.

## Detailed Description

template<bool VALID_WHEN, typename BUILDER>
class awkward::LayoutBuilder::ByteMasked< VALID_WHEN, BUILDER >

Builds a ByteMaskedArray using a mask which is an array of booleans that determines whether the corresponding value in the contents array is valid or not.

If an element of the mask is equal to valid_when, the corresponding element of the builder content is valid and unmasked, else it is invalid (missing) and masked.

This is similar to NumPy's masked arrays if valid_when = `false`.

Template Parameters

  VALID_WHEN | A boolean value which determines when the builder content are valid.
  BUILDER | The type of builder content.

## Constructor & Destructor Documentation

## ◆ ByteMasked() [1/2]

ByteMasked | ( |  | ) |
| inline

Creates a new ByteMasked layout builder by allocating a new `mask` buffer, using `default_options` for initializing the buffer.

## ◆ ByteMasked() [2/2]

ByteMasked | ( | const awkward::BuilderOptions & | options | ) |
| inline

Creates a new ByteMasked layout builder by allocating a new `mask` buffer, taking `options` from `BuilderOptions` for initializing the buffer.

Parameters

  options | Initial size configuration of a buffer.

## Member Function Documentation

## ◆ append_null()

BUILDER & append_null | ( |  | ) |
| inlinenoexcept

Inserts !valid_when in the mask.

After this, a dummy (invalid) value is inserted in the builder content.

## ◆ append_valid()

BUILDER & append_valid | ( |  | ) |
| inlinenoexcept

Inserts valid_when in the mask.

After this, a valid element is inserted in the builder content.

## ◆ buffer_nbytes()

void buffer_nbytes | ( | std::map< std::string, size_t > & | names_nbytes | ) | const
| inlinenoexcept

Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.

## ◆ clear()

void clear | ( |  | ) |
| inlinenoexcept

Discards the accumulated mask and clears the content of the builder.

## ◆ content()

BUILDER & content | ( |  | ) |
| inlinenoexcept

Returns the reference to the builder content.

## ◆ extend_null()

BUILDER & extend_null | ( | size_t | size | ) |
| inlinenoexcept

Inserts `size` number of !valid_when in the mask.

After this, `size` number of dummy (invalid) values are inserted in the builder content.

Just an interface; not actually faster than calling append many times.

## ◆ extend_valid()

BUILDER & extend_valid | ( | size_t | size | ) |
| inlinenoexcept

Inserts `size` number of valid_when in the mask.

After this, `size` number of valid elements are inserted in the builder content.

Just an interface; not actually faster than calling append many times.

## ◆ form()

std::string form | ( |  | ) | const
| inlinenoexcept

Generates a unique description of the builder and its contents in the form of a JSON-like string.

## ◆ is_valid()

bool is_valid | ( | std::string & | error | ) | const
| inlinenoexcept

Checks for validity and consistency.

## ◆ length()

size_t length | ( |  | ) | const
| inlinenoexcept

Current length of the `mask` buffer.

## ◆ parameters()

const std::string & parameters | ( |  | ) | const
| inlinenoexcept

Parameters for the builder form.

## ◆ set_id()

void set_id | ( | size_t & | id | ) |
| inlinenoexcept

Assigns a unique ID to each node.

## ◆ set_parameters()

void set_parameters | ( | std::string | parameter | ) |
| inlinenoexcept

Sets the form parameters.

## ◆ to_buffers()

void to_buffers | ( | std::map< std::string, void * > & | buffers | ) | const
| inlinenoexcept

Copies and concatenates all the accumulated data in each of the buffers of the builder and its contents to user-defined pointers.

Used to fill the buffers map by allocating it with user-defined pointers using the same names and sizes (in bytes) obtained from buffer_nbytes.

## ◆ to_char_buffers()

void to_char_buffers | ( | std::map< std::string, uint8_t * > & | buffers | ) | const
| inlinenoexcept

Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.

The map keys and the buffer sizes are obtained from buffer_nbytes

## ◆ valid_when()

bool valid_when | ( |  | ) | const
| inlinenoexcept

Determines when the builder content are valid.

The documentation for this class was generated from the following file:

- src/awkward/_v2/cpp-headers/awkward/LayoutBuilder.h