 Timestamp:
 Apr 14, 2012, 11:21:19 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/symbol_table/src/id_symbol_table.hpp
r2028 r2030 33 33 #endif 34 34 35 // TODO  Refactor as a single mixed symbol table class composed of Id, Div2, Log2 hash tables. 35 36 template<class SYMBOL, class ALLOCATOR> 36 37 class id_symbol_table: public symbol_table<SYMBOL> { … … 77 78 } 78 79 79 // Groups & groups 80 void resolve(uint8_t buffer [], Groups groups [], BitBlock starts [], BitBlock ends_gte_17 [], 81 BitBlock h0 [], BitBlock h1 [], uint32_t blocks, SYMBOL & symbols) { 82 83 uint32_t blk_offset; 84 85 for(uint32_t blk=0;blk<blocks;blk++) { 86 87 blk_offset = blk * BLOCKSIZE; 88 /////////////////////////////////////////////////////////////////////////////// 89 // Byte Space Hash 90 /////////////////////////////////////////////////////////////////////////////// 91 if(bitblock::any(groups[blk].ends_1)) { 92 do_block<SYMBOL, hash_table <identity_strategy_t<uint8_t,1>, hash_strategy_t<1>, ALLOCATOR> > 93 (blk_offset, 94 hash_table_1, 95 groups[blk].ends_1, 96 &buffer[blk_offset], 1, /* buffer, symbol length */ 97 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(1), BLOCK_SIZE, /* h0, h1, hash lgth (bits), hash block size (bits) */ 98 symbols, this>gid_factory, this>gid_data); 99 } 100 101 if(bitblock::any(groups[blk].ends_2)) { 102 do_block<SYMBOL, hash_table <identity_strategy_t<uint16_t,2>, hash_strategy_t<2>, ALLOCATOR> > 103 (blk_offset, 104 hash_table_2, 105 groups[blk].ends_2, 106 &buffer[blk_offset], 2, 107 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(2), BLOCK_SIZE, 108 symbols, this>gid_factory, this>gid_data); 109 } 110 111 if(bitblock::any(groups[blk].ends_3)) { 112 do_block<SYMBOL, hash_table <identity_strategy_t<uint16_t,3>, hash_strategy_t<3>, ALLOCATOR> > 113 (blk_offset, 114 hash_table_3, 115 groups[blk].ends_3, 116 &buffer[blk_offset], 3, 117 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(3), BLOCK_SIZE, 118 symbols, this>gid_factory, this>gid_data); 119 } 120 if(bitblock::any(groups[blk].ends_4)) { 121 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,4>, hash_strategy_t<4>, ALLOCATOR> > 122 (blk_offset, 123 hash_table_4, 124 groups[blk].ends_4, 125 &buffer[blk_offset], 4, 126 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(4), BLOCK_SIZE, 127 symbols, this>gid_factory, this>gid_data); 128 } 129 130 if(bitblock::any(groups[blk].ends_5)) { 131 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,5>, hash_strategy_t<5>, ALLOCATOR> > 132 (blk_offset, 133 hash_table_5, 134 groups[blk].ends_5, 135 &buffer[blk_offset], 5, 136 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(5), BLOCK_SIZE, 137 symbols, this>gid_factory, this>gid_data); 138 } 139 if(bitblock::any(groups[blk].ends_6)) { 140 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,6>, hash_strategy_t<6>, ALLOCATOR> > 141 (blk_offset, 142 hash_table_6, 143 groups[blk].ends_6, 144 &buffer[blk_offset], 6, 145 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(6), BLOCK_SIZE, 146 symbols, this>gid_factory, this>gid_data); 147 } 148 if(bitblock::any(groups[blk].ends_7)) { 149 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,7>, hash_strategy_t<7>, ALLOCATOR> > 150 (blk_offset, 151 hash_table_7, 152 groups[blk].ends_7, 153 &buffer[blk_offset], 7, 154 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(7), BLOCK_SIZE, 155 symbols, this>gid_factory, this>gid_data); 156 } 157 158 /////////////////////////////////////////////////////////////////////////////// 159 // Bit Space Hash 160 /////////////////////////////////////////////////////////////////////////////// 161 if(bitblock::any(groups[blk].ends_8)) { 162 do_block<SYMBOL, hash_table <identity_strategy_t<uint64_t,8>, hash_strategy_d, ALLOCATOR> > 163 (blk_offset, 164 hash_table_8, 165 groups[blk].ends_8, &buffer[blk_offset], 8, 166 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 8, BLOCK_SIZE/8, 167 symbols, this>gid_factory, this>gid_data); 168 } 169 if(bitblock::any(groups[blk].ends_9)) { 170 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,9>, hash_strategy_d, ALLOCATOR> > 171 (blk_offset, 172 hash_table_9, 173 groups[blk].ends_9, &buffer[blk_offset], 9, 174 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 9, BLOCK_SIZE/8, 175 symbols, this>gid_factory, this>gid_data); 176 } 177 178 if(bitblock::any(groups[blk].ends_10)) { 179 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,10>, hash_strategy_d, ALLOCATOR> > 180 (blk_offset, 181 hash_table_10, 182 groups[blk].ends_10, &buffer[blk_offset], 10, 183 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 10, BLOCK_SIZE/8, 184 symbols, this>gid_factory, this>gid_data); 185 } 186 if(bitblock::any(groups[blk].ends_11)) { 187 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,11>, hash_strategy_d, ALLOCATOR> > 188 (blk_offset, 189 hash_table_11, 190 groups[blk].ends_11, &buffer[blk_offset], 11, 191 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 11, BLOCK_SIZE/8, 192 symbols, this>gid_factory, this>gid_data); 193 } 194 if(bitblock::any(groups[blk].ends_12)) { 195 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,12>, hash_strategy_d, ALLOCATOR> > 196 (blk_offset, 197 hash_table_12, 198 groups[blk].ends_12, &buffer[blk_offset], 12, 199 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 12, BLOCK_SIZE/8, 200 symbols, this>gid_factory, this>gid_data); 201 } 202 if(bitblock::any(groups[blk].ends_13)) { 203 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,13>, hash_strategy_d, ALLOCATOR> > 204 (blk_offset, 205 hash_table_13, 206 groups[blk].ends_13, &buffer[blk_offset], 13, 207 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 13, BLOCK_SIZE/8, 208 symbols, this>gid_factory, this>gid_data); 209 } 210 if(bitblock::any(groups[blk].ends_14)) { 211 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,14>, hash_strategy_d, ALLOCATOR> > 212 (blk_offset, 213 hash_table_14, 214 groups[blk].ends_14, &buffer[blk_offset], 14, 215 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 14, BLOCK_SIZE/8, 216 symbols, this>gid_factory, this>gid_data); 217 } 218 if(bitblock::any(groups[blk].ends_15)) { 219 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,15>, hash_strategy_d, ALLOCATOR> > 220 (blk_offset, 221 hash_table_15, 222 groups[blk].ends_15, &buffer[blk_offset], 15, 223 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 15, BLOCK_SIZE/8, 224 symbols, this>gid_factory, this>gid_data); 225 } 226 if(bitblock::any(groups[blk].ends_16)) { 227 do_block<SYMBOL, hash_table<identity_strategy_t<BitBlock,16>, hash_strategy_d, ALLOCATOR> > 228 (blk_offset, 229 hash_table_16, 230 groups[blk].ends_16, &buffer[blk_offset], 16, 231 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 16, BLOCK_SIZE/8, 232 symbols, this>gid_factory, this>gid_data); 233 } 234 235 if(bitblock::any(groups[blk].ends_gte_17)) { 236 do_block<SYMBOL, hash_table<identity_strategy_d, hash_strategy_d, ALLOCATOR> > 237 (blk_offset, 238 hash_table_gte_17, 239 &starts[blk], &ends_gte_17[blk], 240 &buffer[blk_offset], 241 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 17, BLOCK_SIZE/8, 242 symbols, this>gid_factory, this>gid_data); 243 } 244 245 } 80 // Groups & groups 81 void resolve(uint8_t buffer [], Groups groups [], BitBlock starts [], BitBlock ends_gte_17 [], 82 BitBlock h0 [], BitBlock h1 [], uint32_t blocks, SYMBOL & symbols) { 83 84 uint32_t blk_offset; 85 86 for(uint32_t blk=0;blk<blocks;blk++) { 87 88 blk_offset = blk * BLOCKSIZE; 89 /////////////////////////////////////////////////////////////////////////////// 90 // Byte Space Hash 91 /////////////////////////////////////////////////////////////////////////////// 92 if(bitblock::any(groups[blk].ends_1)) { 93 do_block<SYMBOL, hash_table <identity_strategy_t<uint8_t,1>, hash_strategy_t<1>, ALLOCATOR> > 94 (blk_offset, 95 hash_table_1, 96 groups[blk].ends_1, 97 &buffer[blk_offset], 1, /* buffer, symbol length */ 98 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(1), BLOCK_SIZE, /* h0, h1, hash lgth (bits), hash block size (bits) */ 99 symbols, this>gid_factory, this>gid_data); 100 } 101 if(bitblock::any(groups[blk].ends_2)) { 102 do_block<SYMBOL, hash_table <identity_strategy_t<uint16_t,2>, hash_strategy_t<2>, ALLOCATOR> > 103 (blk_offset, 104 hash_table_2, 105 groups[blk].ends_2, 106 &buffer[blk_offset], 2, 107 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(2), BLOCK_SIZE, 108 symbols, this>gid_factory, this>gid_data); 109 } 110 if(bitblock::any(groups[blk].ends_3)) { 111 do_block<SYMBOL, hash_table <identity_strategy_t<uint16_t,3>, hash_strategy_t<3>, ALLOCATOR> > 112 (blk_offset, 113 hash_table_3, 114 groups[blk].ends_3, 115 &buffer[blk_offset], 3, 116 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(3), BLOCK_SIZE, 117 symbols, this>gid_factory, this>gid_data); 118 } 119 if(bitblock::any(groups[blk].ends_4)) { 120 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,4>, hash_strategy_t<4>, ALLOCATOR> > 121 (blk_offset, 122 hash_table_4, 123 groups[blk].ends_4, 124 &buffer[blk_offset], 4, 125 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(4), BLOCK_SIZE, 126 symbols, this>gid_factory, this>gid_data); 127 } 128 if(bitblock::any(groups[blk].ends_5)) { 129 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,5>, hash_strategy_t<5>, ALLOCATOR> > 130 (blk_offset, 131 hash_table_5, 132 groups[blk].ends_5, 133 &buffer[blk_offset], 5, 134 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(5), BLOCK_SIZE, 135 symbols, this>gid_factory, this>gid_data); 136 } 137 if(bitblock::any(groups[blk].ends_6)) { 138 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,6>, hash_strategy_t<6>, ALLOCATOR> > 139 (blk_offset, 140 hash_table_6, 141 groups[blk].ends_6, 142 &buffer[blk_offset], 6, 143 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(6), BLOCK_SIZE, 144 symbols, this>gid_factory, this>gid_data); 145 } 146 if(bitblock::any(groups[blk].ends_7)) { 147 do_block<SYMBOL, hash_table <identity_strategy_t<uint32_t,7>, hash_strategy_t<7>, ALLOCATOR> > 148 (blk_offset, 149 hash_table_7, 150 groups[blk].ends_7, 151 &buffer[blk_offset], 7, 152 &buffer[blk_offset], &buffer[blk_offset], bytes2bits(7), BLOCK_SIZE, 153 symbols, this>gid_factory, this>gid_data); 154 } 155 /////////////////////////////////////////////////////////////////////////////// 156 // Bit Space Hash 157 /////////////////////////////////////////////////////////////////////////////// 158 if(bitblock::any(groups[blk].ends_8)) { 159 do_block<SYMBOL, hash_table <identity_strategy_t<uint64_t,8>, hash_strategy_d, ALLOCATOR> > 160 (blk_offset, 161 hash_table_8, 162 groups[blk].ends_8, &buffer[blk_offset], 8, 163 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 8, BLOCK_SIZE/8, 164 symbols, this>gid_factory, this>gid_data); 165 } 166 if(bitblock::any(groups[blk].ends_9)) { 167 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,9>, hash_strategy_d, ALLOCATOR> > 168 (blk_offset, 169 hash_table_9, 170 groups[blk].ends_9, &buffer[blk_offset], 9, 171 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 9, BLOCK_SIZE/8, 172 symbols, this>gid_factory, this>gid_data); 173 } 174 if(bitblock::any(groups[blk].ends_10)) { 175 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,10>, hash_strategy_d, ALLOCATOR> > 176 (blk_offset, 177 hash_table_10, 178 groups[blk].ends_10, &buffer[blk_offset], 10, 179 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 10, BLOCK_SIZE/8, 180 symbols, this>gid_factory, this>gid_data); 181 } 182 if(bitblock::any(groups[blk].ends_11)) { 183 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,11>, hash_strategy_d, ALLOCATOR> > 184 (blk_offset, 185 hash_table_11, 186 groups[blk].ends_11, &buffer[blk_offset], 11, 187 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 11, BLOCK_SIZE/8, 188 symbols, this>gid_factory, this>gid_data); 189 } 190 if(bitblock::any(groups[blk].ends_12)) { 191 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,12>, hash_strategy_d, ALLOCATOR> > 192 (blk_offset, 193 hash_table_12, 194 groups[blk].ends_12, &buffer[blk_offset], 12, 195 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 12, BLOCK_SIZE/8, 196 symbols, this>gid_factory, this>gid_data); 197 } 198 if(bitblock::any(groups[blk].ends_13)) { 199 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,13>, hash_strategy_d, ALLOCATOR> > 200 (blk_offset, 201 hash_table_13, 202 groups[blk].ends_13, &buffer[blk_offset], 13, 203 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 13, BLOCK_SIZE/8, 204 symbols, this>gid_factory, this>gid_data); 205 } 206 if(bitblock::any(groups[blk].ends_14)) { 207 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,14>, hash_strategy_d, ALLOCATOR> > 208 (blk_offset, 209 hash_table_14, 210 groups[blk].ends_14, &buffer[blk_offset], 14, 211 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 14, BLOCK_SIZE/8, 212 symbols, this>gid_factory, this>gid_data); 213 } 214 if(bitblock::any(groups[blk].ends_15)) { 215 do_block<SYMBOL, hash_table<identity_strategy_t<uint64_t,15>, hash_strategy_d, ALLOCATOR> > 216 (blk_offset, 217 hash_table_15, 218 groups[blk].ends_15, &buffer[blk_offset], 15, 219 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 15, BLOCK_SIZE/8, 220 symbols, this>gid_factory, this>gid_data); 221 } 222 if(bitblock::any(groups[blk].ends_16)) { 223 do_block<SYMBOL, hash_table<identity_strategy_t<BitBlock,16>, hash_strategy_d, ALLOCATOR> > 224 (blk_offset, 225 hash_table_16, 226 groups[blk].ends_16, &buffer[blk_offset], 16, 227 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 16, BLOCK_SIZE/8, 228 symbols, this>gid_factory, this>gid_data); 229 } 230 if(bitblock::any(groups[blk].ends_gte_17)) { 231 do_block<SYMBOL, hash_table<identity_strategy_d, hash_strategy_d, ALLOCATOR> > 232 (blk_offset, 233 hash_table_gte_17, 234 &starts[blk], &ends_gte_17[blk], 235 &buffer[blk_offset], 236 (uint8_t *)&h0[blk], (uint8_t *)&h1[blk], 17, BLOCK_SIZE/8, 237 symbols, this>gid_factory, this>gid_data); 238 } 239 } 246 240 } 247 241
Note: See TracChangeset
for help on using the changeset viewer.