byte_range_info.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/utilities/export.hpp>
9 
10 #include <cstdint>
11 #include <vector>
12 
18 namespace CUDF_EXPORT cudf {
19 namespace io {
20 namespace text {
30  private:
31  int64_t _offset{};
32  int64_t _size{};
33 
34  public:
35  byte_range_info() = default;
42  byte_range_info(int64_t offset, int64_t size);
43 
49  byte_range_info(byte_range_info const& other) noexcept = default;
56  byte_range_info& operator=(byte_range_info const& other) noexcept = default;
57 
63  [[nodiscard]] int64_t offset() const { return _offset; }
64 
70  [[nodiscard]] int64_t size() const { return _size; }
71 
77  [[nodiscard]] bool is_empty() const { return size() == 0; }
78 };
79 
90 std::vector<byte_range_info> create_byte_range_infos_consecutive(int64_t total_bytes,
91  int64_t range_count);
92 
100  // end of group
102 
103 } // namespace text
104 } // namespace io
105 } // 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:26