MySQL 9.6.0
Source Code Documentation
interval_set_binary_operation_view_base.h
Go to the documentation of this file.
1// Copyright (c) 2025, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is designed to work with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have either included with
13// the program or referenced in the documentation.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License, version 2.0, for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24#ifndef MYSQL_SETS_INTERVAL_SET_BINARY_OPERATION_VIEW_BASE_H
25#define MYSQL_SETS_INTERVAL_SET_BINARY_OPERATION_VIEW_BASE_H
26
27/// @file
28/// Experimental API header
29
30#include "mysql/sets/interval_set_interface.h" // Interval_set_interface
31#include "mysql/sets/interval_set_meta.h" // Is_interval_set
32#include "mysql/sets/set_categories_and_traits.h" // Is_compatible_set
33
34/// @addtogroup GroupLibsMysqlSets
35/// @{
36
37namespace mysql::sets::detail {
38
39/// Common base class for the specializations of Union_view, Intersection_view,
40/// and Subtraction_view for interval sets.
41///
42/// This provides forward iterators.
43///
44/// @tparam Source1_tp Type of first boundary set.
45///
46/// @tparam Source2_tp Type of second boundary set.
47///
48/// @tparam operation_tp The type of operation.
49template <Is_interval_set Source1_tp, Is_interval_set Source2_tp,
50 Binary_operation operation_tp>
51 requires Is_compatible_set<Source1_tp, Source2_tp>
54 Interval_set_binary_operation_view_base<Source1_tp, Source2_tp,
55 operation_tp>,
56 Binary_operation_view_type<operation_tp,
57 typename Source1_tp::Boundary_set_t,
58 typename Source2_tp::Boundary_set_t>> {
59 public:
60 using Source1_t = Source1_tp;
61 using Source2_t = Source2_tp;
62 static constexpr auto operation = operation_tp;
64 operation_tp>;
65 using Set_traits_t = typename Source1_t::Set_traits_t;
67 Binary_operation_view_type<operation_tp,
68 typename Source1_tp::Boundary_set_t,
69 typename Source2_tp::Boundary_set_t>;
70
71 /// Construct a new, empty view.
73
74 /// Construct a new view over the two given interval set sources.
75 ///
76 /// @param source1 The first source.
77 ///
78 /// @param source2 The second source.
80 const Source2_t &source2)
81 : m_boundaries(source1.boundaries(), source2.boundaries()) {}
82
83 /// Construct a new view over the two given interval set sources.
84 ///
85 /// Use this constructor if one of the sources may be empty and you do not
86 /// have an object representing it; then pass nullptr for that source.
87 ///
88 /// @param source1 The first source, or nullptr for empty set.
89 ///
90 /// @param source2 The second source, or nullptr for empty set.
92 const Source2_t *source2)
93 : m_boundaries(source1 != nullptr ? &source1->boundaries() : nullptr,
94 source2 != nullptr ? &source2->boundaries() : nullptr) {}
95
96 // Default rule-of-5.
98 const Interval_set_binary_operation_view_base &) noexcept = default;
106
107 /// Return the boundary set.
108 [[nodiscard]] const auto &boundaries() const { return m_boundaries; }
109
110 private:
111 /// Boundary binary operation view over the boundary sets of the
112 /// given interval sets.
114}; // class Interval_set_binary_operation_view_base
115
116} // namespace mysql::sets::detail
117
118// addtogroup GroupLibsMysqlSets
119/// @}
120
121#endif // ifndef MYSQL_SETS_INTERVAL_SET_BINARY_OPERATION_VIEW_BASE_H
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
CRTP base class used to define an Interval set based on an implementation having the member function ...
Definition: interval_set_interface.h:87
Common base class for the specializations of Union_view, Intersection_view, and Subtraction_view for ...
Definition: interval_set_binary_operation_view_base.h:58
Boundary_set_binary_operation_view_t m_boundaries
Boundary binary operation view over the boundary sets of the given interval sets.
Definition: interval_set_binary_operation_view_base.h:113
Interval_set_binary_operation_view_base(Interval_set_binary_operation_view_base &&) noexcept=default
Binary_operation_view_type< operation_tp, typename Source1_tp::Boundary_set_t, typename Source2_tp::Boundary_set_t > Boundary_set_binary_operation_view_t
Definition: interval_set_binary_operation_view_base.h:69
static constexpr auto operation
Definition: interval_set_binary_operation_view_base.h:62
Interval_set_binary_operation_view_base()=default
Construct a new, empty view.
Interval_set_binary_operation_view_base(const Source1_t *source1, const Source2_t *source2)
Construct a new view over the two given interval set sources.
Definition: interval_set_binary_operation_view_base.h:91
const auto & boundaries() const
Return the boundary set.
Definition: interval_set_binary_operation_view_base.h:108
typename Source1_t::Set_traits_t Set_traits_t
Definition: interval_set_binary_operation_view_base.h:65
Interval_set_binary_operation_view_base(const Source1_t &source1, const Source2_t &source2)
Construct a new view over the two given interval set sources.
Definition: interval_set_binary_operation_view_base.h:79
Source1_tp Source1_t
Definition: interval_set_binary_operation_view_base.h:60
Interval_set_binary_operation_view_base(const Interval_set_binary_operation_view_base &) noexcept=default
Source2_tp Source2_t
Definition: interval_set_binary_operation_view_base.h:61
Experimental API header.
Experimental API header.
Definition: aliases.h:97
Binary_operation
Identifies the type of a binary operation.
Definition: binary_operation.h:37
std::conditional_t<(int) binary_operation==(int) Binary_operation::op_union, Union_view< Source1_t, Source2_t >, std::conditional_t<(int) binary_operation==(int) Binary_operation::op_intersection, Intersection_view< Source1_t, Source2_t >, std::conditional_t<(int) binary_operation==(int) Binary_operation::op_subtraction, Subtraction_view< Source1_t, Source2_t >, void > > > Binary_operation_view_type
For a Binary_operation and two operand sets, gives the corresponding Union_view, Intersection_view,...
Definition: base_binary_operation_views.h:91
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
Experimental API header.