MySQL 9.1.0
Source Code Documentation
member_version.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 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, 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 MEMBER_VERSION_INCLUDED
25#define MEMBER_VERSION_INCLUDED
26
27#include <string>
28
29#include "my_inttypes.h"
30
31/**
32 * @brief represent the MySQL version of a Member within the Group Replication
33 * group.
34 */
36 public:
37 /**
38 Constructs the Member_version object from a hexadecimal (base 16)
39 representation.
40 Example: 8.0.1 -> 0x080001
41
42 @param[in] version hexadecimal (base 16) number
43 */
44 Member_version(unsigned int version);
45
46 /**
47 @return returns the member version.
48 */
49 uint32 get_version() const;
50
51 /**
52 @return returns the member version in string format.
53 */
54 const std::string get_version_string() const;
55 /**
56 @return returns the major version (Major.v.v)
57 */
59 /**
60 @return returns the minor version (v.Minor.v)
61 */
63 /**
64 @return returns the minor version (v.v.Patch)
65 */
67
68 bool operator==(const Member_version &other) const;
69 bool operator!=(const Member_version &other) const;
70 bool operator<(const Member_version &other) const;
71 bool operator>(const Member_version &other) const;
72 bool operator>=(const Member_version &other) const;
73 bool operator<=(const Member_version &other) const;
74
75#ifndef NDEBUG
76 /**
77 Increment by 1 the major version.
78 */
80
81 /**
82 Decrement by 1 the major version.
83 */
85
86 /**
87 Increment by 1 the minor version.
88
89 @note If the minor version is 99 before the increment, the minor version
90 becomes 0 and the major version is incremented by 1.
91 */
93
94 /**
95 Decrement by 1 the minor version.
96
97 @note If the minor version is 0 before the increment, the minor version
98 becomes 99 and the major version is decremented by 1.
99 */
101
102 /**
103 Increment by 1 the patch version.
104
105 @note If the patch version is 99 before the increment, the patch version
106 becomes 0 and the minor version is incremented by 1 (which may increment by
107 1 the major version).
108 */
110
111 /**
112 Decrement by 1 the patch version.
113
114 @note If the patch version is 0 before the increment, the patch version
115 becomes 99 and the minor version is decremented by 1 (which may decrement by
116 1 the major version).
117 */
119#endif /* NDEBUG */
120
121 private:
123
124#ifndef NDEBUG
125 /**
126 Return the major version in decimal (base 10) representation.
127
128 @return major version in decimal (base 10) format representation
129 */
130 uint8_t get_major_version_decimal() const;
131
132 /**
133 Return the minor version in decimal (base 10) representation.
134
135 @return minor version in decimal (base 10) format representation
136 */
137 uint8_t get_minor_version_decimal() const;
138
139 /**
140 Return the patch version in decimal (base 10) representation.
141
142 @return patch version in decimal (base 10) format representation
143 */
144 uint8_t get_patch_version_decimal() const;
145
146 /**
147 Update the version from a decimal (base 10) representation.
148
149 @param[in] major major version in decimal (base 10) representation
150 @param[in] minor minor version in decimal (base 10) representation
151 @param[in] patch patch version in decimal (base 10) representation
152 */
153 void update_version_decimal(const uint8_t major, const uint8_t minor,
154 const uint8_t patch);
155#endif /* NDEBUG */
156};
157
158#endif /* MEMBER_VERSION_INCLUDED */
represent the MySQL version of a Member within the Group Replication group.
Definition: member_version.h:35
bool operator>(const Member_version &other) const
Definition: member_version.cc:85
uint8_t get_patch_version_decimal() const
Return the patch version in decimal (base 10) representation.
Definition: member_version.cc:116
void increment_major_version()
Increment by 1 the major version.
Definition: member_version.cc:147
uint32 get_minor_version() const
Definition: member_version.cc:45
uint32 version
Definition: member_version.h:122
void decrement_patch_version()
Decrement by 1 the patch version.
Definition: member_version.cc:212
bool operator>=(const Member_version &other) const
Definition: member_version.cc:91
void decrement_major_version()
Decrement by 1 the major version.
Definition: member_version.cc:157
bool operator<(const Member_version &other) const
Definition: member_version.cc:61
bool operator==(const Member_version &other) const
Definition: member_version.cc:53
void update_version_decimal(const uint8_t major, const uint8_t minor, const uint8_t patch)
Update the version from a decimal (base 10) representation.
Definition: member_version.cc:124
uint32 get_version() const
Definition: member_version.cc:34
Member_version(unsigned int version)
Constructs the Member_version object from a hexadecimal (base 16) representation.
Definition: member_version.cc:30
void increment_patch_version()
Increment by 1 the patch version.
Definition: member_version.cc:197
uint8_t get_minor_version_decimal() const
Return the minor version in decimal (base 10) representation.
Definition: member_version.cc:108
bool operator!=(const Member_version &other) const
Definition: member_version.cc:57
bool operator<=(const Member_version &other) const
Definition: member_version.cc:95
void decrement_minor_version()
Decrement by 1 the minor version.
Definition: member_version.cc:182
const std::string get_version_string() const
Definition: member_version.cc:36
uint32 get_patch_version() const
Definition: member_version.cc:49
uint8_t get_major_version_decimal() const
Return the major version in decimal (base 10) representation.
Definition: member_version.cc:100
uint32 get_major_version() const
Definition: member_version.cc:43
void increment_minor_version()
Increment by 1 the minor version.
Definition: member_version.cc:167
Some integer typedefs for easier portability.
uint32_t uint32
Definition: my_inttypes.h:67