Writes to a file of unsigned integers using gamma compression.
More...
#include <compressed_file_writer.h>
|
| compressed_file_writer (const std::string &filename, std::function< uint64_t(uint64_t)> mapping) |
| Constructor; Opens a compressed file for writing or creates a new file if it doesn't exist. More...
|
|
| ~compressed_file_writer () |
| Destructor; closes the compressed file.
|
|
uint64_t | bit_location () const |
|
void | write (uint64_t value) |
| Writes a value to the end of the compressed file. More...
|
|
void | write (const std::string &str) |
| Writes a binary string to the file. More...
|
|
void | close () |
| Closes this compressed file.
|
|
|
void | write_bit (bool bit) |
| Writes a bit to the file and advances the current location in the file. More...
|
|
void | write_buffer () const |
| Writes the buffer to the file.
|
|
|
FILE * | outfile_ |
| Where to write the compressed data.
|
|
uint64_t | char_cursor_ |
| The current byte this reader is on.
|
|
uint64_t | bit_cursor_ |
| The current bit of the current byte this reader is on.
|
|
uint64_t | buffer_size_ |
| How large to make the internal writer buffer.
|
|
unsigned char * | buffer_ |
| Saved data that is not yet written to disk.
|
|
std::function< uint64_t(uint64_t)> | mapping_ |
| The mapping to use (actual -> compressed id)
|
|
uint64_t | bit_location_ |
| The number of total bits that have been written (for seeking)
|
|
bool | closed_ |
| Ensures the file isn't closed more than once.
|
|
Writes to a file of unsigned integers using gamma compression.
meta::io::compressed_file_writer::compressed_file_writer |
( |
const std::string & |
filename, |
|
|
std::function< uint64_t(uint64_t)> |
mapping |
|
) |
| |
Constructor; Opens a compressed file for writing or creates a new file if it doesn't exist.
- Parameters
-
filename | The path to the compressed file |
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 |
uint64_t meta::io::compressed_file_writer::bit_location |
( |
| ) |
const |
- Returns
- the character index and bit index of the current location in the compressed file
void meta::io::compressed_file_writer::write |
( |
uint64_t |
value | ) |
|
Writes a value to the end of the compressed file.
- Parameters
-
void meta::io::compressed_file_writer::write |
( |
const std::string & |
str | ) |
|
Writes a binary string to the file.
- Parameters
-
void meta::io::compressed_file_writer::write_bit |
( |
bool |
bit | ) |
|
|
private |
Writes a bit to the file and advances the current location in the file.
- Parameters
-
The documentation for this class was generated from the following files: