Homogeneous table

Refer to Developer Guide: Homogeneous table.

Programming interface

All types and functions in this section are declared in the oneapi::dal namespace and be available via inclusion of the oneapi/dal/table/homogen.hpp header file.

class homogen_table

Public Static Methods

static std::int64_t kind()

Returns the unique id of homogen_table class.

template<typename Data>
static homogen_table wrap(const Data *data_pointer, std::int64_t row_count, std::int64_t column_count, data_layout layout = data_layout::row_major)

Creates a new homogen_table instance from externally-defined data block. Table object refers to the data but does not own it. The responsibility to free the data remains on the user side. The data should point to the data_pointer memory block.

Template Parameters

Data – The type of elements in the data block that will be stored into the table. The table initializes data types of metadata with this data type. The feature types should be set to default values for Data type: contiguous for floating-point, ordinal for integer types. The Data type should be at least float, double or std::int32_t.

Parameters
  • data_pointer – The pointer to a homogeneous data block.

  • row_count – The number of rows in the table.

  • column_count – The number of columns in the table.

  • layout – The layout of the data. Should be data_layout::row_major or data_layout::column_major.

template<typename Data>
static homogen_table wrap(const dal::array<Data> &data, std::int64_t row_count, std::int64_t column_count, data_layout layout = data_layout::row_major)

Creates a new homogen_table instance from an array. The created table shares data ownership with the given array.

Template Parameters

Data – The type of elements in the data block that will be stored into the table. The table initializes data types of metadata with this data type. The feature types should be set to default values for Data type: contiguous for floating-point, ordinal for integer types. The Data type should be at least float, double or std::int32_t.

Parameters
  • data – The array that stores a homogeneous data block.

  • row_count – The number of rows in the table.

  • column_count – The number of columns in the table.

  • layout – The layout of the data. Should be data_layout::row_major or data_layout::column_major.

Constructors

homogen_table()

Creates a new homogen_table instance with zero number of rows and columns.

homogen_table(const table &other)

Casts an object of the base table type to a homogen table. If cast is not possible, the operation is equivalent to a default constructor call.

template<typename Data, typename ConstDeleter>
homogen_table(const Data *data_pointer, std::int64_t row_count, std::int64_t column_count, ConstDeleter &&data_deleter, data_layout layout = data_layout::row_major)

Creates a new homogen_table instance from externally-defined data block. Table object owns the data pointer. The data should point to the data_pointer memory block.

Template Parameters
  • Data – The type of elements in the data block that will be stored into the table. The Data type should be at least float, double or std::int32_t.

  • ConstDeleter – The type of a deleter called on data_pointer when the last table that refers it is out of the scope.

Parameters
  • data_pointer – The pointer to a homogeneous data block.

  • row_count – The number of rows in the table.

  • column_count – The number of columns in the table.

  • data_deleter – The deleter that is called on the data_pointer when the last table that refers it is out of the scope.

  • layout – The layout of the data. Should be data_layout::row_major or data_layout::column_major.

Public Methods

template<typename Data>
const Data *get_data() const

Returns the data pointer cast to the Data type. No checks are performed that this type is the actual type of the data within the table. If table has no data, returns nullptr.

const void *get_data() const

The pointer to the data block within the table. Should be equal to nullptr when row_count == 0 and column_count == 0.

std::int64_t get_kind() const

The unique id of the homogen table type.