Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:33

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco 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 // Official repository: https://github.com/boostorg/beast
0008 //
0009 
0010 #ifndef BOOST_BEAST_WEBSOCKET_DETAIL_SERVICE_HPP
0011 #define BOOST_BEAST_WEBSOCKET_DETAIL_SERVICE_HPP
0012 
0013 #include <boost/beast/core/detail/service_base.hpp>
0014 #include <boost/asio/execution_context.hpp>
0015 #include <boost/enable_shared_from_this.hpp>
0016 #include <mutex>
0017 #include <vector>
0018 
0019 namespace boost {
0020 namespace beast {
0021 namespace websocket {
0022 namespace detail {
0023 
0024 class service
0025     : public beast::detail::service_base<service>
0026 {
0027 public:
0028     class impl_type
0029         : public boost::enable_shared_from_this<impl_type>
0030     {
0031         service& svc_;
0032         std::size_t index_;
0033 
0034         friend class service;
0035 
0036     public:
0037         virtual ~impl_type() = default;
0038 
0039         BOOST_BEAST_DECL
0040         explicit
0041         impl_type(net::execution_context& ctx);
0042 
0043         BOOST_BEAST_DECL
0044         void
0045         remove();
0046 
0047         virtual
0048         void
0049         shutdown() = 0;
0050     };
0051 
0052 private:
0053     std::mutex m_;
0054     std::vector<impl_type*> v_;
0055 
0056     BOOST_BEAST_DECL
0057     void
0058     shutdown() override;
0059 
0060 public:
0061     BOOST_BEAST_DECL
0062     explicit
0063     service(net::execution_context& ctx)
0064         : beast::detail::service_base<service>(ctx)
0065     {
0066     }
0067 };
0068 
0069 } // detail
0070 } // websocket
0071 } // beast
0072 } // boost
0073 
0074 #if BOOST_BEAST_HEADER_ONLY
0075 #include <boost/beast/websocket/detail/service.ipp>
0076 #endif
0077 
0078 #endif