libfilezilla
Public Member Functions | List of all members
file_reader Class Referencefinal

File reader. More...

#include <reader.hpp>

Inheritance diagram for file_reader:
Inheritance graph
[legend]
Collaboration diagram for file_reader:
Collaboration graph
[legend]

Public Member Functions

 file_reader (std::wstring &&name, aio_buffer_pool &pool, file &&f, thread_pool &tpool, uint64_t offset=0, uint64_t size=nosize, size_t max_buffers=4) noexcept
 Constructs file reader. More...
 
 file_reader (std::wstring_view name, aio_buffer_pool &pool, file &&f, thread_pool &tpool, uint64_t offset=0, uint64_t size=nosize, size_t max_buffers=4) noexcept
 
virtual bool seekable () const override
 
- Public Member Functions inherited from threaded_reader
 reader_base (reader_base const &)=delete
 
 reader_base (std::wstring &&name, aio_buffer_pool &pool, size_t max_buffers) noexcept
 Constructs a reader. More...
 
 reader_base (std::wstring_view name, aio_buffer_pool &pool, size_t max_buffers) noexcept
 
- Public Member Functions inherited from reader_base
 reader_base (reader_base const &)=delete
 
reader_baseoperator= (reader_base const &)=delete
 
void close ()
 
bool seek (uint64_t offset, uint64_t size=nosize)
 If seek fails, the reader is in an undefined state and must be closed.
 
bool rewind ()
 Only seekable readers can be rewound.
 
std::wstring const & name () const
 
virtual uint64_t size () const
 Size of the reader. If the size is indetermined, nosize is returned.
 
virtual datetime mtime () const
 Last modification time, might be indetermined.
 
std::pair< aio_result, buffer_leaseget_buffer (aio_waiter &h)
 Gets the next buffer with data from the reader. More...
 
std::pair< aio_result, buffer_leaseget_buffer (event_handler &h)
 
bool error () const
 
- Public Member Functions inherited from aio_waitable
void remove_waiter (aio_waiter &h)
 
void remove_waiter (event_handler &h)
 

Additional Inherited Members

- Public Types inherited from aio_base
using size_type = uint64_t
 
- Static Public Attributes inherited from aio_base
static constexpr auto nosize = static_cast<size_type>(-1)
 
- Protected Member Functions inherited from threaded_reader
virtual std::pair< aio_result, buffer_leasedo_get_buffer (scoped_lock &l) override
 
void wakeup (scoped_lock &l)
 
- Protected Member Functions inherited from reader_base
 reader_base (std::wstring &&name, aio_buffer_pool &pool, size_t max_buffers) noexcept
 Constructs a reader. More...
 
 reader_base (std::wstring_view name, aio_buffer_pool &pool, size_t max_buffers) noexcept
 
- Protected Member Functions inherited from aio_waitable
void remove_waiters ()
 Call in destructor of most-derived class.
 
void add_waiter (aio_waiter &h)
 
void add_waiter (event_handler &h)
 
void signal_availibility ()
 
void remove_waiter (aio_waiter &h)
 
void remove_waiter (event_handler &h)
 
- Protected Attributes inherited from threaded_reader
condition cond_
 
async_task task_
 
bool quit_ {}
 
- Protected Attributes inherited from reader_base
mutex mtx_
 
aio_buffer_poolbuffer_pool_
 
logger_interfacelogger_
 
std::wstring const name_
 
size_t const max_buffers_ {}
 
std::list< buffer_leasebuffers_
 
uint64_t size_ {nosize}
 
uint64_t max_size_ {nosize}
 
uint64_t start_offset_ {nosize}
 
uint64_t remaining_ {nosize}
 
bool get_buffer_called_ {}
 
bool error_ {}
 
bool eof_ {}
 

Detailed Description

File reader.

Constructor & Destructor Documentation

◆ file_reader()

file_reader ( std::wstring &&  name,
aio_buffer_pool pool,
file &&  f,
thread_pool tpool,
uint64_t  offset = 0,
uint64_t  size = nosize,
size_t  max_buffers = 4 
)
noexcept

Constructs file reader.

The passed thread_pool needs to live longer than the reader.


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