Welcome to mirror list, hosted at ThFree Co, Russian Federation.

probing_hash_utils.hh « ProbingPT « TranslationModel « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de96e87a0fe6cf95291e1b5f748a36f2bc6fc6d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "util/probing_hash_table.hh"

#include <sys/mman.h>
#include <boost/functional/hash.hpp>
#include <fcntl.h>
#include <fstream>


//Hash table entry
struct Entry {
  uint64_t key;
  typedef uint64_t Key;
  unsigned int bytes_toread;

  uint64_t GetKey() const {
    return key;
  }

  void SetKey(uint64_t to) {
    key = to;
  }

  uint64_t GetValue() const {
    return value;
  }

  uint64_t value;
};

//Define table
typedef util::ProbingHashTable<Entry, boost::hash<uint64_t> > Table;

void serialize_table(char *mem, size_t size, const char * filename);

char * readTable(const char * filename, size_t size);