Awkward Array: BitMasked< VALID_WHEN, LSB_ORDER, BUILDER > Class Template Reference

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

Builds a BitMaskedArray in which mask values are packed into a bitmap. More...

`#include <LayoutBuilder.h>`

## Public Member Functions
| BitMasked ()
| Creates a new BitMasked layout builder by allocating a new `mask` buffer, using `default_options` for initializing the buffer. More...
| BitMasked (const awkward::BuilderOptions &options)
| Creates a new BitMasked layout builder by allocating a new `mask` buffer, taking `options` from `BuilderOptions` for initializing the buffer. More...
BUILDER & | content () noexcept
| Returns the reference to the builder content. More...
bool | valid_when () const noexcept
| Determines when the builder content are valid. More...
bool | lsb_order () const noexcept
| Determines whether the position of each bit is in Least-Significant Bit order (LSB) or not. More...
BUILDER & | append_valid () noexcept
| Sets a bit in the mask. If current_byte_ and cast_: `0` indicates `null`, `1` indicates `valid` and vice versa. More...
BUILDER & | extend_valid (size_t size) noexcept
| Sets `size` number of bits in the mask. If current_byte_ and cast_: `0` indicates `null`, `1` indicates `valid` and vice versa. More...
BUILDER & | append_null () noexcept
| Sets current_byte_ and cast_ default to null, no change in current_byte_. More...
BUILDER & | extend_null (size_t size) noexcept
| Sets current_byte_ and cast_ default to null, no change in current_byte_. More...
const std::string & | parameters () const noexcept
| Parameters for the builder form. More...
void | set_parameters (std::string parameter) noexcept
| Sets the form parameters. More...
void | set_id (size_t &id) noexcept
| Assigns a unique ID to each node. More...
void | clear () noexcept
| Discards the accumulated mask and clears the content of the builder. More...
size_t | length () const noexcept
| Current length of the `mask` buffer. More...
bool | is_valid (std::string &error) const noexcept
| Checks for validity and consistency. More...
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. More...
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. More...
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. More...
std::string | form () const noexcept
| Generates a unique description of the builder and its contents in the form of a JSON-like string. More...

## Detailed Description

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

Builds a BitMaskedArray in which mask values are packed into a bitmap.

It has an additional parameter, lsb_order; If `true`, the position of each bit is in `Least-Significant Bit order (LSB)` and if it is `false`, then in `Most-Significant Bit order (MSB)`.

This is similar to NumPy's unpackbits with `bitorder="little"` for LSB, `bitorder="big"` for MSB.

Template Parameters

  VALID_WHEN | A boolean value which determines when the builder content are valid.
  LSB_ORDER | A boolean value which determines whether the position of each bit is in LSB order or not.
  BUILDER | The type of builder content.

## Constructor & Destructor Documentation

## ◆ BitMasked() [1/2]

BitMasked | ( |  | ) |
| inline

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

## ◆ BitMasked() [2/2]

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

Creates a new BitMasked 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

Sets current_byte_ and cast_ default to null, no change in current_byte_.

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

## ◆ append_valid()

BUILDER & append_valid | ( |  | ) |
| inlinenoexcept

Sets a bit in the mask. If current_byte_ and cast_: `0` indicates `null`, `1` indicates `valid` and vice versa.

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

Sets current_byte_ and cast_ default to null, no change in current_byte_.

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

Sets `size` number of bits in the mask. If current_byte_ and cast_: `0` indicates `null`, `1` indicates `valid` and vice versa.

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.

## ◆ lsb_order()

bool lsb_order | ( |  | ) | const
| inlinenoexcept

Determines whether the position of each bit is in Least-Significant Bit order (LSB) or not.

## ◆ 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