26#ifndef PDI_TUPLE_DATATYPE_H_
27#define PDI_TUPLE_DATATYPE_H_
32#include <pdi/pdi_fwd.h>
33#include <pdi/datatype.h>
44 struct Shared_enabler;
88 bool operator== (
const Element& rhs)
const;
95 bool operator!= (
const Element& rhs)
const;
100 std::vector<Element> m_elements;
135 std::pair<void*, Datatype_sptr>
index(
size_t,
void*)
const override;
139 std::pair<void*, Datatype_sptr>
slice(
size_t,
size_t,
void*)
const override;
165 static std::shared_ptr<Tuple_datatype>
make(std::vector<Element> elements,
size_t buffersize,
const Attributes_map& attributes = {});
A Datatype is a Datatype_template that accepts no argument.
Definition: datatype.h:47
A Element is one of the elements inside a Tuple_datatype.
Definition: tuple_datatype.h:50
Datatype_sptr type() const
Access the type of the contained element.
size_t offset() const
Access the offset in byte from the Tuple_datatype start.
Element(size_t offset, Datatype_sptr type)
Construct a new element.
Element(const Element &o)
Construct a new element by copy.
A Tuple_datatype is a Datatype that represents a fixed number of elements of potentially different ty...
Definition: tuple_datatype.h:42
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 simple() const override
Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer.
Datatype_sptr index(size_t) const override
Access the type of the element at the provided index.
bool dense() const override
Indicate if the datatype is dense or not.
void * data_from_dense_copy(void *, const void *) const override
Creates a sparse deep copy of dense data.
void * data_to_dense_copy(void *, const void *) const override
Creates a dense deep copy of data.
std::pair< void *, Datatype_sptr > index(size_t, void *) const override
Access the type and value of the element at the provided index.
static std::shared_ptr< Tuple_datatype > make(std::vector< Element > elements, size_t buffersize, const Attributes_map &attributes={})
Constructs a new Tuple_datatype.
size_t alignment() const override
Returns the required alignment for a type.
size_t datasize() const override
Computes the data size of a type, excluding potentially unused memory from a sparse type.
std::string debug_string() const override
Returns the datatype yaml representation as a string.
size_t size() const
Number of elements of the tuple.
Datatype_sptr slice(size_t, size_t) const override
Access the type of the elements slice between the provided indices.
size_t buffersize() const override
Computes the data size of a type, including potentially unused memory from a sparse type.
std::pair< void *, Datatype_sptr > slice(size_t, size_t, void *) const override
Access the type and value of the elements slice between the provided indices.
void destroy_data(void *) const override
Delete data whose type is described by the Datatype.
const std::vector< Element > & elements() const
Accesses the elements in increasing offset order.
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:78