Changeset 2080 for trunk


Ignore:
Timestamp:
May 8, 2012, 12:05:50 PM (7 years ago)
Author:
ksherdy
Message:

Add.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/src/hash_table.hpp

    r2069 r2080  
    4646} node;
    4747
    48 template<uint32_t LGTH, class COMPARE_STRATEGY, class HASH_STRATEGY, class ALLOCATOR>
     48template<uint32_t LGTH, int GROUP_STRATEGY, class ALLOCATOR>
    4949class hash_table {
    5050
    5151public:
    52 
    5352    hash_table(const uint32_t table_size=1024, const uint32_t resize_chain_lgth=2) {
    5453        #ifdef HASH_TABLE_HPP_DEBUG
     
    276275    node ** table;
    277276    byte_pool<ALLOCATOR> raw_data_pool;
    278     COMPARE_STRATEGY compare_strategy;
    279     HASH_STRATEGY hash_strategy;
     277    compare_strategy_t<LGTH> compare_strategy;
     278    hash_strategy_t<LGTH,GROUP_STRATEGY> hash_strategy;
    280279
    281280    ///////////////////////////////////////////////////////////////////////////
     
    354353// id - Identity Strategy
    355354///////////////////////////////////////////////////////////////////////////
    356 template<uint32_t LGTH, class COMPARE_STRATEGY, class HASH_STRATEGY, class ALLOCATOR>
    357 class id_hash_table : public hash_table<LGTH, COMPARE_STRATEGY, HASH_STRATEGY, ALLOCATOR> {};
     355template<uint32_t LGTH, int GROUP_STRATEGY, class ALLOCATOR>
     356class id_hash_table : public hash_table<LGTH, GROUP_STRATEGY, ALLOCATOR> {};
    358357
    359358///////////////////////////////////////////////////////////////////////////
     
    375374}
    376375
    377 
    378 template<uint32_t LGTH, class COMPARE_STRATEGY, class HASH_STRATEGY, class ALLOCATOR>
    379 class div2_hash_table : public hash_table<LGTH, COMPARE_STRATEGY, HASH_STRATEGY, ALLOCATOR> {
     376template<uint32_t LGTH, int GROUP_STRATEGY, class ALLOCATOR>
     377class div2_hash_table : public hash_table<LGTH, GROUP_STRATEGY, ALLOCATOR> {
    380378
    381379public:
     
    425423                // Odd
    426424                ///////////////////////////////////////////////////////////////////////////
    427                 if(this->hash_table_odd.lookup(bucket, raw_bytes, idx, lgth-1, h0, h1, gid)) {
     425                bucket = this->hash_table_odd.get_bucket(h0,h1,idx);
     426                lgth = lgth - 1;
     427
     428                if(this->hash_table_odd.lookup(bucket, raw_bytes, idx, lgth, h0, h1, gid)) {
    428429                    return gid;
    429430                }
    430431
    431                 hash_table_odd.pool_and_insert(bucket, raw_bytes, idx, lgth-1, h0, h1, gid_factory, gid_data, gid);
     432                hash_table_odd.pool_and_insert(bucket, raw_bytes, idx, lgth, h0, h1, gid_factory, gid_data, gid);
    432433                return gid;
    433434            }
     
    441442    }
    442443
    443     id_hash_table<LGTH-1, COMPARE_STRATEGY, HASH_STRATEGY, ALLOCATOR> hash_table_odd;
     444    id_hash_table<LGTH-1, id, ALLOCATOR> hash_table_odd;
    444445};
    445446
     
    447448// log2 - Log base 2 Strategy
    448449///////////////////////////////////////////////////////////////////////////
    449 template<uint32_t LGTH, class COMPARE_STRATEGY, class HASH_STRATEGY, class ALLOCATOR>
    450 class log2_hash_table : public hash_table<LGTH, COMPARE_STRATEGY, HASH_STRATEGY, ALLOCATOR> {};
     450template<uint32_t LGTH, int GROUP_STRATEGY, class ALLOCATOR>
     451class logbase2_hash_table : public hash_table<LGTH, GROUP_STRATEGY, ALLOCATOR> {};
    451452
    452453#endif // HASH_TABLE_HPP
Note: See TracChangeset for help on using the changeset viewer.