0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Hypertable::BlobHashSet< TraitsT > Class Template Reference

A HashSet for storing and looking up blobs efficiently. More...

#include <BlobHashSet.h>

Inheritance diagram for Hypertable::BlobHashSet< TraitsT >:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::BlobHashSet< TraitsT >:
Collaboration graph
[legend]

Public Types

typedef Base::iterator iterator
 
typedef Base::key_type key_type
 
typedef Base::value_type value_type
 
typedef TraitsT::key_allocator key_allocator
 
typedef std::pair< iterator, bool > InsRet
 

Public Member Functions

 BlobHashSet ()
 Constructor creates an empty set. More...
 
 BlobHashSet (size_t n_buckets)
 Overloaded Constructor creates an empty set with a specified number of buckets. More...
 
InsRet insert (const void *buf, size_t len)
 Inserts a new Blob into the set. More...
 
InsRet insert (const String &s)
 Insert function for a String object. More...
 
InsRet insert (const Blob &blob)
 Insert function for a Blob object. More...
 
iterator find (const Blob &blob)
 Looks up the blob and returns an iterator to it. More...
 
iterator find (const String &s)
 Find function for String objects. More...
 
key_allocatorkey_alloc ()
 Returns the allocator; used for testing. More...
 

Private Types

typedef std::unordered_set
< Blob, typename
TraitsT::hasher, typename
TraitsT::key_equal > 
Base
 

Private Member Functions

InsRet insert_blob (size_t len, InsRet rv)
 Helper function to insert a blob; if the blob already exists then a duplicate blob is created and inserted. More...
 

Private Attributes

key_allocator m_alloc
 The key_allocator - i.e. More...
 

Detailed Description

template<class TraitsT = BlobHashTraits<>>
class Hypertable::BlobHashSet< TraitsT >

A HashSet for storing and looking up blobs efficiently.

A Blob is a simple structure with { void *, size_t } (see BlobHashTraits.h).

Definition at line 44 of file BlobHashSet.h.

Member Typedef Documentation

template<class TraitsT = BlobHashTraits<>>
typedef std::unordered_set<Blob, typename TraitsT::hasher, typename TraitsT::key_equal> Hypertable::BlobHashSet< TraitsT >::Base
private

Definition at line 48 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
typedef std::pair<iterator, bool> Hypertable::BlobHashSet< TraitsT >::InsRet

Definition at line 55 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
typedef Base::iterator Hypertable::BlobHashSet< TraitsT >::iterator

Definition at line 51 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
typedef TraitsT::key_allocator Hypertable::BlobHashSet< TraitsT >::key_allocator

Definition at line 54 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
typedef Base::key_type Hypertable::BlobHashSet< TraitsT >::key_type

Definition at line 52 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
typedef Base::value_type Hypertable::BlobHashSet< TraitsT >::value_type

Definition at line 53 of file BlobHashSet.h.

Constructor & Destructor Documentation

template<class TraitsT = BlobHashTraits<>>
Hypertable::BlobHashSet< TraitsT >::BlobHashSet ( )
inline

Constructor creates an empty set.

Definition at line 58 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
Hypertable::BlobHashSet< TraitsT >::BlobHashSet ( size_t  n_buckets)
inline

Overloaded Constructor creates an empty set with a specified number of buckets.

Parameters
n_bucketsNumber of buckets in the hash table

Definition at line 65 of file BlobHashSet.h.

Member Function Documentation

template<class TraitsT = BlobHashTraits<>>
iterator Hypertable::BlobHashSet< TraitsT >::find ( const Blob blob)
inline

Looks up the blob and returns an iterator to it.

Hides all find methods in the base class.

Parameters
blobReference to the blob to find
Returns
Iterator to the found blob, or end() if the blob was not found

Definition at line 105 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
iterator Hypertable::BlobHashSet< TraitsT >::find ( const String s)
inline

Find function for String objects.

Parameters
sReference to the string to find
Returns
Iterator to the found blob, or end() if the blob was not found

Definition at line 112 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
InsRet Hypertable::BlobHashSet< TraitsT >::insert ( const void *  buf,
size_t  len 
)
inline

Inserts a new Blob into the set.

Hides all insert methods in the base class.

Parameters
bufPointer to the blob's data
lenSize of the blob
Returns
An InsRet pair with an iterator to the new blob and a flag whether the blob already existed in the set

Definition at line 75 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
InsRet Hypertable::BlobHashSet< TraitsT >::insert ( const String s)
inline

Insert function for a String object.

Parameters
sReference to the String which is inserted
Returns
An InsRet pair with an iterator to the new blob and a flag whether the blob already existed in the set

Definition at line 85 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
InsRet Hypertable::BlobHashSet< TraitsT >::insert ( const Blob blob)
inline

Insert function for a Blob object.

Parameters
blobReference to the blob which is inserted
Returns
An InsRet pair with an iterator to the new blob and a flag whether the blob already existed in the set

Definition at line 95 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
InsRet Hypertable::BlobHashSet< TraitsT >::insert_blob ( size_t  len,
InsRet  rv 
)
inlineprivate

Helper function to insert a blob; if the blob already exists then a duplicate blob is created and inserted.

Parameters
lenThe length of the blob which was inserted
rvThe InsRet pair, which is the result of the actual insert operation.
Returns
A copy of the rv parameter is returned.

Definition at line 134 of file BlobHashSet.h.

template<class TraitsT = BlobHashTraits<>>
key_allocator& Hypertable::BlobHashSet< TraitsT >::key_alloc ( )
inline

Returns the allocator; used for testing.

Returns
The key_allocator object

Definition at line 120 of file BlobHashSet.h.

Member Data Documentation

template<class TraitsT = BlobHashTraits<>>
key_allocator Hypertable::BlobHashSet< TraitsT >::m_alloc
private

The key_allocator - i.e.

a CharArena instance

Definition at line 124 of file BlobHashSet.h.


The documentation for this class was generated from the following file: