JASSv2
serialise_jass_v2.h
Go to the documentation of this file.
1 /*
2  SERIALISE_JASS_V2.H
3  -------------------
4  Copyright (c) 2016 Andrew Trotman
5  Released under the 2-clause BSD license (See:https://en.wikipedia.org/wiki/BSD_licenses)
6 */
13 #pragma once
14 
15 #include "serialise_jass_v1.h"
16 
17 namespace JASS
18  {
19  /*
20  CLASS SERIALISE_JASS_V2
21  -----------------------
22  */
28  {
29  protected:
30  std::vector<slice, allocator_cpp<slice>> compressed_headers;
31 
32  protected:
33  /*
34  SERIALISE_JASS_V2::WRITE_POSTINGS()
35  -----------------------------------
36  */
46  virtual size_t write_postings(const index_postings &postings, size_t &number_of_impacts, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies);
47 
48  public:
49  /*
50  SERIALISE_JASS_V2::SERIALISE_JASS_V2()
51  --------------------------------------
52  */
59  serialise_jass_v2(size_t documents, jass_v1_codex codex = jass_v1_codex::elias_gamma_simd_vb, int8_t alignment = 1) :
60  serialise_jass_v1(documents, codex, alignment),
61  compressed_headers(allocator)
62  {
63  /* Nothing */
64  }
65 
66  /*
67  SERIALISE_JASS_V2::~SERIALISE_JASS_V2()
68  ---------------------------------------
69  */
74  {
75  /* Nothing */
76  }
77 
78  /*
79  SERIALISE_JASS_V2::SERIALISE_VOCABULARY_POINTERS()
80  --------------------------------------------------
81  */
85  virtual void serialise_vocabulary_pointers(void);
86 
87  /*
88  SERIALISE_JASS_V1::SERIALISE_PRIMARY_KEYS()
89  --------------------------------------------
90  */
94  virtual void serialise_primary_keys(void);
95 
96  /*
97  SERIALISE_JASS_V2::DELEGATE::OPERATOR()()
98  -----------------------------------------
99  */
108  virtual void operator()(const slice &term, const index_postings &postings, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies);
109 
110  /*
111  SERIALISE_JASS_V2::UNITTEST()
112  -----------------------------
113  */
117  static void unittest(void);
118  };
119  }
static void unittest(void)
Unit test this class.
Definition: serialise_jass_v2.cpp:221
Non-thread-safe object that accumulates a single postings list during indexing.
Definition: index_postings.h:40
virtual size_t write_postings(const index_postings &postings, size_t &number_of_impacts, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies)
Convert the postings list to the JASS v2 format and serialise it to disk.
Definition: serialise_jass_v2.cpp:23
virtual void serialise_vocabulary_pointers(void)
Serialise the ppointers that point between the vocab and the postings (the CIvocab.bin file).
Definition: serialise_jass_v2.cpp:169
C++ slices (string-descriptors)
Definition: slice.h:27
virtual void serialise_primary_keys(void)
Serialise the primary keys (or any extra stuff at the end of the primary key file).
Definition: serialise_jass_v2.cpp:206
uint32_t integer
This class and descendants will work on integers of this size. Do not change without also changing JA...
Definition: compress_integer.h:40
Serialise an index in the experimental JASS-CI format used (by JASS version 1) in the RIGOR workshop...
virtual void operator()(const slice &term, const index_postings &postings, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies)
The callback function to serialise the postings (given the term) is operator().
Definition: serialise_jass_v2.cpp:137
Serialise an index in the experimental JASS-CI format used (by JASS version 1) in the RIGOR workshop...
Definition: serialise_jass_v1.h:70
uint8_t alignment
Postings lists are padded to this alignment (used for codexes that require word alignment).
Definition: serialise_jass_v1.h:160
Virtual base class for C style allocators.
Definition: allocator.h:33
Serialise an index in the format used by JASS version 2 (a better compressed JASS v1 format)...
Definition: serialise_jass_v2.h:27
uint16_t impact_type
An impact value (i.e. a term frequency value) is of this type.
Definition: index_postings_impact.h:41
jass_v1_codex
The compression scheme that is active.
Definition: serialise_jass_v1.h:132
file postings
The postings lists.
Definition: serialise_jass_v1.h:148
size_t documents
The number of documents in the collection.
Definition: index_manager.h:50
serialise_jass_v2(size_t documents, jass_v1_codex codex=jass_v1_codex::elias_gamma_simd_vb, int8_t alignment=1)
Constructor.
Definition: serialise_jass_v2.h:59
Definition: compress_integer_elias_delta_simd.c:23
virtual ~serialise_jass_v2()
Destructor.
Definition: serialise_jass_v2.h:73