RESTinio
tcp_connection_ctx_base.hpp
Go to the documentation of this file.
1/*
2 restinio
3*/
4
9#pragma once
10
11#include <memory>
12
14
15namespace restinio
16{
17
18//
19// tcp_connection_ctx_base_t
20//
21
23
28 : public std::enable_shared_from_this< tcp_connection_ctx_base_t >
29{
30 public:
32 : m_connection_id{ id }
33 {}
34
35 virtual ~tcp_connection_ctx_base_t() = default;
36
39
41 virtual void
44 std::shared_ptr< tcp_connection_ctx_base_t > & self ) = 0;
45
46 protected:
47
49 template < typename Derived >
50 std::shared_ptr< Derived >
52 {
53 return std::static_pointer_cast< Derived >( shared_from_this() );
54 }
55
56 private:
59};
60
62using tcp_connection_ctx_handle_t = std::shared_ptr< tcp_connection_ctx_base_t >;
63
65using tcp_connection_ctx_weak_handle_t = std::weak_ptr< tcp_connection_ctx_base_t >;
66
67} /* namespace restinio */
68
virtual void check_timeout(std::shared_ptr< tcp_connection_ctx_base_t > &self)=0
Check timeouts for all activities.
const connection_id_t m_connection_id
Id of a connection.
connection_id_t connection_id() const noexcept
Get connection id.
std::shared_ptr< Derived > shared_from_concrete()
Cast self to derived class.
virtual ~tcp_connection_ctx_base_t()=default
Stuff related to connection state listeners.
std::shared_ptr< tcp_connection_ctx_base_t > tcp_connection_ctx_handle_t
Alias for http connection handle.
std::weak_ptr< tcp_connection_ctx_base_t > tcp_connection_ctx_weak_handle_t
Alias for http connection weak handle.
std::uint64_t connection_id_t
Type for ID of connection.
#define const
Definition: zconf.h:230