Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:48:55

0001 //
0002 // Copyright (c) 2019-2023 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MYSQL_DETAIL_CHANNEL_PTR_HPP
0009 #define BOOST_MYSQL_DETAIL_CHANNEL_PTR_HPP
0010 
0011 #include <boost/mysql/diagnostics.hpp>
0012 #include <boost/mysql/field_view.hpp>
0013 #include <boost/mysql/metadata_mode.hpp>
0014 
0015 #include <boost/mysql/detail/any_stream.hpp>
0016 #include <boost/mysql/detail/config.hpp>
0017 
0018 #include <boost/assert.hpp>
0019 
0020 #include <memory>
0021 
0022 namespace boost {
0023 namespace mysql {
0024 namespace detail {
0025 
0026 class channel;
0027 
0028 class channel_ptr
0029 {
0030     std::unique_ptr<channel> chan_;
0031 
0032     BOOST_MYSQL_DECL any_stream& get_stream() const;
0033 
0034 public:
0035     BOOST_MYSQL_DECL channel_ptr(std::size_t read_buff_size, std::unique_ptr<any_stream>);
0036     channel_ptr(const channel_ptr&) = delete;
0037     BOOST_MYSQL_DECL channel_ptr(channel_ptr&&) noexcept;
0038     channel_ptr& operator=(const channel_ptr&) = delete;
0039     BOOST_MYSQL_DECL channel_ptr& operator=(channel_ptr&&) noexcept;
0040     BOOST_MYSQL_DECL ~channel_ptr();
0041 
0042     any_stream& stream() noexcept { return get_stream(); }
0043     const any_stream& stream() const noexcept { return get_stream(); }
0044 
0045     channel& get() noexcept
0046     {
0047         BOOST_ASSERT(chan_);
0048         return *chan_;
0049     }
0050     const channel& get() const noexcept
0051     {
0052         BOOST_ASSERT(chan_);
0053         return *chan_;
0054     }
0055 
0056     BOOST_MYSQL_DECL metadata_mode meta_mode() const noexcept;
0057     BOOST_MYSQL_DECL void set_meta_mode(metadata_mode v) noexcept;
0058     BOOST_MYSQL_DECL diagnostics& shared_diag() noexcept;
0059 };
0060 
0061 BOOST_MYSQL_DECL std::vector<field_view>& get_shared_fields(channel&) noexcept;
0062 
0063 }  // namespace detail
0064 }  // namespace mysql
0065 }  // namespace boost
0066 
0067 #ifdef BOOST_MYSQL_HEADER_ONLY
0068 #include <boost/mysql/impl/channel_ptr.ipp>
0069 #endif
0070 
0071 #endif