Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::concepts::socket_read_guard< S > Class Template Reference

RAII guard for socket read loop. More...

#include <socket_concepts.h>

Collaboration diagram for kcenon::network::concepts::socket_read_guard< S >:
Collaboration graph

Public Member Functions

 socket_read_guard (S &socket)
 
 ~socket_read_guard ()
 
 socket_read_guard (const socket_read_guard &)=delete
 
socket_read_guardoperator= (const socket_read_guard &)=delete
 

Private Attributes

S & socket_
 

Detailed Description

template<StreamSocket S>
class kcenon::network::concepts::socket_read_guard< S >

RAII guard for socket read loop.

Ensures stop_read() is called when the guard goes out of scope.

Example usage:

template<StreamSocket S>
void process_socket(S& socket) {
socket_read_guard guard{socket};
socket.start_read();
// ... socket will stop reading when guard is destroyed
}

Definition at line 357 of file socket_concepts.h.

Constructor & Destructor Documentation

◆ socket_read_guard() [1/2]

template<StreamSocket S>
kcenon::network::concepts::socket_read_guard< S >::socket_read_guard ( S & socket)
inlineexplicit

Definition at line 360 of file socket_concepts.h.

◆ ~socket_read_guard()

template<StreamSocket S>
kcenon::network::concepts::socket_read_guard< S >::~socket_read_guard ( )
inline

Definition at line 361 of file socket_concepts.h.

361{ socket_.stop_read(); }

References kcenon::network::concepts::socket_read_guard< S >::socket_.

◆ socket_read_guard() [2/2]

template<StreamSocket S>
kcenon::network::concepts::socket_read_guard< S >::socket_read_guard ( const socket_read_guard< S > & )
delete

Member Function Documentation

◆ operator=()

template<StreamSocket S>
socket_read_guard & kcenon::network::concepts::socket_read_guard< S >::operator= ( const socket_read_guard< S > & )
delete

Member Data Documentation

◆ socket_

template<StreamSocket S>
S& kcenon::network::concepts::socket_read_guard< S >::socket_
private

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