source: trunk/symbol_table/src/gid.hpp @ 2092

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

Refactored id,div2,log2. All tests pass.

File size: 958 bytes
Line 
1#ifndef GID_HPP
2#define GID_HPP
3
4#include "../lib/bitblock.hpp"
5#include <vector>
6using namespace std;
7
8typedef uint32_t gid_type;
9
10class GIDFactory {
11public:
12    GIDFactory():value(0) {}
13    IDISA_ALWAYS_INLINE uint64_t next() { return value++; }
14private:
15    uint64_t value;
16};
17
18class GIDData {
19public:
20
21    GIDData() {}
22
23    IDISA_ALWAYS_INLINE void add_data(uint8_t * raw_bytes, uint32_t raw_bytes_lgth) {
24        data next;
25        next.raw_bytes = raw_bytes;
26        next.raw_bytes_lgth = raw_bytes_lgth;
27        values.push_back(next);
28    }
29
30    IDISA_ALWAYS_INLINE size_t max() const { return values.size(); }
31
32    IDISA_ALWAYS_INLINE uint8_t * get_raw_bytes(size_t idx) const {
33        return values.at(idx).raw_bytes;
34    }
35
36    IDISA_ALWAYS_INLINE uint32_t get_bytes_lgth(size_t idx) const {
37        return values.at(idx).raw_bytes_lgth;
38    }
39
40private:
41    typedef struct data {
42        uint8_t * raw_bytes;
43        uint32_t raw_bytes_lgth;
44    } data;
45
46    vector<data> values;
47};
48
49#endif // GID_HPP
Note: See TracBrowser for help on using the repository browser.