class PDI::Datatype

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

Content

Member Types

struct Accessor_base
Base class for datatype accesssors, that allow to get pointer to subtype.

Member Functions

size_t alignment ( )
Returns the required alignment for a type.
size_t buffersize ( )
Computes the data size of a type, including potentially unused memory from a sparse type.
Datatype_uptr clone_type ( )
Creates a new datatype as an exact copy of this one.
void * data_from_dense_copy ( const void * from, void * to )
Creates a sparse deep copy of dense data.
void * data_to_dense_copy ( const void * from, void * to )
Creates a dense deep copy of data.
size_t datasize ( )
Computes the data size of a type, excluding potentially unused memory from a sparse type.
std::string debug_string ( )
Returns the datatype yaml representation as a string.
bool dense ( )
Indicate if the datatype is dense or not.
Datatype_uptr densify ( )
Creates a new datatype as the dense copy of this one.
void destroy_data ( void * ptr )
Function used to delete the data behind the datatype.
bool operator!= ( const Datatype & other )
Test for inequality.
bool operator== ( const Datatype & other )
Test for equality.
bool simple ( )
Tells if data can be copied as bytes (if type is dense) and doesn't need a destroyer.
std::pair< void *, Datatype_uptr > subaccess ( const Accessor_base & accessor, void * from )
Creates datatype of subtype and returns it with a moved pointer.
std::pair< void *, Datatype_uptr > subaccess ( const std::vector< std::unique_ptr< Accessor_base >> & accessors, void * from )
Creates datatype of subtype and returns it with a moved pointer.
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 )
Creates datatype of subtype and returns it with a moved pointer.
~Datatype ( )

Documentation

Member Functions

size_t alignment ( )

Description

Returns the required alignment for a type.

Result

the size in bytes

size_t buffersize ( )

Description

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

Result

the size in bytes

Datatype_uptr clone_type ( )

Description

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

Result

the dense type that is produced

void * data_from_dense_copy ( const void * from, void * to )

Description

Creates a sparse deep copy of dense data.

Parameters

from
the pointer to the copied data (dense data)
to
the pointer to the allocated memory to fill (size of buffersize)

Result

updated ‘to’ pointer

void * data_to_dense_copy ( const void * from, void * to )

Description

Creates a dense deep copy of data.

Parameters

from
the pointer to the copied data (size of buffersize)
to
the pointer to the allocated memory to fill (dense data)

Result

updated ‘to’ pointer

size_t datasize ( )

Description

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

Result

the size in bytes

std::string debug_string ( )

Description

Returns the datatype yaml representation as a string.

Result

the datatype yaml representation as a string

bool dense ( )

Description

Indicate if the datatype is dense or not.

Result

whether the datatype is dense

Datatype_uptr densify ( )

Description

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

Result

the type that is produced

void destroy_data ( void * ptr )

Description

Function used to delete the data behind the datatype. This should not deallocate the memory.

Parameters

ptr
to the data to free

bool operator!= ( const Datatype & other )

Description

Test for inequality.

Parameters

other
the Datatype to compare

Result

true if the Datatype’s are different

bool operator== ( const Datatype & other )

Description

Test for equality.

Parameters

other
the Datatype to compare

Result

true if the Datatype’s are equal

bool simple ( )

Description

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

Result

true if data has trivial copier and destroyer, false otherwise

std::pair< void *, Datatype_uptr > subaccess ( const Accessor_base & accessor, void * from )

Description

Creates datatype of subtype and returns it with a moved pointer.

Parameters

accessor
accessor to get subtype of datatype
from
the pointer to the data

Result

pointer with offset and new datatype

std::pair< void *, Datatype_uptr > subaccess ( const std::vector< std::unique_ptr< Accessor_base >> & accessors, void * from )

Description

Creates datatype of subtype and returns it with a moved pointer.

Parameters

accessors
accessors to get nested subtype of datatype
from
the pointer to the data

Result

pointer with offset and new datatype

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 )

Description

Creates datatype of subtype and returns it with a moved pointer.

Parameters

from
the pointer to the data
remaining_begin
iterator to the begin of remaining accessors
remaining_end
iterator to the end of remaining accessors

Result

pointer moved by offset and new datatype

~Datatype ( )


Last modified January 1, 0001