PDI 0.5.1

Data exchange made easy

PDI::Datatype Class Referenceabstract

A Datatype is a Datatype_template that accepts no argument. More...

Inheritance diagram for PDI::Datatype:
Inheritance graph

Public Member Functions

 ~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...
 
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
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...
 

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...
 

Detailed Description

A Datatype is a Datatype_template that accepts no argument.

It represents the memory layout of data and supports some simple operations on it:

  • accessing its content
  • cloning and destruction

Constructor & Destructor Documentation

◆ ~Datatype()

PDI::Datatype::~Datatype ( )
override

Member Function Documentation

◆ clone_type()

virtual Datatype_uptr PDI::Datatype::clone_type ( ) const
pure virtual

Creates a new datatype as an exact copy of this one.

Returns
the dense type that is produced

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ operator==()

virtual bool PDI::Datatype::operator== ( const Datatype other) const
pure virtual

Test for equality.

Parameters
otherthe Datatype to compare
Returns
true if the Datatype's are equal

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ operator!=()

bool PDI::Datatype::operator!= ( const Datatype other) const

Test for inequality.

Parameters
otherthe Datatype to compare
Returns
true if the Datatype's are different

◆ densify()

virtual Datatype_uptr PDI::Datatype::densify ( ) const
pure virtual

Creates a new datatype as the dense copy of this one.

Returns
the type that is produced

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ dense()

virtual bool PDI::Datatype::dense ( ) const
pure virtual

Indicate if the datatype is dense or not.

Returns
whether the datatype is dense

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ datasize()

virtual size_t PDI::Datatype::datasize ( ) const
pure virtual

Computes the data size of a type, excluding potentially unused memory from a sparse type.

Returns
the size in bytes

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ buffersize()

virtual size_t PDI::Datatype::buffersize ( ) const
pure virtual

Computes the data size of a type, including potentially unused memory from a sparse type.

Returns
the size in bytes

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ alignment()

virtual size_t PDI::Datatype::alignment ( ) const
pure virtual

Returns the required alignment for a type.

Returns
the size in bytes

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ simple()

virtual bool PDI::Datatype::simple ( ) const
pure virtual

Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer.

Returns
true if data has trivial copier and destroyer, false otherwise

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ data_to_dense_copy()

virtual void* PDI::Datatype::data_to_dense_copy ( void *  to,
const void *  from 
) const
pure virtual

Creates a dense deep copy of data.

Parameters
[in]tothe pointer to the allocated memory to fill (dense data)
[in]fromthe pointer to the copied data (size of buffersize)
Returns
updated `to' pointer

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ data_from_dense_copy()

virtual void* PDI::Datatype::data_from_dense_copy ( void *  to,
const void *  from 
) const
pure virtual

Creates a sparse deep copy of dense data.

Parameters
[in]tothe pointer to the allocated memory to fill (size of buffersize)
[in]fromthe pointer to the copied data (dense data)
Returns
updated `to' pointer

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ destroy_data()

virtual void PDI::Datatype::destroy_data ( void *  ptr) const
pure virtual

Function used to delete the data behind the datatype.

This should not deallocate the memory.

Parameters
[in]ptrto the data to free

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.

◆ debug_string()

virtual std::string PDI::Datatype::debug_string ( ) const
pure virtual

Returns the datatype yaml representation as a string.

Returns
the datatype yaml representation as a string

Implemented in PDI::Record_datatype, PDI::Array_datatype, and PDI::Scalar_datatype.


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