data_chunk_source.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/utilities/export.hpp>
10 
11 #include <rmm/cuda_stream_pool.hpp>
12 #include <rmm/device_buffer.hpp>
13 
14 namespace CUDF_EXPORT cudf {
15 namespace io {
16 namespace text {
17 
34  public:
35  virtual ~device_data_chunk() = default;
41  [[nodiscard]] virtual char const* data() const = 0;
47  [[nodiscard]] virtual std::size_t size() const = 0;
53  virtual operator device_span<char const>() const = 0;
54 };
55 
66  public:
67  virtual ~data_chunk_reader() = default;
73  virtual void skip_bytes(std::size_t size) = 0;
74 
89  virtual std::unique_ptr<device_data_chunk> get_next_chunk(std::size_t size,
90  rmm::cuda_stream_view stream) = 0;
91 };
92 
98  public:
99  virtual ~data_chunk_source() = default;
100 
106  [[nodiscard]] virtual std::unique_ptr<data_chunk_reader> create_reader() const = 0;
107 };
108  // end of group
110 
111 } // namespace text
112 } // namespace io
113 } // namespace CUDF_EXPORT cudf
a reader capable of producing views over device memory.
virtual std::unique_ptr< device_data_chunk > get_next_chunk(std::size_t size, rmm::cuda_stream_view stream)=0
Get the next chunk of bytes from the data source.
virtual void skip_bytes(std::size_t size)=0
Skips the specified number of bytes in the data source.
a data source capable of creating a reader which can produce views of the data source in device memor...
virtual std::unique_ptr< data_chunk_reader > create_reader() const =0
Get a reader for the data source.
A contract guaranteeing stream-ordered memory access to the underlying device data.
virtual char const * data() const =0
Returns a pointer to the underlying device data.
virtual std::size_t size() const =0
Returns the size of the underlying device data.
cuDF interfaces
Definition: host_udf.hpp:26
APIs for spans.
Device version of C++20 std::span with reduced feature set.
Definition: span.hpp:323