MySQL 9.6.0
Source Code Documentation
interval_set_complement_view.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_COMPLEMENT_VIEW_H
25#define MYSQL_SETS_INTERVAL_SET_COMPLEMENT_VIEW_H
26
27/// @file
28/// Experimental API header
29
30#include "mysql/sets/base_complement_view.h" // Complement_view
31#include "mysql/sets/interval_set_interface.h" // Interval_set_interface
32#include "mysql/sets/interval_set_meta.h" // Is_interval_set
33#include "mysql/sets/optional_view_source_set.h" // Optional_view_source_set
34
35/// @addtogroup GroupLibsMysqlSets
36/// @{
37
38namespace mysql::sets {
39
40/// Specialization of Complement_view for interval sets, providing a view over
41/// the complement of another interval set.
42///
43/// This provides forward iterators.
44///
45/// @tparam Source_tp Type of interval set.
46template <Is_interval_set Source_tp>
47class Complement_view<Source_tp>
48 : public Interval_set_interface<
49 Complement_view<Source_tp>,
50 Complement_view<typename Source_tp::Boundary_set_t>> {
51 public:
52 using Source_t = Source_tp;
54 using Set_traits_t = typename Source_t::Set_traits_t;
55 using Source_boundary_set_t = typename Source_tp::Boundary_set_t;
57
58 /// Construct a new interval complement view over the given interval
59 /// set.
61 : m_boundaries(source.boundaries()), m_source(source) {}
62
63 /// Return the boundary set.
64 [[nodiscard]] const Complement_boundary_set_t &boundaries() const {
65 return m_boundaries;
66 }
67
68 /// Return reference to the source interval set that this is the complement
69 /// of. The return type is a reference if the source is a container, and a
70 /// value if it is a view.
71 [[nodiscard]] decltype(auto) source() const { return m_source.get(); }
72
73 private:
74 /// Boundary complement view over the boundary set for the given
75 /// interval set.
77
78 /// The source interval set, that this is the complement of.
80}; // class Complement_view over interval set
81
82} // namespace mysql::sets
83
84// addtogroup GroupLibsMysqlSets
85/// @}
86
87#endif // ifndef MYSQL_SETS_INTERVAL_SET_COMPLEMENT_VIEW_H
Experimental API header.
typename Source_t::Set_traits_t Set_traits_t
Definition: boundary_set_complement_view.h:55
typename Source_tp::Boundary_set_t Source_boundary_set_t
Definition: interval_set_complement_view.h:55
decltype(auto) source() const
Return reference to the source interval set that this is the complement of.
Definition: interval_set_complement_view.h:71
Complement_view(const Source_t &source)
Construct a new interval complement view over the given interval set.
Definition: interval_set_complement_view.h:60
const Complement_boundary_set_t & boundaries() const
Return the boundary set.
Definition: interval_set_complement_view.h:64
Opt_source_t m_source
The source interval set, that this is the complement of.
Definition: interval_set_complement_view.h:79
Source_tp Source_t
Definition: boundary_set_complement_view.h:54
const Complement_boundary_set_t m_boundaries
Boundary complement view over the boundary set for the given interval set.
Definition: interval_set_complement_view.h:76
This can be specialized to specific set categories, e.g.
Definition: base_complement_view.h:43
Experimental API header.
Experimental API header.
Definition: gtid_set.h:183
Experimental API header.
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42