libfilezilla
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
reader_factory Class Referenceabstract

A reader factory. More...

#include <reader.hpp>

Inheritance diagram for reader_factory:
Inheritance graph
[legend]

Public Member Functions

 reader_factory (std::wstring const &name)
 
 reader_factory (std::wstring &&name)
 
virtual std::unique_ptr< reader_factoryclone () const =0
 Clones the factory.
 
virtual std::unique_ptr< reader_baseopen (aio_buffer_pool &pool, uint64_t offset=0, uint64_t size=reader_base::nosize, size_t max_buffers=0)=0
 Creates a reader. More...
 
virtual bool seekable () const
 
std::wstring name () const
 
virtual uint64_t size () const
 
virtual datetime mtime () const
 
virtual size_t min_buffer_usage () const
 The reader requires at least this many buffers. More...
 
virtual bool multiple_buffer_usage () const
 Whether the reader can benefit from multiple buffers. More...
 
virtual size_t preferred_buffer_count () const
 

Protected Member Functions

 reader_factory (reader_factory const &)=default
 

Protected Attributes

std::wstring const name_
 

Detailed Description

A reader factory.

Member Function Documentation

◆ min_buffer_usage()

virtual size_t min_buffer_usage ( ) const
inlinevirtual

The reader requires at least this many buffers.

Size your buffer_pool to have a least as many buffers as the sum of min_buffer_usage() of all involved readers/writers, otherwise progress may stall due to buffer exhaustion.

◆ multiple_buffer_usage()

virtual bool multiple_buffer_usage ( ) const
inlinevirtual

Whether the reader can benefit from multiple buffers.

If false, calling open with max_buffers larger than min_buffer_usage() offers no benefits.

Reimplemented in file_reader_factory.

◆ open()

virtual std::unique_ptr<reader_base> open ( aio_buffer_pool pool,
uint64_t  offset = 0,
uint64_t  size = reader_base::nosize,
size_t  max_buffers = 0 
)
pure virtual

Creates a reader.

The pool must live longer than the returned reader.

Seekable readers can be opened at any position. If the reader is not seekable, pass an offset of 0 or open will fails.

size can limit the amount of data the reader can returned. Note that a size limit that exceeds the actual size will result in reader_base::get_buffer eventually returning an error.

Implemented in file_reader_factory, string_reader_factory, and view_reader_factory.


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