range_window_bounds.hpp
1 /*
2  * Copyright (c) 2021-2022, 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/scalar/scalar.hpp>
20 
21 namespace cudf {
22 
37  public:
44  static range_window_bounds get(scalar const& boundary);
45 
53 
60  [[nodiscard]] bool is_unbounded() const { return _is_unbounded; }
61 
67  [[nodiscard]] scalar const& range_scalar() const { return *_range_scalar; }
68 
70  range_window_bounds() = default; // Required for use as return types from dispatch functors.
71 
72  private:
73  const bool _is_unbounded{true};
74  std::shared_ptr<scalar> _range_scalar{nullptr}; // To enable copy construction/assignment.
75 
76  range_window_bounds(bool is_unbounded_, std::unique_ptr<scalar> range_scalar_);
77 };
78 
79 } // namespace cudf
cudf::range_window_bounds::unbounded
static range_window_bounds unbounded(data_type type)
Factory method to construct an unbounded window boundary.
scalar.hpp
Class definitions for cudf::scalar.
cudf::range_window_bounds::get
static range_window_bounds get(scalar const &boundary)
Factory method to construct a bounded window boundary.
cudf::range_window_bounds::range_scalar
scalar const & range_scalar() const
Returns the underlying scalar value for the bounds.
Definition: range_window_bounds.hpp:67
cudf::range_window_bounds
Abstraction for window boundary sizes, to be used with grouped_range_rolling_window().
Definition: range_window_bounds.hpp:36
cudf::range_window_bounds::is_unbounded
bool is_unbounded() const
Whether or not the window is unbounded.
Definition: range_window_bounds.hpp:60
cudf::scalar
An owning class to represent a singular value.
Definition: scalar.hpp:48
cudf::range_window_bounds::range_window_bounds
range_window_bounds(range_window_bounds const &)=default
Copy constructor.
cudf::data_type
Indicator for the logical data type of an element in a column.
Definition: types.hpp:236
cudf
cuDF interfaces
Definition: aggregation.hpp:34