aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/listhash.cpp0
-rw-r--r--src/listhash.h47
2 files changed, 47 insertions, 0 deletions
diff --git a/src/listhash.cpp b/src/listhash.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/listhash.cpp
diff --git a/src/listhash.h b/src/listhash.h
new file mode 100644
index 0000000..73aa3f8
--- /dev/null
+++ b/src/listhash.h
@@ -0,0 +1,47 @@
1#ifndef BU_LIST_HASH_H
2#define BU_LIST_HASH_H
3
4#include "bu/hash.h"
5#include "bu/list.h"
6
7namespace Bu
8{
9 template<typename key, typename value, typename sizecalc = __calcNextTSize_fast, typename keyalloc = std::allocator<key>, typename valuealloc = std::allocator<Bu::List<value> >, typename challoc = std::allocator<uint32_t> >
10 class ListHash : public Hash<key, Bu::List<value>, sizecalc, keyalloc, valuealloc, challoc>
11 {
12 typedef Hash<key, Bu::List<value>, sizecalc, keyalloc, valuealloc, challoc> ParentType;
13 public:
14 ListHash()
15 {
16 }
17
18 ListHash( const ListHash &src ) :
19 ParentType( src )
20 {
21 }
22
23 virtual ~ListHash()
24 {
25 }
26
27 ListHash &operator=( const ListHash &src )
28 {
29 *dynamic_cast<ParentType *>(this) =
30 dynamic_cast<ParentType &>(src);
31 }
32
33 virtual void insert( const key &k, const value &v )
34 {
35 if( !has( k ) )
36 {
37 ParentType::insert( k, List<value>() );
38 }
39 get( k ).append( v );
40 }
41
42 private:
43 };
44
45};
46
47#endif