Homogeneous table

Class homogen_table is an implementation of a table type for which the following is true:

  • The data within the table are dense and stored as one contiguous memory block.

  • All the columns have the same data type.

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.

Constructors

homogen_table()

Creates a new homogen_table instance with zero number of rows and columns. The kind is set to`homogen_table::kind()`. All the properties should be set to default values (see the Properties section).

template<typename Impl, typename ImplType = std::decay_t<Impl>, typename None = std::enable_if_t<detail::is_homogen_table_impl_v<ImplType> && !std::is_base_of_v<table, ImplType>>>
homogen_table(Impl &&impl)
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.

Properties

const void *data

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

Getter & Setter
const void * get_data() const
std::int64_t kind

The unique id of the homogen table type.

Getter & Setter
std::int64_t get_kind() const