foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Private Member Functions
foobar2000_io::file_cachedabstract

#include <filesystem.h>

+ Inheritance diagram for foobar2000_io::file_cached:

Public Member Functions

virtual size_t get_cache_block_size ()=0
 
virtual void suggest_grow_cache (size_t suggestSize)=0
 
- Public Member Functions inherited from foobar2000_io::file
virtual bool can_seek ()=0
 
void ensure_local ()
 
void ensure_seekable ()
 
 FB2K_MAKE_SERVICE_INTERFACE (file, service_base)
 
virtual bool get_content_type (pfc::string_base &p_out)=0
 
virtual t_filesize get_position (abort_callback &p_abort)=0
 
t_filesize get_remaining (abort_callback &p_abort)
 
virtual t_filesize get_size (abort_callback &p_abort)=0
 
t_filesize get_size_ex (abort_callback &p_abort)
 
t_filestats get_stats (abort_callback &p_abort)
 
virtual t_filetimestamp get_timestamp (abort_callback &p_abort)
 
bool is_eof (abort_callback &p_abort)
 
virtual bool is_in_memory ()
 
virtual bool is_remote ()=0
 
virtual void on_idle (abort_callback &p_abort)
 
void probe_remaining (t_filesize bytes, abort_callback &p_abort)
 
virtual void reopen (abort_callback &p_abort)=0
 
virtual void resize (t_filesize p_size, abort_callback &p_abort)=0
 
virtual void seek (t_filesize p_position, abort_callback &p_abort)=0
 
virtual void seek_ex (t_sfilesize p_position, t_seek_mode p_mode, abort_callback &p_abort)
 
void seek_probe (t_filesize p_position, abort_callback &p_abort)
 
void set_eof (abort_callback &p_abort)
 
t_filesize skip (t_filesize p_bytes, abort_callback &p_abort)
 
t_filesize skip_seek (t_filesize p_bytes, abort_callback &p_abort)
 
void truncate (t_filesize p_position, abort_callback &p_abort)
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 
- Public Member Functions inherited from foobar2000_io::stream_reader
virtual t_size read (void *p_buffer, t_size p_bytes, abort_callback &p_abort)=0
 
template<typename T >
void read_bendian_t (T &p_object, abort_callback &p_abort)
 
template<typename T >
void read_lendian_t (T &p_object, abort_callback &p_abort)
 
