A Datatype is a Datatype_template that accepts no argument. More...
Classes | |
struct | Accessor_base |
Base class for datatype accesssors, that allow to get pointer to subtype. More... | |
Public Member Functions | |
Datatype (const Attributes_map &attributes={}) | |
Creates a new datatype. More... | |
~Datatype () override | |
virtual Datatype_uptr | clone_type () const =0 |
Creates a new datatype as an exact copy of this one. More... | |
virtual bool | operator== (const Datatype &other) const =0 |
Test for equality. More... | |
bool | operator!= (const Datatype &other) const |
Test for inequality. More... | |
virtual Datatype_uptr | densify () const =0 |
Creates a new datatype as the dense copy of this one. More... | |
virtual bool | dense () const =0 |
Indicate if the datatype is dense or not. More... | |
virtual size_t | datasize () const =0 |
Computes the data size of a type, excluding potentially unused memory from a sparse type. More... | |
virtual size_t | buffersize () const =0 |
Computes the data size of a type, including potentially unused memory from a sparse type. More... | |
virtual size_t | alignment () const =0 |
Returns the required alignment for a type. More... | |
virtual bool | simple () const =0 |
Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer. More... | |
virtual void * | data_to_dense_copy (void *to, const void *from) const =0 |
Creates a dense deep copy of data. More... | |
virtual void * | data_from_dense_copy (void *to, const void *from) const =0 |
Creates a sparse deep copy of dense data. More... | |
std::pair< void *, Datatype_uptr > | subaccess (void *from, const Accessor_base &accessor) const |
Creates datatype of subtype and returns it with a moved pointer. More... | |
std::pair< void *, Datatype_uptr > | subaccess (void *from, const std::vector< std::unique_ptr< Accessor_base >> &accessors) const |
Creates datatype of subtype and returns it with a moved pointer. More... | |
virtual std::pair< void *, Datatype_uptr > | subaccess_by_iterators (void *from, std::vector< std::unique_ptr< Accessor_base >>::const_iterator remaining_begin, std::vector< std::unique_ptr< Accessor_base >>::const_iterator remaining_end) const |
Creates datatype of subtype and returns it with a moved pointer. More... | |
virtual void | destroy_data (void *ptr) const =0 |
Function used to delete the data behind the datatype. More... | |
virtual std::string | debug_string () const =0 |
Returns the datatype yaml representation as a string. More... | |
Public Member Functions inherited from PDI::Datatype_template | |
Datatype_template (const Attributes_map &attributes={}) | |
Creates datatype template with given attributes. More... | |
Datatype_template (PC_tree_t datatype_tree) | |
Creates datatype template. More... | |
virtual | ~Datatype_template () |
Destroys the template. More... | |
virtual Datatype_template_uptr | clone () const =0 |
Creates a new datatype as an exact copy of this one. More... | |
virtual Datatype_uptr | evaluate (Context &ctx) const =0 |
Creates a new datatype by resolving the value of all metadata references. More... | |
Expression | attribute (const std::string &attribute_name) const |
Returns attribute of given name as Expression. More... | |
const Attributes_map & | attributes () const |
Returns all attributes as a unordered map. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from PDI::Datatype_template | |
static void | load_basic_datatypes (Context &ctx) |
Adds to the context the basic Array, Record, C and Fortran datatypes. More... | |
static void | load_user_datatypes (Context &ctx, PC_tree_t types_tree) |
Adds to the context the user defined datatypes. More... | |
Protected Attributes inherited from PDI::Datatype_template | |
Attributes_map | m_attributes |
A Datatype is a Datatype_template that accepts no argument.
It represents the memory layout of data and supports some simple operations on it:
PDI::Datatype::Datatype | ( | const Attributes_map & | attributes = {} | ) |
Creates a new datatype.
[in] | attributes | attributes of the datatype |
|
override |
|
pure virtual |
Creates a new datatype as an exact copy of this one.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Test for equality.
other | the Datatype to compare |
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
bool PDI::Datatype::operator!= | ( | const Datatype & | other | ) | const |
|
pure virtual |
Creates a new datatype as the dense copy of this one.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Indicate if the datatype is dense or not.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Computes the data size of a type, excluding potentially unused memory from a sparse type.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Computes the data size of a type, including potentially unused memory from a sparse type.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Returns the required alignment for a type.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Creates a dense deep copy of data.
[in] | to | the pointer to the allocated memory to fill (dense data) |
[in] | from | the pointer to the copied data (size of buffersize) |
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Creates a sparse deep copy of dense data.
[in] | to | the pointer to the allocated memory to fill (size of buffersize) |
[in] | from | the pointer to the copied data (dense data) |
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
std::pair<void*, Datatype_uptr> PDI::Datatype::subaccess | ( | void * | from, |
const Accessor_base & | accessor | ||
) | const |
Creates datatype of subtype and returns it with a moved pointer.
[in] | from | the pointer to the data |
[in] | accessor | accessor to get subtype of datatype |
std::pair<void*, Datatype_uptr> PDI::Datatype::subaccess | ( | void * | from, |
const std::vector< std::unique_ptr< Accessor_base >> & | accessors | ||
) | const |
Creates datatype of subtype and returns it with a moved pointer.
[in] | from | the pointer to the data |
[in] | accessors | accessors to get nested subtype of datatype |
|
virtual |
Creates datatype of subtype and returns it with a moved pointer.
[in] | from | the pointer to the data |
[in] | remaining_begin | iterator to the begin of remaining accessors |
[in] | remaining_end | iterator to the end of remaining accessors |
Reimplemented in PDI::Array_datatype, PDI::Record_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Function used to delete the data behind the datatype.
This should not deallocate the memory.
[in] | ptr | to the data to free |
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.
|
pure virtual |
Returns the datatype yaml representation as a string.
Implemented in PDI::Array_datatype, PDI::Record_datatype, PDI::Scalar_datatype, and PDI::Pointer_datatype.