00001 #pragma once 00002 00003 #include "util/probing_hash_table.hh" 00004 00005 #include <sys/mman.h> 00006 #include <boost/functional/hash.hpp> 00007 #include <fcntl.h> 00008 #include <fstream> 00009 00010 namespace Moses 00011 { 00012 00013 #define API_VERSION 15 00014 00015 //Hash table entry 00016 struct Entry { 00017 typedef uint64_t Key; 00018 Key key; 00019 00020 Key GetKey() const { 00021 return key; 00022 } 00023 00024 void SetKey(Key to) { 00025 key = to; 00026 } 00027 00028 uint64_t value; 00029 }; 00030 00031 #define NONE std::numeric_limits<uint64_t>::max() 00032 00033 //Define table 00034 typedef util::ProbingHashTable<Entry, boost::hash<uint64_t> > Table; 00035 00036 void serialize_table(char *mem, size_t size, const std::string &filename); 00037 00038 char * readTable(const char * filename, size_t size); 00039 00040 uint64_t getKey(const uint64_t source_phrase[], size_t size); 00041 00042 struct TargetPhraseInfo { 00043 uint32_t alignTerm; 00044 uint32_t alignNonTerm; 00045 uint16_t numWords; 00046 uint16_t propLength; 00047 uint16_t filler; 00048 }; 00049 00050 } 00051