1 /*************************************************************************
3 * Copyright 2016 Realm Inc.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 **************************************************************************/
19 #ifndef REALM_VERSION_ID_HPP
20 #define REALM_VERSION_ID_HPP
22 #if defined(_WIN32) && !defined(__STDC_LIMIT_MACROS)
23 #define __STDC_LIMIT_MACROS
31 using version_type = uint_fast64_t;
32 version_type version = std::numeric_limits<version_type>::max();
33 uint_fast32_t index = 0;
38 VersionID(version_type initial_version, uint_fast32_t initial_index)
40 version = initial_version;
41 index = initial_index;
44 bool operator==(const VersionID& other)
46 return version == other.version;
48 bool operator!=(const VersionID& other)
50 return version != other.version;
52 bool operator<(const VersionID& other)
54 return version < other.version;
56 bool operator<=(const VersionID& other)
58 return version <= other.version;
60 bool operator>(const VersionID& other)
62 return version > other.version;
64 bool operator>=(const VersionID& other)
66 return version >= other.version;
72 #endif // REALM_VERSION_ID_HPP