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 shall be declared in the oneapi::dal namespace and be available via inclusion of the oneapi/dal/table/homogen.hpp header file.

class homogen_table : public table {
public:
    static std::int64_t kind();

    template <typename Data>
    static homogen_table wrap(const sycl::queue& queue,
                              const Data* data_pointer,
                              std::int64_t row_count,
                              std::int64_t column_count,
                              const sycl::vector_class<sycl::event>& dependencies = {},
                              data_layout layout = data_layout::row_major);

public:
    homogen_table();

    template <typename Data, typename ConstDeleter>
    homogen_table(const sycl::queue& queue,
                  const Data* data_pointer,
                  std::int64_t row_count,
                  std::int64_t column_count,
                  ConstDeleter&& data_deleter,
                  const sycl::vector_class<sycl::event>& dependencies = {},
                  data_layout layout                                  = data_layout::row_major);

    template <typename Data>
    const Data* get_data() const {
        return reinterpret_cast<const Data*>(this->get_data());
    }

    const void* get_data() const;

    std::int64_t get_kind() const {
        return kind();
    }
};
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 sycl::queue &queue, const Data *data_pointer, std::int64_t row_count, std::int64_t column_count, const sycl::vector_class<sycl::event> &dependencies = {}, 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 shall 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 shall initialize data types of metadata with this data type. The feature types shall be set to default values for \(Data\) type: contiguous for floating-point, ordinal for integer types. The \(Data\) type shall be at least float, double or std::int32_t.

Parameters
  • queue – The SYCL* queue object.

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

  • dependencies – Events indicating availability of the \(data\) for reading or writing.

  • layout – The layout of the data. Shall 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 shall be set to`homogen_table::kind()`. All the properties shall be set to default value (see the Properties section).

template<typename Data, typename ConstDeleter>
homogen_table(const sycl::queue &queue, const Data *data_pointer, std::int64_t row_count, std::int64_t column_count, ConstDeleter &&data_deleter, const sycl::vector_class<sycl::event> &dependencies = {}, 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 shall 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 shall 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
  • queue – The SYCL* queue object.

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

  • dependencies – Events indicating availability of the \(data\) for reading or writing.

  • layout – The layout of the data. Shall 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.

const void *get_data() const

The pointer to the data block within the table. Shall 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.