virtual void read_object (void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 
template<typename T >
void read_object_t (T &p_object, abort_callback &p_abort)
 
void read_string (pfc::string_base &p_out, abort_callback &p_abort)
 
pfc::string read_string (abort_callback &p_abort)
 
void read_string_ex (pfc::string_base &p_out, t_size p_bytes, abort_callback &p_abort)
 
pfc::string read_string_ex (t_size p_len, abort_callback &p_abort)
 
void read_string_nullterm (pfc::string_base &out, abort_callback &abort)
 
void read_string_raw (pfc::string_base &p_out, abort_callback &p_abort)
 
template<typename t_outArray >
void read_till_eof (t_outArray &out, abort_callback &abort)
 
virtual void skip_object (t_filesize p_bytes, abort_callback &p_abort)
 
t_filesize skip_till_eof (abort_callback &abort)
 
- Public Member Functions inherited from foobar2000_io::stream_writer
virtual void write (const void *p_buffer, t_size p_bytes, abort_callback &p_abort)=0
 
template<typename T >
void write_bendian_t (const T &p_object, abort_callback &p_abort)
 
template<typename T >
void write_lendian_t (const T &p_object, abort_callback &p_abort)
 
void write_object (const void *p_buffer, t_size p_bytes, abort_callback &p_abort)
 
template<typename T >
void write_object_t (const T &p_object, abort_callback &p_abort)
 
void write_string (const char *p_string, abort_callback &p_abort)
 
void write_string (const char *p_string, t_size p_len, abort_callback &p_abort)
 
template<typename T >
void write_string (const T &val, abort_callback &p_abort)
 
void write_string_nullterm (const char *p_string, abort_callback &p_abort)
 
void write_string_raw (const char *p_string, abort_callback &p_abort)
 

Static Public Member Functions

static file::ptr g_create (service_ptr_t< file > p_base, abort_callback &p_abort, t_size blockSize)
 
static void g_create (service_ptr_t< file > &p_out, service_ptr_t< file > p_base, abort_callback &p_abort, t_size blockSize)
 
static void g_decodeInitCache (file::ptr &theFile, abort_callback &abort, size_t blockSize)
 
- Static Public Member Functions inherited from foobar2000_io::file
static t_filesize g_transfer (stream_reader *src, stream_writer *dst, t_filesize bytes, abort_callback &p_abort)
 
static t_filesize g_transfer (service_ptr_t< file > p_src, service_ptr_t< file > p_dst, t_filesize p_bytes, abort_callback &p_abort)
 
static void g_transfer_file (const service_ptr_t< file > &p_from, const service_ptr_t< file > &p_to, abort_callback &p_abort)
 
static void g_transfer_object (stream_reader *src, stream_writer *dst, t_filesize bytes, abort_callback &p_abort)
 
static void g_transfer_object (service_ptr_t< file > p_src, service_ptr_t< file > p_dst, t_filesize p_bytes, abort_callback &p_abort)
 

Private Member Functions

 FB2K_MAKE_SERVICE_INTERFACE (file_cached, file)
 

Additional Inherited Members

- Public Types inherited from foobar2000_io::file
enum  t_seek_mode { seek_from_beginning = 0, seek_from_current = 1, seek_from_eof = 2 }
 
- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 
- Protected Member Functions inherited from foobar2000_io::stream_reader
 stream_reader ()
 
 ~stream_reader ()
 
- Protected Member Functions inherited from foobar2000_io::stream_writer
 stream_writer ()
 
 ~stream_writer ()
 

Detailed Description

Extension for cached file access - allows callers to know that they're dealing with a cache layer, to prevent cache duplication.

Definition at line 339 of file filesystem.h.

Member Function Documentation

foobar2000_io::file_cached::FB2K_MAKE_SERVICE_INTERFACE ( file_cached  ,
file   
)
private
file::ptr file_cached::g_create ( service_ptr_t< file p_base,
abort_callback p_abort,
t_size  blockSize 
)
static

Definition at line 343 of file file_cached_impl.cpp.

343  {
344 
345  if (p_base->is_in_memory()) {
346  return p_base; // do not want
347  }
348 
349  { // do not duplicate cache layers, check if the file we're being handed isn't already cached
350  file_cached::ptr c;
351  if (p_base->service_query_t(c)) {
352  c->suggest_grow_cache(blockSize);
353  return p_base;
354  }
355  }
356 
358  temp->initialize(p_base,p_abort);
359  return temp;
360 }
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
Definition: service_impl.h:4
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
void file_cached::g_create ( service_ptr_t< file > &  p_out,
service_ptr_t< file p_base,
abort_callback p_abort,
t_size  blockSize 
)
static

Definition at line 362 of file file_cached_impl.cpp.

362  {
363  p_out = g_create(p_base, p_abort, blockSize);
364 }
static file::ptr g_create(service_ptr_t< file > p_base, abort_callback &p_abort, t_size blockSize)
void file_cached::g_decodeInitCache ( file::ptr &  theFile,
abort_callback abort,
size_t  blockSize 
)
static

Definition at line 366 of file file_cached_impl.cpp.

366  {
367  if (theFile->is_remote() || !theFile->can_seek()) return;
368 
369  g_create(theFile, theFile, abort, blockSize);
370 }
static file::ptr g_create(service_ptr_t< file > p_base, abort_callback &p_abort, t_size blockSize)
virtual size_t foobar2000_io::file_cached::get_cache_block_size ( )
pure virtual
virtual void foobar2000_io::file_cached::suggest_grow_cache ( size_t  suggestSize)
pure virtual

The documentation for this class was generated from the following files: