MySQL 8.4.2
Source Code Documentation
SocketContainer< Protocol > Class Template Reference

container of sockets. More...

#include <socket_container.h>

Public Types

using protocol_type = Protocol
 
using socket_type = typename protocol_type::socket
 
using container_type = std::list< socket_type >
 

Public Member Functions

socket_typepush_back (socket_type &&sock)
 move ownership of socket_type to the container. More...
 
template<class... Args>
socket_typeemplace_back (Args &&... args)
 move ownership of socket_type to the container. More...
 
socket_type release (socket_type &client_sock)
 release socket from container. More...
 
socket_type release_unlocked (socket_type &client_sock)
 
template<class F >
auto run (F &&f)
 
void disconnect_all ()
 disconnect all sockets. More...
 
bool empty () const
 check if the container is empty. More...
 
size_t size () const
 get size of container. More...
 

Private Attributes

container_type sockets_
 
std::mutex mtx_
 

Detailed Description

template<class Protocol>
class SocketContainer< Protocol >

container of sockets.

allows to disconnect all of them.

thread-safe.

Member Typedef Documentation

◆ container_type

template<class Protocol >
using SocketContainer< Protocol >::container_type = std::list<socket_type>

◆ protocol_type

template<class Protocol >
using SocketContainer< Protocol >::protocol_type = Protocol

◆ socket_type

template<class Protocol >
using SocketContainer< Protocol >::socket_type = typename protocol_type::socket

Member Function Documentation

◆ disconnect_all()

template<class Protocol >
void SocketContainer< Protocol >::disconnect_all ( )
inline

disconnect all sockets.

◆ emplace_back()

template<class Protocol >
template<class... Args>
socket_type & SocketContainer< Protocol >::emplace_back ( Args &&...  args)
inline

move ownership of socket_type to the container.

Returns
a ref to the stored socket.

◆ empty()

template<class Protocol >
bool SocketContainer< Protocol >::empty ( ) const
inline

check if the container is empty.

◆ push_back()

template<class Protocol >
socket_type & SocketContainer< Protocol >::push_back ( socket_type &&  sock)
inline

move ownership of socket_type to the container.

Returns
a ref to the stored socket.

◆ release()

template<class Protocol >
socket_type SocketContainer< Protocol >::release ( socket_type client_sock)
inline

release socket from container.

moves ownership of the socket to the caller.

Returns
socket

◆ release_unlocked()

template<class Protocol >
socket_type SocketContainer< Protocol >::release_unlocked ( socket_type client_sock)
inline

◆ run()

template<class Protocol >
template<class F >
auto SocketContainer< Protocol >::run ( F &&  f)
inline

◆ size()

template<class Protocol >
size_t SocketContainer< Protocol >::size ( ) const
inline

get size of container.

Member Data Documentation

◆ mtx_

template<class Protocol >
std::mutex SocketContainer< Protocol >::mtx_
mutableprivate

◆ sockets_

template<class Protocol >
container_type SocketContainer< Protocol >::sockets_
private

The documentation for this class was generated from the following file: