1 | /******************************************************************** |
2 | * Copyright (c) 2013 - 2014, Pivotal Inc. |
3 | * All rights reserved. |
4 | * |
5 | * Author: Zhanwei Wang |
6 | ********************************************************************/ |
7 | /******************************************************************** |
8 | * 2014 - |
9 | * open source under Apache License Version 2.0 |
10 | ********************************************************************/ |
11 | /** |
12 | * Licensed to the Apache Software Foundation (ASF) under one |
13 | * or more contributor license agreements. See the NOTICE file |
14 | * distributed with this work for additional information |
15 | * regarding copyright ownership. The ASF licenses this file |
16 | * to you under the Apache License, Version 2.0 (the |
17 | * "License"); you may not use this file except in compliance |
18 | * with the License. You may obtain a copy of the License at |
19 | * |
20 | * http://www.apache.org/licenses/LICENSE-2.0 |
21 | * |
22 | * Unless required by applicable law or agreed to in writing, software |
23 | * distributed under the License is distributed on an "AS IS" BASIS, |
24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
25 | * See the License for the specific language governing permissions and |
26 | * limitations under the License. |
27 | */ |
28 | #include "Hash.h" |
29 | |
30 | #ifdef NEED_BOOST |
31 | |
32 | #include <boost/functional/hash.hpp> |
33 | |
34 | namespace Hdfs { |
35 | namespace Internal { |
36 | |
37 | /** |
38 | * A hash function object used to hash a boolean value. |
39 | */ |
40 | boost::hash<bool> BoolHasher; |
41 | |
42 | /** |
43 | * A hash function object used to hash an int value. |
44 | */ |
45 | boost::hash<int> Int32Hasher; |
46 | |
47 | /** |
48 | * A hash function object used to hash an 64 bit int value. |
49 | */ |
50 | boost::hash<int64_t> Int64Hasher; |
51 | |
52 | /** |
53 | * A hash function object used to hash a size_t value. |
54 | */ |
55 | boost::hash<size_t> SizeHasher; |
56 | |
57 | /** |
58 | * A hash function object used to hash a std::string object. |
59 | */ |
60 | boost::hash<std::string> StringHasher; |
61 | } |
62 | } |
63 | |
64 | #else |
65 | |
66 | #include <functional> |
67 | |
68 | namespace Hdfs { |
69 | namespace Internal { |
70 | |
71 | /** |
72 | * A hash function object used to hash a boolean value. |
73 | */ |
74 | std::hash<bool> BoolHasher; |
75 | |
76 | /** |
77 | * A hash function object used to hash an int value. |
78 | */ |
79 | std::hash<int> Int32Hasher; |
80 | |
81 | /** |
82 | * A hash function object used to hash an 64 bit int value. |
83 | */ |
84 | std::hash<int64_t> Int64Hasher; |
85 | |
86 | /** |
87 | * A hash function object used to hash a size_t value. |
88 | */ |
89 | std::hash<size_t> SizeHasher; |
90 | |
91 | /** |
92 | * A hash function object used to hash a std::string object. |
93 | */ |
94 | std::hash<std::string> StringHasher; |
95 | |
96 | } |
97 | } |
98 | |
99 | #endif |
100 | |