29 #include "../my_config.h" 61 cache & operator = (
const cache & ref) =
delete;
95 bool need_flush_write()
const {
return first_to_write <
last; };
102 U_I available_in_cache(skippability direction)
const;
infinint eof_offset
size of the underlying file (read-only mode), set to zero if unknown
virtual infinint get_position() const override
get the current read/write position
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
void alloc_buffer(size_t x_size)
allocate x_size byte in buffer field and set size accordingly
U_I first_to_write
position of the first byte that need to be written. if greater than last, no byte need writing ...
virtual void inherited_sync_write() override
write down any pending data
virtual U_I inherited_read(char *a, U_I size) override
implementation of read() operation
virtual void inherited_read_ahead(const infinint &amount) override
tells the object that several calls to read() will follow to probably obtain at least the given amoun...
cache(generic_file &hidden, bool shift_mode, U_I size=102400)
virtual bool skip_to_eof() override
skip to the end of file
char * buffer
data in transit
virtual bool skippable(skippability direction, const infinint &amount) override
whether the implementation is able to skip
virtual bool skip(const infinint &pos) override
skip at the absolute position
generic_file * ref
underlying file, (not owned by "this', not to be delete by "this")
virtual void inherited_terminate() override
destructor-like call, except that it is allowed to throw exceptions
the cache class implements a fixed length read/write caching mechanism
infinint buffer_offset
position of the first byte in buffer
switch module to limitint (32 ou 64 bits integers) or infinint
this is the interface class from which all other data transfer classes inherit
U_I half
precalculated half = size / 2
the arbitrary large positive integer class
gf_mode get_mode() const
retreive the openning mode for this object
virtual void inherited_write(const char *a, U_I size) override
implementation of the write() operation
virtual bool skip_relative(S_I x) override
skip relatively to the current position
bool shifted_mode
whether to half flush and shift or totally flush data
virtual void inherited_flush_read() override
reset internal engine, flush caches in order to read the data at current position ...
void release_buffer()
release memory set buffer to nullptr and size to zero
libdar namespace encapsulate all libdar symbols
U_I next
next to read or next place to write to
U_I last
first byte of invalid data in the cache. we have: next <= last < size