Loading...
Searching...
No Matches
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 AWKWARD_LAYOUTBUILDER_DEFAULT_OPTIONS for initializing the buffer.
 
 Numpy (const awkward::BuilderOptions &options)
 Creates a new Numpy layout builder by allocating a new buffer, taking options from BuilderOptions for initializing the buffer.
 
void append (PRIMITIVE x) noexcept
 Inserts a PRIMITIVE type data.
 
void extend (PRIMITIVE *ptr, size_t size) noexcept
 Inserts an entire array of PRIMITIVE type data.
 
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 data in the builder.
 
size_t length () const noexcept
 Current length of the data.
 
bool is_valid (std::string &) const noexcept
 Checks for validity and consistency.
 
void buffer_nbytes (std::map< std::string, size_t > &names_nbytes) const noexcept
 Retrieves the name and size (in bytes) of the buffer.
 
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.
 
void to_buffer (void *buffer, const char *name) const noexcept
 Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the given node name matches with the node associated with the builder.
 
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
 Generates a unique description of the builder and its contents in the form of a JSON-like string.
 

Detailed Description

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

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

Template Parameters
PRIMITIVEThe type of data in NumpyArray.

Constructor & Destructor Documentation

◆ Numpy() [1/2]

template<typename PRIMITIVE >
Numpy ( )
inline

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

◆ Numpy() [2/2]

template<typename PRIMITIVE >
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
optionsInitial size configuration of a buffer.

Member Function Documentation

◆ append()

template<typename PRIMITIVE >
void append ( PRIMITIVE x)
inlinenoexcept

Inserts a PRIMITIVE type data.

◆ buffer_nbytes()

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

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

◆ clear()

template<typename PRIMITIVE >
void clear ( )
inlinenoexcept

Discards the accumulated data in the builder.

◆ extend()

template<typename PRIMITIVE >
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()

template<typename PRIMITIVE >
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()

template<typename PRIMITIVE >
bool is_valid ( std::string & ) const
inlinenoexcept

Checks for validity and consistency.

◆ length()

template<typename PRIMITIVE >
size_t length ( ) const
inlinenoexcept

Current length of the data.

◆ parameters()

template<typename PRIMITIVE >
const std::string & parameters ( ) const
inlinenoexcept

Parameters for the builder form.

◆ set_id()

template<typename PRIMITIVE >
void set_id ( size_t & id)
inlinenoexcept

Assigns a unique ID to each node.

◆ set_parameters()

template<typename PRIMITIVE >
void set_parameters ( std::string parameter)
inlinenoexcept

Sets the form parameters.

◆ to_buffer()

template<typename PRIMITIVE >
void to_buffer ( void * buffer,
const char * name ) const
inlinenoexcept

Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the given node name matches with the node associated with the builder.

◆ to_buffers()

template<typename PRIMITIVE >
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()

template<typename PRIMITIVE >
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: