source: trunk/symbol_table/src/symbol_table.hpp @ 2029

Last change on this file since 2029 was 2029, checked in by ksherdy, 7 years ago

Code clean up.

File size: 2.6 KB
Line 
1/*
2 * Created on: 18-December-2011
3 * Author: Ken Herdy
4 *
5 * Segment-at-a-time symbol table.
6 *
7 */
8#ifndef SYMBOL_TABLE_HPP
9#define SYMBOL_TABLE_HPP
10
11#include "../lib/bitblock.hpp"
12#include "../lib/byte_pool.hpp"
13#include "gid.hpp"
14#include "hash_table.hpp"
15
16#include <vector>
17#include <iostream>
18using namespace std;
19
20///////////////////////////////////////////////////////////////////////////
21// Symbol Type - Array gids.
22///////////////////////////////////////////////////////////////////////////
23
24class Symbol {
25public:
26    Symbol (uint32_t n) {
27                        init(n);
28    }
29
30    void init(uint32_t n) {
31                        gids.reserve(n);
32                        //gids_idx.reserve((n/BLOCK_SIZE) + 1);
33    }
34
35    vector<gid_type> gids;
36    //vector<BitBlock> gids_idx;   // gids index
37};
38
39template <class SYMBOL> class symbol_table{
40public:
41    void resolve(uint8_t buffer [], Groups groups [],  BitBlock starts [], BitBlock ends_gte_17 [],
42                 BitBlock h0 [], BitBlock h1 [], uint32_t blocks, SYMBOL & symbols /*, const uint32_t symbols*/);
43
44    IDISA_ALWAYS_INLINE uint8_t * get_raw_data(uint32_t idx) const { return gid_data.get_raw_bytes(idx); }
45    IDISA_ALWAYS_INLINE uint32_t get_lgth(uint32_t idx) const { return gid_data.get_bytes_lgth(idx); }
46
47protected:
48    symbol_table() {}
49    ~symbol_table() {}
50
51    GIDFactory gid_factory;     
52                GIDData gid_data;               
53};
54
55template<class SYMBOL, class HASH_TABLE>
56void do_block(uint32_t blk_offset,
57              HASH_TABLE & h_table,
58              BitBlock ends,
59              uint8_t buffer [], const uint32_t lgth,
60              uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
61              SYMBOL & symbols, GIDFactory & gid_factory, GIDData & gid_data);
62
63template<class SYMBOL, class HASH_TABLE>
64void do_block(uint32_t blk_offset,
65              HASH_TABLE & h_table,
66              BitBlock starts [], BitBlock ends [],
67              uint8_t buffer [],
68              uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
69              SYMBOL & symbols, GIDFactory & gid_factory, GIDData & gid_data);
70
71#endif // SYMBOL_TABLE_HPP
72
73/*
74template<class SYMBOL, class ALLOCATOR>
75class div2: public symbol_table_strategy<SYMBOL, ALLOCATOR> {
76
77public:
78    div2() {}
79    ~div2() {}
80
81    void resolve(...) {
82        cout << "div2 Strategy" << endl;
83    }
84    //void resolve(uint8_t * segment, uint32_t segment_blocks, BitBlock * starts, BitBlock * ends, SoA_symbol & symbols);
85};
86*/
87
88/*
89template<class SYMBOL, class ALLOCATOR>
90class log2: public symbol_table_strategy<SYMBOL, ALLOCATOR> {
91
92public:
93    log2() {}
94    ~log2() {}
95
96    void resolve(...) {
97        cout << "log2 Strategy" << endl;
98    }
99    //void resolve(uint8_t * segment, uint32_t segment_blocks, BitBlock * starts, BitBlock * ends, SoA_symbol & symbols);
100};
101*/
102
Note: See TracBrowser for help on using the repository browser.