#include "turbopfor-encode.h"
#include <algorithm>
-#include <arpa/inet.h>
#include <assert.h>
#include <chrono>
-#include <endian.h>
-#include <fcntl.h>
+#include <iosfwd>
#include <math.h>
#include <memory>
+#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <string>
+#include <string_view>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <unordered_map>
+#include <utility>
#include <vector>
#include <zstd.h>
class Corpus {
public:
Corpus(FILE *outfp, size_t block_size)
- : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size) {
+ : invindex(new PostingListBuilder *[NUM_TRIGRAMS]), outfp(outfp), block_size(block_size)
+ {
fill(invindex.get(), invindex.get() + NUM_TRIGRAMS, nullptr);
}
+ ~Corpus()
+ {
+ for (unsigned i = 0; i < NUM_TRIGRAMS; ++i) {
+ delete invindex[i];
+ }
+ }
+
void add_file(string filename);
void flush_block();