|
qb
2.0.0.0
C++17 Actor Framework
|
Asynchronous file operations handler. More...
#include <file.h>


Public Types | |
| using | transport_io_type = typename qb::io::transport::file::transport_io_type |
| Type of the underlying transport IO. | |
| Public Types inherited from qb::io::async::file_watcher< _Derived > | |
| using | base_io_t = file_watcher<_Derived> |
| Base I/O type alias for CRTP. | |
Public Member Functions | |
| file () | |
| < Import the transport method from the file transport | |
| uint64_t | ident () noexcept |
| Get a unique identifier for the file. | |
| Public Member Functions inherited from qb::io::async::file_watcher< _Derived > | |
| file_watcher ()=default | |
| Default constructor. | |
| file_watcher (IProtocol *protocol) noexcept | |
| Constructor with an externally managed protocol. | |
| file_watcher (file_watcher const &)=delete | |
| Deleted copy constructor to prevent unintended copying of watcher state and resources. | |
| ~file_watcher () noexcept | |
| Destructor. | |
| template<typename _Protocol, typename... _Args> | |
| _Protocol * | switch_protocol (_Args &&...args) |
| Switches to a new protocol for processing file contents, taking ownership. | |
| void | start (std::string const &fpath, ev_tstamp ts=0.1) noexcept |
| Starts watching a file for attribute changes. | |
| void | disconnect () noexcept |
| Stops watching the file. | |
| int | read_all () |
| Reads all available data from the file and processes it using the current protocol. | |
Additional Inherited Members | |
| Static Public Attributes inherited from qb::io::async::file_watcher< _Derived > | |
| static constexpr const bool | do_read = true |
| Flag indicating this watcher type reads file content. | |
| Protected Member Functions inherited from qb::io::async::base< file_watcher< _Derived >, event::file > | |
| base () | |
| Constructor that registers the event watcher with the current listener. | |
| ~base () | |
| Destructor that unregisters the event watcher. | |
| Protected Attributes inherited from qb::io::async::base< file_watcher< _Derived >, event::file > | |
| event::file & | _async_event |
| Reference to the registered libev-based event watcher. | |
Asynchronous file operations handler.
This template class provides asynchronous file operations by combining the file_watcher functionality with the file transport. It allows for non-blocking file operations integrated with the event loop.
| _Derived | The derived class type (CRTP pattern) |
|
inlineexplicit |
< Import the transport method from the file transport
Constructor
Creates a new asynchronous file handler. If the derived class defines a Protocol type that is not void, an instance of that protocol is created and attached to the file handler.
|
inlinenoexcept |
Get a unique identifier for the file.
Returns the native handle of the underlying file as a unique identifier.