RESTinio
null_timer_manager.hpp
Go to the documentation of this file.
1 /*
2  restinio
3 */
4 
5 /*!
6  No-op timer factory implementation.
7 */
8 
9 #pragma once
10 
11 #include <chrono>
12 
13 #include <restinio/asio_include.hpp>
14 
15 #include <restinio/timer_common.hpp>
16 
17 namespace restinio
18 {
19 
20 //
21 // null_timer_manager_t
22 //
23 
24 //! Timer factory implementation using asio timers.
25 struct null_timer_manager_t final
26 {
27  //! Timer guard for async operations.
29  {
30  // Schedule timeouts check invocation.
31  template <typename... Args >
32  constexpr void schedule( Args &&... ) const noexcept {}
33 
34  // Cancel timeout guard if any.
35  constexpr void cancel() const noexcept {}
36  };
37 
38  // Create guard for connection.
39  constexpr timer_guard_t
40  create_timer_guard() const noexcept { return timer_guard_t{}; }
41 
42  //! Start/stop timer manager.
43  //! \{
44  constexpr void start() const noexcept {}
45  constexpr void stop() const noexcept {}
46  //! \}
47 
48  struct factory_t final
49  {
50  auto
52  {
53  return std::make_shared< null_timer_manager_t >();
54  }
55  };
56 };
57 
58 } /* namespace restinio */
constexpr void stop() const noexcept
auto create(asio_ns::io_context &) const
constexpr void schedule(Args &&...) const noexcept
constexpr timer_guard_t create_timer_guard() const noexcept
constexpr void start() const noexcept
Start/stop timer manager.
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, optional_t< Value_Type > >::type opt_value(const Parameter_Container &params, string_view_t key)
Gets the value of a parameter specified by key wrapped in optional_t<Value_Type> if parameter exists ...
Definition: value_or.hpp:64