Represents a file of unsigned integers compressed using gamma compression.
More...
#include <compressed_file_reader.h>
|
void | get_next () |
| Seeks to the next compressed number and returns the current cached value.
|
|
bool | read_bit () |
|
|
std::unique_ptr< mmap_file > | file_ |
| Pointer to the mmap_file we are reading: nullptr if we don't own it, initialized if we do.
|
|
char * | start_ |
| Pointer to the beginning of the compressed file (which will be in memory most of the time)
|
|
uint64_t | size_ |
| the number of bytes in this compressed file
|
|
int | status_ |
| reading/writing status
|
|
uint64_t | current_value_ |
| current numeric value that was read
|
|
uint64_t | current_char_ |
| current byte in the compressed file
|
|
uint8_t | current_bit_ |
| current bit inside the current byte
|
|
std::function< uint64_t(uint64_t)> | mapping_ |
| hold the (actual -> compressed id) mapping
|
|
Represents a file of unsigned integers compressed using gamma compression.
meta::io::compressed_file_reader::compressed_file_reader |
( |
const mmap_file & |
file, |
|
|
std::function< uint64_t(uint64_t)> |
mapping |
|
) |
| |
Constructor; opens a compressed file for reading using the given mapping.
- Parameters
-
file | The file to read from |
mapping | A function to map the original numbers to their compressed id, usually to take advantage of a skewed distribution of towards many small numbers |
meta::io::compressed_file_reader::compressed_file_reader |
( |
const std::string & |
filename, |
|
|
std::function< uint64_t(uint64_t)> |
mapping |
|
) |
| |
Constructor to create a new mmap file for reading.
- Parameters
-
filename | The filename for the new file to read from |
mapping | A function to map the original numbers to their compressed id, usually to take advantage of a skewed distribution of towards many small numbers |
void meta::io::compressed_file_reader::seek |
( |
uint64_t |
bit_offset | ) |
|
Sets the cursor to the specified position in the file.
It is up to the user to specify a valid position.
- Parameters
-
bit_offset | Bit offset into the file |
bool meta::io::compressed_file_reader::has_next |
( |
| ) |
const |
- Returns
- whether there is another number in the file
uint64_t meta::io::compressed_file_reader::next |
( |
| ) |
|
- Returns
- the next compressed number
std::string meta::io::compressed_file_reader::next_string |
( |
| ) |
|
- Returns
- the next string from this compressed file
uint64_t meta::io::compressed_file_reader::bit_location |
( |
| ) |
const |
- Returns
- the current bit location in this file
meta::io::compressed_file_reader::operator bool |
( |
| ) |
const |
|
inline |
- Returns
- whether reading from this compressed file is still good
bool meta::io::compressed_file_reader::read_bit |
( |
| ) |
|
|
private |
- Returns
- the next bit in the file
The documentation for this class was generated from the following files: