byte_range_info.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-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 
21 #include <cstdint>
22 #include <vector>
23 
24 namespace CUDF_EXPORT cudf {
25 namespace io {
26 namespace text {
37  private:
38  int64_t _offset{};
39  int64_t _size{};
40 
41  public:
42  byte_range_info() = default;
49  byte_range_info(int64_t offset, int64_t size);
50 
56  byte_range_info(byte_range_info const& other) noexcept = default;
63  byte_range_info& operator=(byte_range_info const& other) noexcept = default;
64 
70  [[nodiscard]] int64_t offset() const { return _offset; }
71 
77  [[nodiscard]] int64_t size() const { return _size; }
78 
84  [[nodiscard]] bool is_empty() const { return size() == 0; }
85 };
86 
97 std::vector<byte_range_info> create_byte_range_infos_consecutive(int64_t total_bytes,
98  int64_t range_count);
99 
107  // end of group
109 
110 } // namespace text
111 } // namespace io
112 } // namespace CUDF_EXPORT cudf
stores offset and size used to indicate a byte range
int64_t size() const
Get the size in bytes.
int64_t offset() const
Get the offset in bytes.
byte_range_info & operator=(byte_range_info const &other) noexcept=default
Copy assignment operator.
byte_range_info(byte_range_info const &other) noexcept=default
Copy constructor.
bool is_empty() const
Returns whether the span is empty.
byte_range_info(int64_t offset, int64_t size)
Constructs a byte_range_info object.
byte_range_info create_byte_range_info_max()
Create a byte_range_info which represents as much of a file as possible. Specifically,...
std::vector< byte_range_info > create_byte_range_infos_consecutive(int64_t total_bytes, int64_t range_count)
Create a collection of consecutive ranges between [0, total_bytes).
cuDF interfaces
Definition: host_udf.hpp:39