random_access_device.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Copyright (c) 2025 Klemens Morgenstern (klemens.morgenstern@gmx.net)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. #ifndef BOOST_COBALT_IO_RANDOM_ACCESS_DEVICE_HPP
  8. #define BOOST_COBALT_IO_RANDOM_ACCESS_DEVICE_HPP
  9. #include <boost/cobalt/io/detail/config.hpp>
  10. #include <boost/cobalt/io/buffer.hpp>
  11. #include <boost/cobalt/io/ops.hpp>
  12. namespace boost::cobalt::io
  13. {
  14. // tag::outline[]
  15. struct BOOST_SYMBOL_VISIBLE random_access_write_device
  16. {
  17. virtual ~random_access_write_device() = default;
  18. [[nodiscard]] virtual write_at_op write_some_at(std::uint64_t offset, const_buffer_sequence buffer) = 0;
  19. };
  20. struct BOOST_SYMBOL_VISIBLE random_access_read_device
  21. {
  22. virtual ~random_access_read_device() = default;
  23. [[nodiscard]] virtual read_at_op read_some_at(std::uint64_t offset, mutable_buffer_sequence buffer) = 0;
  24. };
  25. struct random_access_device : random_access_read_device, random_access_write_device
  26. {
  27. };
  28. // end::outline[]
  29. }
  30. #endif //BOOST_COBALT_IO_RANDOM_ACCESS_DEVICE_HPP