VMware GemFire Native C++ Reference
9.1
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
CacheableKeys.hpp
1
#pragma once
2
3
#ifndef GEODE_CACHEABLEKEYS_H_
4
#define GEODE_CACHEABLEKEYS_H_
5
6
/*
7
* Licensed to the Apache Software Foundation (ASF) under one or more
8
* contributor license agreements. See the NOTICE file distributed with
9
* this work for additional information regarding copyright ownership.
10
* The ASF licenses this file to You under the Apache License, Version 2.0
11
* (the "License"); you may not use this file except in compliance with
12
* the License. You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS,
18
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
*/
22
23
#include "geode_globals.hpp"
24
25
namespace
apache
{
26
namespace
geode
{
27
namespace
client {
28
namespace
serializer {
29
30
template
<
typename
TObj>
31
inline
bool
equals(
const
TObj& x,
const
TObj& y) {
32
return
(x == y);
33
}
34
35
inline
uint32_t hashcode(
const
bool
value) {
36
if
(value) {
37
return
1231;
38
}
else
{
39
return
1237;
40
}
41
}
42
43
inline
uint32_t hashcode(
const
uint8_t value) {
44
return
static_cast<
uint32_t
>
(value);
45
}
46
47
inline
uint32_t hashcode(
const
int8_t value) {
48
return
static_cast<
uint32_t
>
(value);
49
}
50
51
inline
uint32_t hashcode(
const
uint16_t value) {
52
return
static_cast<
uint32_t
>
(value);
53
}
54
55
inline
uint32_t hashcode(
const
int16_t value) {
56
return
static_cast<
uint32_t
>
(value);
57
}
58
59
inline
uint32_t hashcode(
const
uint32_t value) {
return
value; }
60
61
inline
uint32_t hashcode(
const
int32_t value) {
62
return
static_cast<
uint32_t
>
(value);
63
}
64
65
inline
uint32_t hashcode(
const
uint64_t value) {
66
uint32_t hash =
static_cast<
uint32_t
>
(value);
67
hash = hash ^
static_cast<
uint32_t
>
(value >> 32);
68
return
hash;
69
}
70
71
inline
uint32_t hashcode(
const
int64_t value) {
72
uint32_t hash =
static_cast<
uint32_t
>
(value);
73
hash = hash ^
static_cast<
uint32_t
>
(value >> 32);
74
return
hash;
75
}
76
77
inline
uint32_t hashcode(
const
float
value) {
78
union
float_uint32_t {
79
float
f;
80
uint32_t u;
81
} v;
82
v.f = value;
83
return
v.u;
84
}
85
86
inline
uint32_t hashcode(
const
double
value) {
87
union
double_uint64_t {
88
double
d;
89
uint64_t u;
90
} v;
91
v.d = value;
92
return
hashcode(v.u);
93
}
94
}
// namespace serializer
95
}
// namespace client
96
}
// namespace geode
97
}
// namespace apache
98
99
#endif // GEODE_CACHEABLEKEYS_H_
apache
Each enum represents a predefined RegionAttributes in a Cache.
Definition:
Assert.hpp:31
geode
This namespace contains all the Geode C++ API classes, enumerations and globals.
Pivotal GemFire C++ Cache API Documentation