Ignore:
Timestamp:
Apr 14, 2012, 6:31:40 PM (7 years ago)
Author:
ksherdy
Message:

Added GIDFactory class member. Each symbol table maintains a set of GIDs.

File:
1 edited

Legend:

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

    r2001 r2027  
    2828#include "../lib/byte_pool.hpp"
    2929#include "../lib/hash.hpp"
     30#include "gid_factory.hpp"
    3031#include <cmath>
    3132#include <stdint.h>
     
    3536#include <vector>
    3637using namespace std;
    37 
    38 typedef uint32_t gid_type;
    3938
    4039typedef struct node {
     
    4847} node;
    4948
    50 // TODO -   Single GID.
    51 //          For multiple GID sets refactor such that
    52 //          Hash Tables consult the parent Symbol Table for a per Symbol Table instance GID.
    53 class gid {
    54 public:
    55     static uint64_t next() { return value++; }
    56 private:
    57     static uint64_t value;
    58 };
    59 
    60 // TODO -   Single GID data.
    61 // WARNING - No bounds checking.
    62 uint64_t gid::value = 0;
    63 
    6449class gid_data {
    6550public:
     
    140125
    141126    IDISA_ALWAYS_INLINE gid_type lookup_or_insert(uint8_t * raw_bytes, const uint32_t idx, const uint32_t raw_byte_lgth,
    142                                                   uint8_t * h0, uint8_t * h1, const uint32_t hash_bit_lgth) {
     127                                                  uint8_t * h0, uint8_t * h1, const uint32_t hash_bit_lgth, GIDFactory & gid_factory) {
    143128
    144129        uint64_t bucket = get_bucket(h0,h1,idx,hash_bit_lgth);
     
    160145
    161146        /* insert */
    162         gid_type gid = gid::next();
     147        gid_type gid = gid_factory.next();
    163148
    164149        uint64_t x0 = bit_slice(h0, idx, hash_bit_lgth);
Note: See TracChangeset for help on using the changeset viewer.