data_chunk_source.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/utilities/export.hpp>
20 #include <cudf/utilities/span.hpp>
21 
22 #include <rmm/cuda_stream_pool.hpp>
23 #include <rmm/device_buffer.hpp>
24 
25 namespace CUDF_EXPORT cudf {
26 namespace io {
27 namespace text {
28 
45  public:
46  virtual ~device_data_chunk() = default;
52  [[nodiscard]] virtual char const* data() const = 0;
58  [[nodiscard]] virtual std::size_t size() const = 0;
64  virtual operator device_span<char const>() const = 0;
65 };
66 
77  public:
78  virtual ~data_chunk_reader() = default;
84  virtual void skip_bytes(std::size_t size) = 0;
85 
100  virtual std::unique_ptr<device_data_chunk> get_next_chunk(std::size_t size,
101  rmm::cuda_stream_view stream) = 0;
102 };
103 
109  public:
110  virtual ~data_chunk_source() = default;
111 
117  [[nodiscard]] virtual std::unique_ptr<data_chunk_reader> create_reader() const = 0;
118 };
119  // end of group
121 
122 } // namespace text
123 } // namespace io
124 } // 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: aggregation.hpp:35
APIs for spans.
Device version of C++20 std::span with reduced feature set.
Definition: span.hpp:338