Loading...
Searching...
No Matches
tcp_connection_ctx_base.hpp
Go to the documentation of this file.
/*
restinio
*/
#pragma once
#include <memory>
#include <restinio/connection_state_listener.hpp>
namespace restinio
{
//
// tcp_connection_ctx_base_t
//
class tcp_connection_ctx_base_t
: public std::enable_shared_from_this< tcp_connection_ctx_base_t >
{
public:
tcp_connection_ctx_base_t(connection_id_t id )
: m_connection_id{ id }
{}
virtual ~tcp_connection_ctx_base_t() = default;
connection_id_t connection_id() const noexcept { return m_connection_id; }
virtual void
check_timeout(
std::shared_ptr< tcp_connection_ctx_base_t > & self ) = 0;
protected:
template < typename Derived >
std::shared_ptr< Derived >
shared_from_concrete()
{
return std::static_pointer_cast< Derived >( shared_from_this() );
}
private:
const connection_id_t m_connection_id;
};
using tcp_connection_ctx_handle_t = std::shared_ptr< tcp_connection_ctx_base_t >;
using tcp_connection_ctx_weak_handle_t = std::weak_ptr< tcp_connection_ctx_base_t >;
} /* namespace restinio */
restinio::tcp_connection_ctx_base_t
TCP connection base.
Definition: tcp_connection_ctx_base.hpp:29
restinio::tcp_connection_ctx_base_t::check_timeout
virtual void check_timeout(std::shared_ptr< tcp_connection_ctx_base_t > &self)=0
Check timeouts for all activities.
restinio::tcp_connection_ctx_base_t::m_connection_id
const connection_id_t m_connection_id
Id of a connection.
Definition: tcp_connection_ctx_base.hpp:58
restinio::tcp_connection_ctx_base_t::tcp_connection_ctx_base_t
tcp_connection_ctx_base_t(connection_id_t id)
Definition: tcp_connection_ctx_base.hpp:31
restinio::tcp_connection_ctx_base_t::connection_id
connection_id_t connection_id() const noexcept
Get connection id.
Definition: tcp_connection_ctx_base.hpp:38
restinio::tcp_connection_ctx_base_t::shared_from_concrete
std::shared_ptr< Derived > shared_from_concrete()
Cast self to derived class.
Definition: tcp_connection_ctx_base.hpp:51
restinio::tcp_connection_ctx_base_t::~tcp_connection_ctx_base_t
virtual ~tcp_connection_ctx_base_t()=default
connection_state_listener.hpp
Stuff related to connection state listeners.
restinio
Definition: asio_include.hpp:21
restinio::tcp_connection_ctx_handle_t
std::shared_ptr< tcp_connection_ctx_base_t > tcp_connection_ctx_handle_t
Alias for http connection handle.
Definition: tcp_connection_ctx_base.hpp:62
restinio::tcp_connection_ctx_weak_handle_t
std::weak_ptr< tcp_connection_ctx_base_t > tcp_connection_ctx_weak_handle_t
Alias for http connection weak handle.
Definition: tcp_connection_ctx_base.hpp:65
restinio::connection_id_t
std::uint64_t connection_id_t
Type for ID of connection.
Definition: common_types.hpp:174
const
#define const
Definition: zconf.h:230