26#ifndef PDI_RECORD_DATATYPE_H_
27#define PDI_RECORD_DATATYPE_H_
32#include <pdi/pdi_fwd.h>
33#include <pdi/datatype.h>
44 struct Shared_enabler;
52 size_t m_displacement;
91 const std::string&
name()
const;
98 bool operator== (
const Member& rhs)
const;
105 bool operator!= (
const Member& rhs)
const;
110 std::vector<Member> m_members;
140 std::pair<void*, Datatype_sptr>
member(
const char* name,
void* data)
const override;
166 static std::shared_ptr<Record_datatype>
make(std::vector<Member>&& members,
size_t size,
const Attributes_map& attributes = {});
A Datatype is a Datatype_template that accepts no argument.
Definition: datatype.h:47
A Member is one of the elements inside a Record_datatype.
Definition: record_datatype.h:50
Member(const Member &o)
Construct a new member by copy.
const std::string & name() const
Access the name of this specific member.
Datatype_sptr type() const
Access the type of the contained member.
size_t displacement() const
Access the offset or distance in byte from the Record_datatype start.
Member(size_t displacement, Datatype_sptr type, const std::string &name)
Construct a new member.
A Record_datatype is a Datatype that represents a fixed number of elements of potentially different t...
Definition: record_datatype.h:42
static std::shared_ptr< Record_datatype > make(std::vector< Member > &&members, size_t size, const Attributes_map &attributes={})
Constructs a new Record_datatype.
std::string debug_string() const override
Returns the datatype yaml representation as a string.
size_t alignment() const override
Returns the required alignment for a type.
void * data_to_dense_copy(void *to, const void *) const override
Creates a dense deep copy of data.
bool simple() const override
Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer.
Datatype_sptr member(const char *name) const override
Access the type of the member with the provided name.
size_t datasize() const override
Computes the data size of a type, excluding potentially unused memory from a sparse type.
Datatype_sptr evaluate(Context &) const override
Creates a new datatype by resolving the value of all metadata references.
Datatype_sptr densify() const override
Creates a new datatype as the dense copy of this one.
bool dense() const override
Indicate if the datatype is dense or not.
std::pair< void *, Datatype_sptr > member(const char *name, void *data) const override
Access the type and value of the member with the provided name.
void destroy_data(void *) const override
Delete data whose type is described by the Datatype.
const std::vector< Member > & members() const
Accesses the members in increasing displacement order.
size_t buffersize() const override
Computes the data size of a type, including potentially unused memory from a sparse type.
void * data_from_dense_copy(void *to, const void *) const override
Creates a sparse deep copy of dense data.
Definition: array_datatype.h:38
std::unordered_map< std::string, Expression > Attributes_map
Definition: datatype_template.h:40
std::shared_ptr< const Datatype > Datatype_sptr
Definition: pdi_fwd.h:79