File indexing completed on 2026-08-17 08:39:19
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_COBALT_IO_RANDOM_ACCESS_FILE_HPP
0009 #define BOOST_COBALT_IO_RANDOM_ACCESS_FILE_HPP
0010
0011 #include <boost/asio/basic_random_access_file.hpp>
0012
0013 #include <boost/cobalt/io/detail/config.hpp>
0014 #include <boost/cobalt/config.hpp>
0015 #include <boost/cobalt/io/buffer.hpp>
0016 #include <boost/cobalt/io/file.hpp>
0017 #include <boost/cobalt/io/ops.hpp>
0018 #include <boost/cobalt/io/random_access_device.hpp>
0019 #include <boost/cobalt/noop.hpp>
0020 #include <boost/cobalt/op.hpp>
0021
0022 namespace boost::cobalt::io
0023 {
0024
0025
0026 struct BOOST_SYMBOL_VISIBLE random_access_file : file, random_access_device
0027 {
0028 using native_handle_type = file::native_handle_type;
0029
0030 BOOST_COBALT_IO_DECL random_access_file(const executor & executor = this_thread::get_executor());
0031 BOOST_COBALT_IO_DECL random_access_file(const char * path, file::flags open_flags,
0032 const executor & executor = this_thread::get_executor());
0033 BOOST_COBALT_IO_DECL random_access_file(const std::string & path, file::flags open_flags,
0034 const executor & executor = this_thread::get_executor());
0035 BOOST_COBALT_IO_DECL random_access_file(const native_handle_type & native_file,
0036 const executor & executor = this_thread::get_executor());
0037 BOOST_COBALT_IO_DECL random_access_file(random_access_file && sf) noexcept;
0038
0039 write_at_op write_some_at(std::uint64_t offset, const_buffer_sequence buffer)
0040 {
0041 return { offset, buffer, this, initiate_write_some_at_};
0042 }
0043
0044 read_at_op read_some_at(std::uint64_t offset, mutable_buffer_sequence buffer)
0045 {
0046 return { offset, buffer, this, initiate_read_some_at_};
0047 }
0048 private:
0049 BOOST_COBALT_IO_DECL static void initiate_read_some_at_(void *, std::uint64_t, mutable_buffer_sequence, completion_handler<system::error_code, std::size_t>);
0050 BOOST_COBALT_IO_DECL static void initiate_write_some_at_(void *, std::uint64_t, const_buffer_sequence, completion_handler<system::error_code, std::size_t>);
0051 #if defined(BOOST_ASIO_HAS_FILE)
0052 asio::basic_random_access_file<executor> implementation_;
0053 #endif
0054 };
0055
0056
0057 }
0058
0059 #endif