MySQL 8.4.0
Source Code Documentation
utilities.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2024, 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 as published by
5 the Free Software Foundation; version 2 of the License.
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 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 GROUP_REPLICATION_PFS_UTILITIES_H
25#define GROUP_REPLICATION_PFS_UTILITIES_H
26
29
30#include <vector>
32
33namespace gr {
34namespace perfschema {
35
37 private:
38 SERVICE_TYPE(registry) * m_registry{nullptr};
39
40 public:
42
45 }
46
47 SERVICE_TYPE(registry) * get_registry() { return m_registry; }
48};
49
50class Position {
51 private:
52 unsigned int m_index{0};
53 unsigned int m_max{0};
54
55 public:
56 void set_max(unsigned int max) { m_max = max; }
57 bool has_more() { return m_index < m_max; }
58 void next() { m_index++; }
59 void reset() { m_index = 0; }
60 unsigned int get_index() { return m_index; }
61 void set_at(unsigned int index) { m_index = index; }
62 void set_at(Position *pos) { m_index = pos->get_index(); }
63 void set_after(Position *pos) { m_index = pos->get_index() + 1; }
64};
65
66} // namespace perfschema
67} // namespace gr
68
69#endif
Definition: utilities.h:50
void set_at(unsigned int index)
Definition: utilities.h:61
unsigned int m_index
Definition: utilities.h:52
bool has_more()
Definition: utilities.h:57
void set_max(unsigned int max)
Definition: utilities.h:56
void set_after(Position *pos)
Definition: utilities.h:63
void next()
Definition: utilities.h:58
void set_at(Position *pos)
Definition: utilities.h:62
unsigned int m_max
Definition: utilities.h:53
unsigned int get_index()
Definition: utilities.h:60
void reset()
Definition: utilities.h:59
Definition: utilities.h:36
Registry_guard()
Definition: utilities.h:41
const mysql_service_registry_t * m_registry
Definition: utilities.h:38
~Registry_guard()
Definition: utilities.h:43
const mysql_service_registry_t * get_registry()
Definition: utilities.h:47
Definition: group_replication_priv.h:44
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
Declaration of the registry plugin service.
const mysql_service_registry_t * mysql_plugin_registry_acquire()
Returns a new reference to the "registry" service.
Definition: plugin_registry_service.cc:47
int mysql_plugin_registry_release(const mysql_service_registry_t *)
Releases a registry service reference.
Definition: plugin_registry_service.cc:75