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