26#ifndef PDI_POINTER_DATATYPE_H_
27#define PDI_POINTER_DATATYPE_H_
32#include <pdi/pdi_fwd.h>
33#include <pdi/datatype.h>
42 struct Shared_enabler;
48 std::function<
void* (
void*,
const void*)> m_copy;
51 std::function<void(
void*)> m_destroy;
80 std::pair<void*, Datatype_sptr>
index (
size_t index,
void* data )
const override;
84 std::pair<void*, Datatype_sptr>
slice (
size_t start_index,
size_t end_index,
void* data )
const override;
88 std::pair<void*, Datatype_sptr>
member (
const char* name,
void* data )
const override;
92 std::pair<void*, Datatype_sptr>
dereference (
void* data )
const override;
98 bool operator== (
const Datatype&)
const override;
132 static std::shared_ptr<Pointer_datatype>
make(
Datatype_sptr subtype, std::function<
void* (
void*,
const void*)> copy, std::function<
void(
void*)> destroy,
const Attributes_map& attributes = {});
A Datatype is a Datatype_template that accepts no argument.
Definition: datatype.h:49
Definition: pointer_datatype.h:40
Datatype_sptr subtype() const
Type of the pointed element.
static std::shared_ptr< Pointer_datatype > make(Datatype_sptr subtype, const Attributes_map &attributes={})
Creates new pointer datatype.
void destroy_data(void *ptr) const override
Delete data whose type is described by the Datatype.
Datatype_sptr densify() const override
Creates a new datatype as the dense copy of this one.
Datatype_sptr evaluate(Context &) const override
Creates a new datatype by resolving the value of all metadata references.
void * data_from_dense_copy(void *to, const void *from) const override
Creates a sparse deep copy of dense data.
size_t alignment() const override
Returns the required alignment for a type.
std::string debug_string() const override
Returns the datatype yaml representation as a string.
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.
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 start_index, size_t end_index, void *data) const override
Access the type and value of the elements slice between the provided indices.
bool dense() const override
Indicate if the datatype is dense or not.
void * data_to_dense_copy(void *to, const void *from) const override
Creates a dense deep copy of data.
Datatype_sptr slice(size_t start_index, size_t end_index) const override
Access the type of the elements slice between the provided indices.
bool simple() const override
Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer.
std::pair< void *, Datatype_sptr > index(size_t index, void *data) const override
Access the type and value of the element at the provided index.
static std::shared_ptr< Pointer_datatype > make(Datatype_sptr subtype, std::function< void *(void *, const void *)> copy, std::function< void(void *)> destroy, const Attributes_map &attributes={})
Creates new pointer datatype.
Datatype_sptr index(size_t index) const override
Access the type of the element at the provided index.
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.
std::pair< void *, Datatype_sptr > dereference(void *data) const override
Access the type and value referenced by this.
Datatype_sptr dereference() const override
Access the type referenced by this.
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