Loading...
Searching...
No Matches
Record< MAP, BUILDERS > Class Template Reference

Builds a RecordArray which represents an array of records, which can be of same or different types. Its contents is an ordered list of arrays with the same length as the length of its shortest content; all are aligned element-by-element, associating a field name to every content. More...

#include <LayoutBuilder.h>

Public Types

using RecordContents = typename std::tuple<BUILDERS...>
 
using UserDefinedMap = MAP
 
template<std::size_t INDEX>
using RecordFieldType = std::tuple_element_t<INDEX, RecordContents>
 

Public Member Functions

 Record ()
 Creates a new Record layout builder.
 
 Record (UserDefinedMap user_defined_field_id_to_name_map)
 Creates a new Record layout builder, taking a user-defined map with enumerated type field ID as keys and field names as value which sets the field names.
 
const std::vector< std::string > fields () const noexcept
 Returns a vector of strings sontaining all the field names.
 
void set_fields (MAP user_defined_field_id_to_name_map) noexcept
 Sets the field names.
 
template<std::size_t INDEX>
RecordFieldType< INDEX >::Builder & content () noexcept
 Returns the reference to the builder contents at INDEX.
 
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
 Clears the builder contents.
 
size_t length () const noexcept
 Current number of records in first field.
 
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 buffers of the builder contents to user-defined pointers if the given node name matches with the node associated with that 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 noexcept
 Generates a unique description of the builder and its contents in the form of a JSON-like string.
 

Public Attributes

RecordContents contents
 The contents of the RecordArray.
 

Detailed Description

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
class awkward::LayoutBuilder::Record< MAP, BUILDERS >

Builds a RecordArray which represents an array of records, which can be of same or different types. Its contents is an ordered list of arrays with the same length as the length of its shortest content; all are aligned element-by-element, associating a field name to every content.

Template Parameters
MAPMap of index keys and field name.
BUILDERSThe types of builder contents.

Member Typedef Documentation

◆ RecordContents

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
using RecordContents = typename std::tuple<BUILDERS...>

◆ RecordFieldType

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
template<std::size_t INDEX>
using RecordFieldType = std::tuple_element_t<INDEX, RecordContents>

◆ UserDefinedMap

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
using UserDefinedMap = MAP

Constructor & Destructor Documentation

◆ Record() [1/2]

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
Record ( )
inline

Creates a new Record layout builder.

◆ Record() [2/2]

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
Record ( UserDefinedMap user_defined_field_id_to_name_map)
inline

Creates a new Record layout builder, taking a user-defined map with enumerated type field ID as keys and field names as value which sets the field names.

Parameters
user_defined_field_id_to_name_mapA user-defined field ID field name map.

Member Function Documentation

◆ buffer_nbytes()

template<class MAP = std::map<std::size_t, std::string>, 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<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
void clear ( )
inlinenoexcept

Clears the builder contents.

Discards the accumulated data and the contents in each field of the record.

◆ content()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
template<std::size_t INDEX>
RecordFieldType< INDEX >::Builder & content ( )
inlinenoexcept

Returns the reference to the builder contents at INDEX.

◆ fields()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
const std::vector< std::string > fields ( ) const
inlinenoexcept

Returns a vector of strings sontaining all the field names.

◆ form()

template<class MAP = std::map<std::size_t, std::string>, 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<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
bool is_valid ( std::string & error) const
inlinenoexcept

Checks for validity and consistency.

◆ length()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
size_t length ( ) const
inlinenoexcept

Current number of records in first field.

◆ parameters()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
const std::string & parameters ( ) const
inlinenoexcept

Parameters for the builder form.

◆ set_fields()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
void set_fields ( MAP user_defined_field_id_to_name_map)
inlinenoexcept

Sets the field names.

Alternative method to set the field names besides passing the user-defined map as constructor parameter.

◆ set_id()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
void set_id ( size_t & id)
inlinenoexcept

Assigns a unique ID to each node.

◆ set_parameters()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
void set_parameters ( std::string parameter)
inlinenoexcept

Sets the form parameters.

◆ to_buffer()

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
void to_buffer ( void * buffer,
const char * name ) const
inlinenoexcept

Copies and concatenates the accumulated data in the buffers of the builder contents to user-defined pointers if the given node name matches with the node associated with that builder.

◆ to_buffers()

template<class MAP = std::map<std::size_t, std::string>, 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<class MAP = std::map<std::size_t, std::string>, 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

Member Data Documentation

◆ contents

template<class MAP = std::map<std::size_t, std::string>, typename... BUILDERS>
RecordContents contents

The contents of the RecordArray.


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