blob: 8554d614fc853adb0d57af71a65faec24e5cc74b (
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
|
#pragma once
#include <cstdio>
#include <fstream>
#include <iostream>
#include "hash.hh" //Includes line_splitter
#include "probing_hash_utils.hh"
#include "huffmanish.hh"
#include <sys/stat.h> //mkdir
#include "util/file_piece.hh"
#include "util/file.hh"
#include "vocabid.hh"
#define API_VERSION 3
void createProbingPT(const char * phrasetable_path, const char * target_path,
const char * num_scores, const char * is_reordering);
class BinaryFileWriter
{
std::vector<unsigned char> binfile;
std::vector<unsigned char>::iterator it;
//Output binary
std::ofstream os;
public:
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
BinaryFileWriter (std::string);
~BinaryFileWriter ();
void write (std::vector<unsigned char> * bytes);
void flush (); //Flush to disk
};
|