ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
MoveRIndex.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File MoveRIndex.h ---------------------------*/
3/*--------------------------------------------------------------------------*/
60/*--------------------------------------------------------------------------*/
61/*----------------------------- DEFINITIONS --------------------------------*/
62/*--------------------------------------------------------------------------*/
63
64#ifndef __ADS_MoveRIndex
65 #define __ADS_MoveRIndex
66/* self-identification: #endif constant */
67
68/*--------------------------------------------------------------------------*/
69/*------------------------------ INCLUDES ----------------------------------*/
70/*--------------------------------------------------------------------------*/
71
72#include "ADS/Contract.h"
78
79#include <algorithm>
80#include <array>
81#include <bit>
82#include <cstddef>
83#include <cstdint>
84#include <string>
85#include <string_view>
86#include <tuple>
87#include <utility>
88#include <vector>
89
90/*--------------------------------------------------------------------------*/
91/*--------------------------- NAMESPACE ------------------------------------*/
92/*--------------------------------------------------------------------------*/
93
94namespace ADS
95{
96
97/*--------------------------------------------------------------------------*/
98/*---------------------------- CLASS MoveRIndex ----------------------------*/
99/*--------------------------------------------------------------------------*/
100
104{
105
106/*--------------------------------------------------------------------------*/
107 public:
109 MoveRIndex( void ) : MoveRIndex( std::string_view() ) { }
110
138 explicit MoveRIndex( std::string_view s );
139
141 [[nodiscard]] std::size_t size( void ) const { return( f_n ); }
142
144 [[nodiscard]] std::size_t intervals( void ) const {
145 return( f_lf.intervals() );
146 }
147
177 [[nodiscard]] std::size_t count( std::string_view P ) const;
178
208 [[nodiscard]] std::vector< std::size_t > locate( std::string_view P ) const;
209
212 [[nodiscard]] std::size_t sizeInBits( void ) const;
213
214/*----------------------------- THE PERSISTENCE ----------------------------*/
215
217 static constexpr std::string_view persistName = "MoveRIndex";
218
221 template< class A >
222 void persist( A & a );
223
224/*--------------------------------------------------------------------------*/
225 private:
229 template< bool Toehold >
230 [[nodiscard]] bool search( std::string_view P , std::uint64_t & s ,
231 std::size_t & is , std::uint64_t & e ,
232 std::size_t & ie , std::uint64_t & v ,
233 std::size_t & iv ) const;
234
235 std::size_t f_n = 0;
236 int f_w = 1 , f_wi = 1;
237 MoveStructure f_lf;
239 std::array< std::size_t , 257 > f_cnt{};
240 MoveStructure f_phi;
241 BitVector f_end;
242 BitVector f_endPhi;
243#if ADS_CONTRACTS >= 3
244 std::string f_text;
245#endif
246
247 }; // end( class MoveRIndex )
248
249/*--------------------------------------------------------------------------*/
250
251} // end( namespace ADS )
252
253/*--------------------------------------------------------------------------*/
254/*-------------------------- IMPLEMENTATION --------------------------------*/
255/*--------------------------------------------------------------------------*/
256
257#include "ADS/compression/impl/MoveRIndex.tpp"
258
259/*--------------------------------------------------------------------------*/
260
261#endif /* MoveRIndex.h included */
262
263/*--------------------------------------------------------------------------*/
264/*-------------------------- End File MoveRIndex.h -------------------------*/
265/*--------------------------------------------------------------------------*/
The vector of bits on which the succinct structures and the integer codes of ADS are built: the bits ...
The transform of Burrows and Wheeler and the compressor built on it (chapter 14, Block-Sorting Compre...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The wavelet tree shaped by the code of Huffman of Mäkinen and Navarro: a sequence of symbols of in ...
The move structure of Nishimoto and Tabei: a permutation of that shifts each of intervals alike,...
Rank and select on a static vector of bits of bits with 1s (chapter 15, Compressed Data Structures...
a vector of bits packed in words of 64 bits
Definition BitVector.h:479
std::vector< std::size_t > locate(std::string_view P) const
the places of the occurrences of , in increasing order
std::size_t size(void) const
the length of the text
Definition MoveRIndex.h:141
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
MoveRIndex(void)
the index of the empty text
Definition MoveRIndex.h:109
std::size_t intervals(void) const
the number of the intervals of the LF-mapping, after the balance
Definition MoveRIndex.h:144
std::size_t sizeInBits(void) const
the bits of the index: the two move structures, the ranks of the tags and the samples
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition MoveRIndex.h:217
MoveRIndex(std::string_view s)
the index of
std::size_t count(std::string_view P) const
the number of the occurrences of
a permutation of that shifts each of its intervals alike, with the image of a place and its interval...
Definition MoveStructure.h:88
Definition ADT.h:96