26 #ifndef COMPRESSOR_HPP
27 #define COMPRESSOR_HPP
29 #include "../my_config.h"
57 extern std::string compression2string(
compression c);
58 extern compression string2compression(
const std::string & a);
72 compression get_algo()
const {
return current_algo; };
74 void suspend_compression();
75 void resume_compression();
76 bool is_compression_suspended()
const {
return suspended; };
81 bool skip(
const infinint & pos) { compr_flush_write(); compr_flush_read(); clean_read();
return compressed->
skip(pos); };
88 U_I
inherited_read(
char *a, U_I size) {
return (this->*read_ptr)(a, size); };
101 xfer(U_I sz, wrapperlib_mode mode);
105 struct lzo_block_header
115 xfer *compr, *decompr;
117 char *lzo_read_buffer;
118 char *lzo_write_buffer;
122 bool lzo_write_flushed;
123 bool lzo_read_reached_eof;
124 char *lzo_compressed;
128 bool compressed_owner;
135 void local_terminate();
136 U_I (compressor::*read_ptr) (
char *a, U_I size);
137 U_I none_read(
char *a, U_I size);
138 U_I gzip_read(
char *a, U_I size);
141 U_I lzo_read(
char *a, U_I size);
143 void (compressor::*write_ptr) (
const char *a, U_I size);
144 void none_write(
const char *a, U_I size);
145 void gzip_write(
const char *a, U_I size);
148 void lzo_write(
const char *a, U_I size);
150 void lzo_compress_buffer_and_write();
151 void lzo_read_and_uncompress_to_buffer();
159 void change_algo(
compression new_algo, U_I new_compression_level);
165 { change_algo(new_algo, current_level); };
168 void compr_flush_write();
170 void compr_flush_read();
void inherited_flush_read()
are defined here basic integer types that tend to be portable
void inherited_read_ahead(const infinint &amount)
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
virtual infinint get_position() const =0
get the current read/write position
virtual bool skip(const infinint &pos)=0
virtual void read_ahead(const infinint &amount)
void inherited_terminate()
destructor-like call, except that it is allowed to throw exceptions
virtual bool skip_relative(S_I x)=0
skip relatively to the current position
bool skip_to_eof()
skip to the end of file
bool skip_relative(S_I x)
skip relatively to the current position
void inherited_sync_write()
write down any pending data
generic_file(gf_mode m)
main constructor
libz and libbz2 wrapper to have identical interface to these libraries.libz and libbz2 library differ...
this class encapsulates calls to libz or libbz2
switch module to limitint (32 ou 64 bits integers) or infinint
compression class for gzip and bzip2 algorithms
compression
the different compression algorithm available
this is the interface class from which all other data transfer classes inherit
infinint get_position() const
get the current read/write position
void inherited_write(const char *a, U_I size)
implementation of the write() operation
the arbitrary large positive integer class
bool skip(const infinint &pos)
virtual bool skip_to_eof()=0
skip to the end of file
U_I inherited_read(char *a, U_I size)
implementation of read() operation
bool skippable(skippability direction, const infinint &amount)
compression char2compression(char a)
virtual bool skippable(skippability direction, const infinint &amount)=0