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

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

Added scanner move_to logic for non-boundary case arbitrary length symbols.

File size: 2.9 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 "hash_table.hpp"
14
15#include <vector>
16#include <iostream>
17using namespace std;
18
19typedef uint32_t gid_type;
20
21///////////////////////////////////////////////////////////////////////////
22// Symbol Type - Array of gid_type
23///////////////////////////////////////////////////////////////////////////
24
25class Symbol {
26public:
27    Symbol (uint32_t n) {
28        init(n);
29    }
30
31    void init(uint32_t n) {
32        gids.reserve(n);
33        //gids_idx.reserve((n/BLOCK_SIZE) + 1);
34    }
35
36    vector<gid_type> gids;
37    //vector<BitBlock> gids_idx;   // gids index
38};
39
40///////////////////////////////////////////////////////////////////////////
41// GID indexed POD array
42///////////////////////////////////////////////////////////////////////////
43
44template <class SYMBOL> class symbol_table{
45public:
46    void resolve(uint8_t buffer [], Groups groups [],  BitBlock starts [], BitBlock ends_gte_17 [],
47                 BitBlock h0 [], BitBlock h1 [], uint32_t blocks, SYMBOL & symbols /*, const uint32_t symbols*/);
48
49    //void resolve(uint8_t buffer [], Groups groups [],  BitBlock starts [], BitBlock ends_gte_17 [],
50    //           BitBlock h0 [], BitBlock h1 [], uint32_t blocks, SoA_symbol & soa/*, const uint32_t symbols*/);
51
52    IDISA_ALWAYS_INLINE uint8_t * get_raw_data(uint32_t idx) const { return gid_data::get_raw_bytes(idx); }
53    IDISA_ALWAYS_INLINE uint32_t get_lgth(uint32_t idx) const { return gid_data::get_bytes_lgth(idx); }
54
55protected:
56    symbol_table() {}
57    ~symbol_table() {}
58
59};
60
61template<class SYMBOL, class HASH_TABLE>
62void do_block(uint32_t blk_offset,
63                                  HASH_TABLE & h_table,
64                                  BitBlock ends,
65                                  uint8_t buffer [], const uint32_t lgth,
66                                  uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
67                                  SYMBOL & symbols);
68
69template<class SYMBOL, class HASH_TABLE>
70void do_block(uint32_t blk_offset,
71                                  HASH_TABLE & h_table,
72                                  BitBlock starts [], BitBlock ends [],
73                                  uint8_t buffer [],
74                                  uint8_t h0 [], uint8_t h1 [], const uint32_t h_lgth, const uint32_t h_block_size,
75                                  SYMBOL & symbols);
76
77#endif // SYMBOL_TABLE_HPP
78
79/*
80template<class SYMBOL, class ALLOCATOR>
81class div2: public symbol_table_strategy<SYMBOL, ALLOCATOR> {
82
83public:
84    div2() {}
85    ~div2() {}
86
87    void resolve(...) {
88        cout << "div2 Strategy" << endl;
89    }
90    //void resolve(uint8_t * segment, uint32_t segment_blocks, BitBlock * starts, BitBlock * ends, SoA_symbol & symbols);
91};
92*/
93
94/*
95template<class SYMBOL, class ALLOCATOR>
96class log2: public symbol_table_strategy<SYMBOL, ALLOCATOR> {
97
98public:
99    log2() {}
100    ~log2() {}
101
102    void resolve(...) {
103        cout << "log2 Strategy" << endl;
104    }
105    //void resolve(uint8_t * segment, uint32_t segment_blocks, BitBlock * starts, BitBlock * ends, SoA_symbol & symbols);
106};
107*/
108
Note: See TracBrowser for help on using the repository browser.