RESTinio
Loading...
Searching...
No Matches
traits.hpp
Go to the documentation of this file.
1/*
2 restinio
3*/
4
9#pragma once
10
18
20
21namespace restinio
22{
23
24namespace details
25{
26
27namespace valid_request_handler_type_check
28{
29
30template< typename, typename, typename = restinio::utils::metaprogramming::void_t<> >
31struct valid_handler_type : public std::false_type {};
32
33template< typename Handler, typename Extra_Data_Factory >
35 Handler,
38 std::enable_if_t<
39 std::is_same<
40 request_handling_status_t,
41 decltype(std::declval<Handler>()(
42 std::declval<
43 generic_request_handle_t<
44 typename Extra_Data_Factory::data_t
45 >
46 >()))
47 >::value,
48 bool
49 >
50 >
51 > : public std::true_type
52{};
53
54} /* namespace valid_request_handler_type_check */
55
56//
57// autodetect_request_handler_type
58//
93
94//
95// actual_request_handler_type_detector
96//
102template<
103 typename Request_Handler,
104 typename Extra_Data_Factory >
106{
107 static_assert(
111 >::value,
112 "Request_Handler should be invocable with "
113 "generic_request_handle_t<Extra_Data_Factory::data_t>" );
114
116};
117
124template< typename Extra_Data_Factory >
133
134} /* namespace details */
135
136//
137// traits_t
138//
139
140template <
141 typename Timer_Manager,
142 typename Logger,
144 typename Strand = default_strand_t,
145 typename Socket = asio_ns::ip::tcp::socket >
359
360//
361// request_handler_type_from_traits_t
362//
374template< typename Traits >
377 typename Traits::request_handler_t,
378 typename Traits::extra_data_factory_t
379 >::request_handler_t;
380
381//
382// generic_request_type_from_traits_t
383//
394template< typename Traits >
397
398//
399// single_thread_traits_t
400//
401
402template <
403 typename Timer_Manager,
404 typename Logger,
408
409//
410// default_traits_t
411//
412
414
433
434} /* namespace restinio */
435
Timer factory implementation using asio timers.
The default implementation for http_method_mapper.
No operation logger.
Stuff related to limits of active parallel connections.
Stuff related to connection state listeners.
Typedefs for default strands.
Stuff related to IP blockers.
Various tools for C++ metaprogramming.
typename details::actual_request_handler_type_detector< typename Traits::request_handler_t, typename Traits::extra_data_factory_t >::request_handler_t request_handler_type_from_traits_t
A metafunction for extraction a request-handler type from server's traits.
Definition traits.hpp:375
std::shared_ptr< generic_request_t< Extra_Data > > generic_request_handle_t
An alias for shared-pointer to incoming request.
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
asio_ns::strand< default_asio_executor > default_strand_t
A typedef for the default strand type.
request_handling_status_t
Request handling status.
std::function< request_handling_status_t( generic_request_handle_t< typename Extra_Data_Factory::data_t >) > request_handler_t
Definition traits.hpp:129
A metafunction for the detection of type of a request-handler.
Definition traits.hpp:106
A special type to be used as indicator that the type of a request handler should be automatically det...
Definition traits.hpp:92
The default no-op IP-blocker.
The default extra-data-factory to be used in server's traits if a user doesn't specify own one.
Timer_Manager timer_manager_t
Definition traits.hpp:249
Socket stream_socket_t
Definition traits.hpp:253
Request_Handler request_handler_t
Definition traits.hpp:251
static constexpr bool use_connection_count_limiter
A flag that enables or disables the usage of connection count limiter.
Definition traits.hpp:278