Builds a UnionArray which represents data drawn from an ordered list of contents, which can have different types, using tags, which is an array of integers indicating which content each array element draws from and index, which is an array of integers indicating which element from the content to draw from.
More...
#include <LayoutBuilder.h>
|
| Union () |
| Creates a new Union layout builder by allocating new tags and index buffers, using AWKWARD_LAYOUTBUILDER_DEFAULT_OPTIONS for initializing the buffer.
|
|
| Union (const awkward::BuilderOptions &options) |
| Creates a new Union layout builder by allocating new tags and index buffers, taking options from BuilderOptions for initializing the buffer.
|
|
template<std::size_t I> |
ContentType< I > & | content () noexcept |
|
template<std::size_t TAG> |
ContentType< TAG > & | append_content () noexcept |
| Inserts the current tag in the tags buffer and the next index in the index buffer and returns the reference to the content of the current builder.
|
|
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 tags and index, and clears the builder contents.
|
|
size_t | length () const noexcept |
| Current length of the tags 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_buffer (void *buffer, const char *name) const noexcept |
| Copies and concatenates the accumulated data in the builder buffers to user-defined pointers if the given node name matches with any one of the nodes associated with the builder; otherwise, it searches the builder contents to locate a matching node.
|
|
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.
|
|
template<typename TAGS, typename INDEX, typename... BUILDERS>
class awkward::LayoutBuilder::Union< TAGS, INDEX, BUILDERS >
Builds a UnionArray which represents data drawn from an ordered list of contents, which can have different types, using tags, which is an array of integers indicating which content each array element draws from and index, which is an array of integers indicating which element from the content to draw from.
The index values can be 64-bit signed integers int64
, 32-bit signed integers int32
or 32-bit unsigned integers uint32
and the tags values can be 8-bit signed integers.
- Template Parameters
-
TAGS | The type of tags buffer. |
INDEX | The type of index buffer. |
BUILDERS | The types of builder contents. |
◆ Contents
template<typename TAGS , typename INDEX , typename... BUILDERS>
using Contents = typename std::tuple<BUILDERS...> |
◆ ContentType
template<typename TAGS , typename INDEX , typename... BUILDERS>
template<std::size_t I>
◆ Union() [1/2]
template<typename TAGS , typename INDEX , typename... BUILDERS>
Creates a new Union layout builder by allocating new tags and index buffers, using AWKWARD_LAYOUTBUILDER_DEFAULT_OPTIONS
for initializing the buffer.
◆ Union() [2/2]
template<typename TAGS , typename INDEX , typename... BUILDERS>
Creates a new Union layout builder by allocating new tags and index buffers, taking options
from BuilderOptions
for initializing the buffer.
- Parameters
-
options | Initial size configuration of a buffer. |
◆ append_content()
template<typename TAGS , typename INDEX , typename... BUILDERS>
template<std::size_t TAG>
Inserts the current tag in the tags
buffer and the next index in the index
buffer and returns the reference to the content of the current builder.
◆ buffer_nbytes()
template<typename TAGS , typename INDEX , typename... BUILDERS>
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()
template<typename TAGS , typename INDEX , typename... BUILDERS>
Discards the accumulated tags and index, and clears the builder contents.
Also, resets the last valid index array to -1
.
◆ content()
template<typename TAGS , typename INDEX , typename... BUILDERS>
template<std::size_t I>
◆ form()
template<typename TAGS , typename INDEX , typename... BUILDERS>
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()
template<typename TAGS , typename INDEX , typename... BUILDERS>
bool is_valid |
( |
std::string & | error | ) |
const |
|
inlinenoexcept |
Checks for validity and consistency.
◆ length()
template<typename TAGS , typename INDEX , typename... BUILDERS>
Current length of the tags
buffer.
◆ parameters()
template<typename TAGS , typename INDEX , typename... BUILDERS>
const std::string & parameters |
( |
| ) |
const |
|
inlinenoexcept |
Parameters for the builder form.
◆ set_id()
template<typename TAGS , typename INDEX , typename... BUILDERS>
void set_id |
( |
size_t & | id | ) |
|
|
inlinenoexcept |
Assigns a unique ID to each node.
◆ set_parameters()
template<typename TAGS , typename INDEX , typename... BUILDERS>
void set_parameters |
( |
std::string | parameter | ) |
|
|
inlinenoexcept |
Sets the form parameters.
◆ to_buffer()
template<typename TAGS , typename INDEX , typename... BUILDERS>
void to_buffer |
( |
void * | buffer, |
|
|
const char * | name ) const |
|
inlinenoexcept |
Copies and concatenates the accumulated data in the builder buffers to user-defined pointers if the given node name matches with any one of the nodes associated with the builder; otherwise, it searches the builder contents to locate a matching node.
◆ to_buffers()
template<typename TAGS , typename INDEX , typename... BUILDERS>
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()
template<typename TAGS , typename INDEX , typename... BUILDERS>
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:
- /home/runner/work/awkward/awkward/awkward-cpp/header-only/layout-builder/awkward/LayoutBuilder.h