1 /* Copyright (c) 2015, 2021, 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 also distributed 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 included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef GCS_XCOM_VIEW_IDENTIFIER_INCLUDED
24 #define GCS_XCOM_VIEW_IDENTIFIER_INCLUDED
25 
26 #include "gcs_view_identifier.h"
27 #include "gcs_types.h"
28 
29 #include <string>
30 #include <stdint.h>
31 
32 class Gcs_xcom_view_identifier: public Gcs_view_identifier
33 {
34 public:
35   explicit Gcs_xcom_view_identifier(uint64_t fixed_part_arg,
36                                     int monotonic_part_arg);
37 
38   virtual ~Gcs_xcom_view_identifier();
39 
40 
get_fixed_part()41   uint64_t get_fixed_part() const
42   {
43     return fixed_part;
44   }
45 
46 
get_monotonic_part()47   int get_monotonic_part() const
48   {
49     return monotonic_part;
50   }
51 
52 
53   void increment_by_one();
54 
55 
56   virtual const std::string &get_representation() const;
57 
58 
59   Gcs_view_identifier *clone() const;
60 
61 private:
62   void init(uint64_t fixed_part_arg, int monotonic_part_arg);
63 
64   uint64_t fixed_part;
65   int               monotonic_part;
66   std::string       representation;
67 };
68 
69 #endif  /* GCS_XCOM_VIEW_IDENTIFIER_INCLUDED */
70