type_checks.hpp
1 /*
2  * Copyright (c) 2021-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 #pragma once
17 
19 #include <cudf/scalar/scalar.hpp>
20 
21 #include <algorithm>
22 
23 namespace CUDF_EXPORT cudf {
24 
42 [[deprecated]] bool column_types_equal(column_view const& lhs, column_view const& rhs);
43 
54 bool column_types_equivalent(column_view const& lhs, column_view const& rhs);
55 
71 bool have_same_types(column_view const& lhs, column_view const& rhs);
72 
88 bool have_same_types(column_view const& lhs, scalar const& rhs);
89 
105 bool have_same_types(scalar const& lhs, column_view const& rhs);
106 
120 bool have_same_types(scalar const& lhs, scalar const& rhs);
121 
129 bool have_same_types(table_view const& lhs, table_view const& rhs);
130 
142 template <typename ForwardIt>
143 inline bool all_have_same_types(ForwardIt first, ForwardIt last)
144 {
145  return first == last || std::all_of(std::next(first), last, [want = *first](auto const& c) {
146  return cudf::have_same_types(want, c);
147  });
148 }
149 
150 } // namespace CUDF_EXPORT cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
An owning class to represent a singular value.
Definition: scalar.hpp:49
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:200
column view class definitions
cuDF interfaces
Definition: aggregation.hpp:35
bool column_types_equivalent(column_view const &lhs, column_view const &rhs)
Compare the type IDs of two column_views.
bool all_have_same_types(ForwardIt first, ForwardIt last)
Compare the types of a range of column_view or scalar objects.
bool column_types_equal(column_view const &lhs, column_view const &rhs)
Compare the types of two column_views.
bool have_same_types(column_view const &lhs, column_view const &rhs)
Compares the type of two column_views.
Class definitions for cudf::scalar.