~ubuntu-branches/ubuntu/raring/clucene-core/raring-proposed

« back to all changes in this revision

Viewing changes to src/CLucene/util/googlesparsemap.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-08-11 09:33:38 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120811093338-fgrx41ftqew3qt6a
Tags: 2.3.3.4-1
* New upstream release (Closes: #661703).
* Convert package to multiarch.
* Drop obsolete patches:
  - 01_add_missing_include_bug505667.diff
  - 02_posixness_fix_bug530308.diff
* Add patches:
  - Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
  - Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
  - Install-contribs-lib.patch
  - multiarch.patch
* Update debian/compat: bump to 8.
* Update debian/control:
  - update build dependencies (add cmake, libboost-dev and libz-dev).
  - bump Standards-Version to 3.9.3.
  - rename packages due to ABI bump: libclucene0ldbl -> libclucene-core1.
  - add libclucene-contribs1 package.
* Update debian/rules:
  - rewrite to use CMake.
  - add multiarch support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*------------------------------------------------------------------------------
2
 
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
3
 
4
 
* Distributable under the terms of either the Apache License (Version 2.0) or 
5
 
* the GNU Lesser General Public License, as specified in the COPYING file.
6
 
------------------------------------------------------------------------------*/
7
 
//note: you may be bound by the google license if you choose
8
 
//to compile your source code with the google sparsemap library
9
 
#ifndef _lucene_util_GoogleSparseMaps_H
10
 
#define _lucene_util_GoogleSparseMaps_H
11
 
 
12
 
#if defined(_LUCENE_PRAGMA_ONCE)
13
 
# pragma once
14
 
#endif
15
 
 
16
 
#ifdef _CL_HAVE_GOOGLE_DENSE_HASH_MAP
17
 
 
18
 
#include <google/dense_hash_map>
19
 
 
20
 
CL_NS_DEF(util)
21
 
 
22
 
 
23
 
template<typename _Type, typename _Equals>
24
 
class SparseMapEquals{
25
 
        _Equals equals;
26
 
public:
27
 
        bool operator()( _Type val1, _Type val2 ) const{
28
 
           if ( val1==val2 )
29
 
              return true;
30
 
           else if ( val1 == NULL || val2 == NULL )
31
 
              return false;
32
 
           else if ( val1 == (_Type)0x02 || val2 == (_Type)0x02 )
33
 
              return false;
34
 
                return equals(val1,val2);
35
 
        }
36
 
};
37
 
 
38
 
template<typename _kt, typename _vt,
39
 
        typename _Hasher,
40
 
        typename _Equals,
41
 
        typename _KeyDeletor=CL_NS(util)::Deletor::Dummy,
42
 
        typename _ValueDeletor=CL_NS(util)::Deletor::Dummy >
43
 
class CLHashMap:public __CLMap<_kt,_vt,
44
 
        GOOGLE_NAMESPACE::dense_hash_map<_kt,_vt, _Hasher, SparseMapEquals<_kt,_Equals> >,
45
 
        _KeyDeletor,_ValueDeletor>
46
 
{
47
 
        typedef __CLMap<_kt,_vt,
48
 
                GOOGLE_NAMESPACE::dense_hash_map<_kt,_vt, _Hasher, SparseMapEquals<_kt,_Equals> >,
49
 
                _KeyDeletor,_ValueDeletor> _this;
50
 
public:
51
 
        CLHashMap ( bool deleteKey=false, bool deleteValue=false )
52
 
        {
53
 
                GOOGLE_NAMESPACE::dense_hash_map<_kt,_vt, _Hasher, SparseMapEquals<_kt,_Equals> >::set_empty_key(NULL);
54
 
                GOOGLE_NAMESPACE::dense_hash_map<_kt,_vt, _Hasher, SparseMapEquals<_kt,_Equals> >::set_deleted_key((_kt)0x02);
55
 
                _this::setDeleteKey(deleteKey);
56
 
                _this::setDeleteValue(deleteValue);
57
 
        }
58
 
        ~CLHashMap(){
59
 
 
60
 
        }
61
 
};
62
 
 
63
 
 
64
 
CL_NS_END
65
 
#endif //LUCENE_USE_GOOGLEMAPS
66
 
#endif