2014-06-11 14:47:00 +04:00
|
|
|
#pragma once
|
|
|
|
|
2015-03-28 16:09:03 +03:00
|
|
|
#include <cstdio>
|
2014-06-11 14:47:00 +04:00
|
|
|
#include <fstream>
|
2015-04-30 08:05:11 +03:00
|
|
|
#include <iostream>
|
2014-06-11 14:47:00 +04:00
|
|
|
|
2014-06-11 16:52:20 +04:00
|
|
|
#include "hash.hh" //Includes line_splitter
|
|
|
|
#include "probing_hash_utils.hh"
|
|
|
|
#include "huffmanish.hh"
|
2014-06-11 14:47:00 +04:00
|
|
|
#include <sys/stat.h> //mkdir
|
|
|
|
|
|
|
|
#include "util/file_piece.hh"
|
|
|
|
#include "util/file.hh"
|
|
|
|
#include "vocabid.hh"
|
2014-12-23 18:21:06 +03:00
|
|
|
#define API_VERSION 3
|
2014-06-11 14:47:00 +04:00
|
|
|
|
2014-12-23 18:21:06 +03:00
|
|
|
void createProbingPT(const char * phrasetable_path, const char * target_path,
|
2015-05-15 20:09:38 +03:00
|
|
|
const char * num_scores, const char * is_reordering);
|
2014-06-11 14:47:00 +04:00
|
|
|
|
2015-05-15 20:09:38 +03:00
|
|
|
class BinaryFileWriter
|
|
|
|
{
|
|
|
|
std::vector<unsigned char> binfile;
|
|
|
|
std::vector<unsigned char>::iterator it;
|
|
|
|
//Output binary
|
|
|
|
std::ofstream os;
|
2014-06-11 14:47:00 +04:00
|
|
|
|
|
|
|
public:
|
2015-05-15 20:09:38 +03:00
|
|
|
unsigned int dist_from_start; //Distance from the start of the vector.
|
|
|
|
uint64_t extra_counter; //After we reset the counter, we still want to keep track of the correct offset, so
|
2014-06-11 14:47:00 +04:00
|
|
|
|
2015-05-15 20:09:38 +03:00
|
|
|
BinaryFileWriter (std::string);
|
|
|
|
~BinaryFileWriter ();
|
|
|
|
void write (std::vector<unsigned char> * bytes);
|
|
|
|
void flush (); //Flush to disk
|
2014-06-11 14:47:00 +04:00
|
|
|
|
2014-06-11 16:52:20 +04:00
|
|
|
};
|