byte_range_info.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION.
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 
13 namespace CUDF_EXPORT cudf {
14 namespace io {
15 namespace text {
26  private:
27  int64_t _offset{};
28  int64_t _size{};
29 
30  public:
31  byte_range_info() = default;
38  byte_range_info(int64_t offset, int64_t size);
39 
45  byte_range_info(byte_range_info const& other) noexcept = default;
52  byte_range_info& operator=(byte_range_info const& other) noexcept = default;
53 
59  [[nodiscard]] int64_t offset() const { return _offset; }
60 
66  [[nodiscard]] int64_t size() const { return _size; }
67 
73  [[nodiscard]] bool is_empty() const { return size() == 0; }
74 };
75 
86 std::vector<byte_range_info> create_byte_range_infos_consecutive(int64_t total_bytes,
87  int64_t range_count);
88 
96  // end of group
98 
99 } // namespace text
100 } // namespace io
101 } // 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