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::CstrHashMap< DataT, TraitsT > Class Template Reference

A hash map for storing and lookup char * strings efficiently. More...

#include <CstrHashMap.h>

Inheritance diagram for Hypertable::CstrHashMap< DataT, TraitsT >:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::CstrHashMap< DataT, 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

 CstrHashMap ()
 Default constructor creates an empty map. More...
 
 CstrHashMap (size_t n_buckets)
 Overloaded Constructor creates an empty map with a specified number of buckets. More...
 
InsRet insert (const char *key, const DataT &data)
 Inserts a new string/data pair in the map. More...
 
key_allocatorkey_alloc ()
 Returns the key allocator; required for testing. More...
 
void clear ()
 Clears the map and deletes all elements. More...
 

Private Types

typedef std::unordered_map
< const char *, DataT,
typename TraitsT::hasher,
typename TraitsT::key_equal > 
Base
 

Private Member Functions

InsRet insert_key (const char *key, InsRet rv)
 Helper function to insert a string; if the string already exists then a duplicate of the string is created and inserted. More...
 

Private Attributes

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

Detailed Description

template<typename DataT, class TraitsT = CstrHashTraits<>>
class Hypertable::CstrHashMap< DataT, TraitsT >

A hash map for storing and lookup char * strings efficiently.

The keys are case-independent.

Definition at line 44 of file CstrHashMap.h.

Member Typedef Documentation

template<typename DataT , class TraitsT = CstrHashTraits<>>
typedef std::unordered_map<const char *, DataT, typename TraitsT::hasher, typename TraitsT::key_equal> Hypertable::CstrHashMap< DataT, TraitsT >::Base
private

Definition at line 49 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
typedef std::pair<iterator, bool> Hypertable::CstrHashMap< DataT, TraitsT >::InsRet

Definition at line 55 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
typedef Base::iterator Hypertable::CstrHashMap< DataT, TraitsT >::iterator

Definition at line 51 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
typedef TraitsT::key_allocator Hypertable::CstrHashMap< DataT, TraitsT >::key_allocator

Definition at line 54 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
typedef Base::key_type Hypertable::CstrHashMap< DataT, TraitsT >::key_type

Definition at line 52 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
typedef Base::value_type Hypertable::CstrHashMap< DataT, TraitsT >::value_type

Definition at line 53 of file CstrHashMap.h.

Constructor & Destructor Documentation

template<typename DataT , class TraitsT = CstrHashTraits<>>
Hypertable::CstrHashMap< DataT, TraitsT >::CstrHashMap ( )
inline

Default constructor creates an empty map.

Definition at line 59 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
Hypertable::CstrHashMap< DataT, TraitsT >::CstrHashMap ( size_t  n_buckets)
inline

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

Parameters
n_bucketsNumber of buckets in the hash map

Definition at line 66 of file CstrHashMap.h.

Member Function Documentation

template<typename DataT , class TraitsT = CstrHashTraits<>>
void Hypertable::CstrHashMap< DataT, TraitsT >::clear ( )
inline

Clears the map and deletes all elements.

Definition at line 87 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
InsRet Hypertable::CstrHashMap< DataT, TraitsT >::insert ( const char *  key,
const DataT &  data 
)
inline

Inserts a new string/data pair in the map.

Hides all insert methods in the base class.

Parameters
keyThe key of the key/data pair
dataReference to the data type of the key/data pair
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 76 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
InsRet Hypertable::CstrHashMap< DataT, TraitsT >::insert_key ( const char *  key,
InsRet  rv 
)
inlineprivate

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

Parameters
keyThe inserted key of the object
rvThe InsRet pair, which is the result of the actual insert operation.
Returns
A copy of the rv parameter is returned.

Definition at line 101 of file CstrHashMap.h.

template<typename DataT , class TraitsT = CstrHashTraits<>>
key_allocator& Hypertable::CstrHashMap< DataT, TraitsT >::key_alloc ( )
inline

Returns the key allocator; required for testing.

Returns
The key_allocator object

Definition at line 84 of file CstrHashMap.h.

Member Data Documentation

template<typename DataT , class TraitsT = CstrHashTraits<>>
key_allocator Hypertable::CstrHashMap< DataT, TraitsT >::m_alloc
private

The key_allocator - i.e.

a CharArena instance

Definition at line 91 of file CstrHashMap.h.


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