range_window_bounds.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/scalar/scalar.hpp>
9 #include <cudf/utilities/export.hpp>
10 
11 namespace CUDF_EXPORT cudf {
34  public:
38  enum class extent_type : int32_t {
39  CURRENT_ROW = 0,
40  BOUNDED,
42  UNBOUNDED
43  };
44 
52  static range_window_bounds get(scalar const& boundary,
54 
65 
72  [[nodiscard]] bool is_current_row() const { return _extent == extent_type::CURRENT_ROW; }
73 
83 
90  [[nodiscard]] bool is_unbounded() const { return _extent == extent_type::UNBOUNDED; }
91 
97  [[nodiscard]] scalar const& range_scalar() const { return *_range_scalar; }
98 
100  range_window_bounds() = default; // Required for use as return types from dispatch functors.
101 
102  private:
103  extent_type _extent{extent_type::UNBOUNDED};
104  std::shared_ptr<scalar> _range_scalar{nullptr}; // To enable copy construction/assignment.
105 
106  range_window_bounds(extent_type extent_,
107  std::unique_ptr<scalar> range_scalar_,
109 };
110  // end of group
112 } // namespace CUDF_EXPORT cudf
Indicator for the logical data type of an element in a column.
Definition: types.hpp:238
An owning class to represent a singular value.
Definition: scalar.hpp:40
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
cuDF interfaces
Definition: host_udf.hpp:26
Class definitions for cudf::scalar.
Abstraction for window boundary sizes, to be used with grouped_range_rolling_window().
scalar const & range_scalar() const
Returns the underlying scalar value for the bounds.
static range_window_bounds unbounded(data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream())
Factory method to construct an unbounded window boundary.
static range_window_bounds get(scalar const &boundary, rmm::cuda_stream_view stream=cudf::get_default_stream())
Factory method to construct a bounded window boundary.
bool is_current_row() const
Whether or not the window is bounded to the current row.
range_window_bounds(range_window_bounds const &)=default
Copy constructor.
extent_type
The type of range_window_bounds.
static range_window_bounds current_row(data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream())
Factory method to construct a window boundary limited to the value of the current row.
bool is_unbounded() const
Whether or not the window is unbounded.