Awkward Array: Numpy< PRIMITIVE > Class Template Reference

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Numpy< PRIMITIVE > Class Template Reference

Builds a NumpyArray which describes multi-dimensional data of `PRIMITIVE` type. More...

`#include <LayoutBuilder.h>`

## Public Member Functions
| Numpy ()
| Creates a new Numpy layout builder by allocating a new buffer, using `default_options` for initializing the buffer. More...
| Numpy (const awkward::BuilderOptions &options)
| Creates a new Numpy layout builder by allocating a new buffer, taking `options` from `BuilderOptions` for initializing the buffer. More...
void | append (PRIMITIVE x) noexcept
| Inserts a `PRIMITIVE` type data. More...
void | extend (PRIMITIVE *ptr, size_t size) noexcept
| Inserts an entire array of `PRIMITIVE` type data. 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 data in the builder. More...
size_t | length () const noexcept
| Current length of the data. 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 name and size (in bytes) of the buffer. More...
void | to_buffers (std::map< std::string, void * > &buffers) const noexcept
| Copies and concatenates all the accumulated data in the builder to a user-defined pointer. 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
| Generates a unique description of the builder and its contents in the form of a JSON-like string. More...

## Detailed Description

template<typename PRIMITIVE>
class awkward::LayoutBuilder::Numpy< PRIMITIVE >

Builds a NumpyArray which describes multi-dimensional data of `PRIMITIVE` type.

Template Parameters

  PRIMITIVE | The type of data in NumpyArray.

## Constructor & Destructor Documentation

## ◆ Numpy() [1/2]

Numpy | ( |  | ) |
| inline

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

## ◆ Numpy() [2/2]

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

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

Parameters

  options | Initial size configuration of a buffer.

## Member Function Documentation

## ◆ append()

void append | ( | PRIMITIVE | x | ) |
| inlinenoexcept

Inserts a `PRIMITIVE` type data.

## ◆ buffer_nbytes()

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

Retrieves the name and size (in bytes) of the buffer.

## ◆ clear()

void clear | ( |  | ) |
| inlinenoexcept

Discards the accumulated data in the builder.

## ◆ extend()

void extend | ( | PRIMITIVE * | ptr,
|  | size_t | size
| ) |  |
| inlinenoexcept

Inserts an entire array of `PRIMITIVE` type data.

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

## ◆ form()

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

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 data.

## ◆ 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 the builder to a user-defined pointer.

Used to fill the buffers map by allocating it with user-defined pointers using the same name and size (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

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

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