0.9.8.10
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
home
doug
src
hypertable
src
cc
Common
BlobHashTraits.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2007-2015 Hypertable, Inc.
3
*
4
* This file is part of Hypertable.
5
*
6
* Hypertable is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 3
9
* of the License, or any later version.
10
*
11
* Hypertable is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with Hypertable. If not, see <http://www.gnu.org/licenses/>
18
*/
19
24
#ifndef HYPERTABLE_BLOB_HASH_TRAITS_H
25
#define HYPERTABLE_BLOB_HASH_TRAITS_H
26
27
#include "
PageArena.h
"
28
#include "
Common/MurmurHash.h
"
29
30
namespace
Hypertable
{
31
39
struct
Blob
{
40
Blob
(
const
void
*buf,
size_t
len) :
start
(buf),
size
(len) { }
41
42
const
void
*
start
;
43
size_t
size
;
44
};
45
51
template
<
typename
HashFunT = MurmurHash2>
52
struct
BlobHashTraits
{
53
typedef
CharArena
key_allocator
;
54
55
struct
hasher
{
56
HashFunT
hash_fun
;
57
58
size_t
operator()
(
const
Blob
&b)
const
{
59
return
hash_fun
(b.
start
, b.
size
);
60
}
61
};
62
63
struct
key_equal
{
64
bool
operator()
(
const
Blob
&x,
const
Blob
&y)
const
{
65
if
(x.
size
!= y.
size
)
66
return
false
;
67
68
return
memcmp(x.
start
, y.
start
, x.
size
) == 0;
69
}
70
};
71
};
72
75
}
// namespace Hypertable
76
77
#endif // !HYPERTABLE_BLOB_HASH_TRAITS_H
Hypertable::BlobHashTraits::key_equal
Definition:
BlobHashTraits.h:63
Hypertable::BlobHashTraits::key_equal::operator()
bool operator()(const Blob &x, const Blob &y) const
Definition:
BlobHashTraits.h:64
Hypertable::BlobHashTraits::hasher::hash_fun
HashFunT hash_fun
Definition:
BlobHashTraits.h:56
MurmurHash.h
MurmurHash2 digest routine.
PageArena.h
PageArena memory allocator.
Hypertable::Blob::Blob
Blob(const void *buf, size_t len)
Definition:
BlobHashTraits.h:40
Hypertable::Blob
A Blob structure holds a data pointer and a size.
Definition:
BlobHashTraits.h:39
Hypertable::BlobHashTraits::hasher::operator()
size_t operator()(const Blob &b) const
Definition:
BlobHashTraits.h:58
Hypertable::Blob::start
const void * start
Definition:
BlobHashTraits.h:42
Hypertable::BlobHashTraits::key_allocator
CharArena key_allocator
Definition:
BlobHashTraits.h:53
Hypertable::BlobHashTraits::hasher
Definition:
BlobHashTraits.h:55
Hypertable::PageArena
The PageArena allocator is simple and fast, avoiding individual mallocs/frees.
Definition:
PageArena.h:69
Hypertable
Hypertable definitions
Definition:
ApplicationHandler.h:36
Hypertable::BlobHashTraits
Traits for BlobHashSet Hash function default to MurmurHash2 for speed and mix.
Definition:
BlobHashTraits.h:52
Hypertable::Blob::size
size_t size
Definition:
BlobHashTraits.h:43
Generated on Tue Dec 22 2015 18:43:06 for Hypertable by
1.8.8